示例#1
0
// DestroyWindow ------------------------------------------------------------
BOOL CCodeListCtrl::DestroyWindow()
{
   // Make sure parent doesn't want to prevent window being destroyed.
   if( m_bAcceptSel || NotifyParent( CMN_CODELISTCANCEL ) )
      return FALSE;

   // Destroy the tool tip if it exists
   SetTipText( NULL );

   return CDispatchWnd::DestroyWindow();
}
示例#2
0
// OnSelChange --------------------------------------------------------------
void CCodeListCtrl::OnSelChange( int iNewItem )
{
   CM_CODELISTSELCHANGEDATA hdr = {0};

   hdr.iItem = iNewItem;

#ifdef _ACTIVEX

   LPTSTR pszText = (LPTSTR)NotifyParent( CMN_CODELISTSELCHANGE,
      (LPNMHDR)&hdr );

   SetTipText( pszText );

   if( pszText )
      delete [] pszText;

#else

   // Notify the parent of selection change, and see if a tooltip is
   // needed...
   //
   if( !NotifyParent( CMN_CODELISTSELCHANGE, (LPNMHDR)&hdr ) )
   {
      // Notification not handled by parent, so destroy the tooltip if it
      // exists.
      SetTipText( NULL );
   }
   else
   {
      // If no instance handle is specified, we'll just use the text
      // provided in either szText or pszText - whichever has valid data.
      // If no data is provided and the tooltip exists, it will be
      // destroyed.
      //
      if( NULL == hdr.hInstance )
         SetTipText( ( NULL == hdr.pszText ? hdr.szText : hdr.pszText ) );
      else
      {
         // An instance handle was specified, so the pszText member is the
         // identifier of a string resource to be loaded...
         //
         LPTSTR pszText = NULL;
         DWORD dwIn = 0, dwSize = CM_MAX_CODELIST_TIP;

         do
         {
            pszText = new TCHAR[ dwSize ];
            ASSERT( NULL != pszText );

            if( NULL == pszText )
            {
               // Out of memory, so destroy the tooltip.
               SetTipText( NULL );
               return;
            }

            dwIn = LoadString( hdr.hInstance, (UINT)hdr.pszText,
               pszText, dwSize );

            if( 0 == dwIn )
            {
               // String resource not found!  Make sure you didn't use
               // the MAKEINTRESOURCE macro - just pass in the numeric
               // ID of the string.
               //
               ASSERT( FALSE );
               SetTipText( NULL );// Destroy the tooltip
               return;
            }

            if( dwIn + 1 == dwSize )
            {
               // Need to try a bigger buffer...
               dwSize *= 2;
               delete [] pszText;
               pszText = NULL;
            }

         }while( NULL == pszText );

         SetTipText( pszText );
         delete [] pszText;
      }
   }

#endif//#ifdef _ACTIVEX

}
示例#3
0
BOOL CTrayIcon::SetTipText(UINT nID)
{
	CString szTip;
	VERIFY(szTip.LoadString(nID));
	return SetTipText(szTip);
}
示例#4
0
/*----------------------------------------------------------------------
 -----------------------------------------------------------------------*/
AmayaTipDialog::AmayaTipDialog(wxWindow *parent,
                         wxTipProvider *tipProvider,
                         bool showAtStartup)
           : wxDialog(parent, wxID_ANY, TtaConvMessageToWX(TtaGetMessage(LIB, TIP_DIALOG_TITLE)),
                      wxDefaultPosition, wxDefaultSize,
                      wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER
                      )
{
    m_tipProvider = tipProvider;

    // 1) create all controls in tab order
    wxButton *btnClose = new wxButton(this, XRCID("wxID_TIP_CLOSE"), TtaConvMessageToWX(TtaGetMessage(LIB, TIP_DIALOG_TIP_CLOSE)));
    SetAffirmativeId(XRCID("wxID_TIP_CLOSE"));

    m_checkbox = new wxCheckBox(this, wxID_ANY, TtaConvMessageToWX(TtaGetMessage(LIB, TIP_DIALOG_STARTUP)));
    m_checkbox->SetValue(showAtStartup);

    wxButton *btnNext = new wxButton(this, XRCID("wxID_TIP_NEXT"), TtaConvMessageToWX(TtaGetMessage(LIB, TIP_DIALOG_NEXT_TIP)));

    wxButton *btnPrevious = new wxButton(this, XRCID("wxID_TIP_PREVIOUS"), TtaConvMessageToWX(TtaGetMessage(LIB, TIP_DIALOG_PREVIOUS_TIP)));

    wxStaticText *text = new wxStaticText(this, wxID_ANY, TtaConvMessageToWX(TtaGetMessage(LIB, TIP_DIALOG_DID_YOU_KNOW)));

    wxFont font = text->GetFont();
    font.SetPointSize(int(1.6 * font.GetPointSize()));
    font.SetWeight(wxFONTWEIGHT_BOLD);
    text->SetFont(font);

    m_text = new wxTextCtrl(this, wxID_ANY, wxEmptyString,
                            wxDefaultPosition, wxSize(200, 160),
                            wxTE_MULTILINE |
                            wxTE_READONLY |
                            wxTE_NO_VSCROLL |
                            wxTE_RICH2 | // a hack to get rid of vert scrollbar
                            wxDEFAULT_CONTROL_BORDER
                            );
#if defined(__WXMSW__)
    m_text->SetFont(wxFont(12, wxSWISS, wxNORMAL, wxNORMAL));
#endif

    wxIcon icon = wxArtProvider::GetIcon(wxART_TIP, wxART_CMN_DIALOG);
    wxStaticBitmap *bmp = new wxStaticBitmap(this, wxID_ANY, icon);

    // 2) put them in boxes

    wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );

    wxBoxSizer *icon_text = new wxBoxSizer( wxHORIZONTAL );
    icon_text->Add( bmp, 0, wxCENTER );
    icon_text->Add( text, 1, wxCENTER | wxLEFT, 20 );
    topsizer->Add( icon_text, 0, wxEXPAND | wxALL, 10 );

    topsizer->Add( m_text, 1, wxEXPAND | wxLEFT|wxRIGHT, 10 );

    wxBoxSizer *bottom = new wxBoxSizer( wxHORIZONTAL );
    bottom->Add( m_checkbox, 0, wxCENTER );

    bottom->Add( 10,10,1 );
    bottom->Add( btnPrevious, 0, wxCENTER | wxLEFT, 10 );
    bottom->Add( btnNext, 0, wxCENTER | wxLEFT, 10 );
    bottom->Add( btnClose, 0, wxCENTER | wxLEFT, 10 );

    topsizer->Add( bottom, 0, wxEXPAND | wxALL, 10 );

    SetTipText();

    SetSizer( topsizer );

    topsizer->SetSizeHints( this );
    topsizer->Fit( this );

    Centre(wxBOTH | wxCENTER_FRAME);
}
示例#5
0
// "Previous" button handler
void AmayaTipDialog::OnPreviousTip(wxCommandEvent& WXUNUSED(event)) {
  delta = -1;
  SetTipText(); }
示例#6
0
// "Next" button handler
void AmayaTipDialog::OnNextTip(wxCommandEvent& WXUNUSED(event)) {
  delta = +1;
  SetTipText(); }