Applied patch [ 652336 ] Add tooltip support to wxUniv on Windows
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@18537 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
		| @@ -160,6 +160,10 @@ public: | ||||
|     virtual bool Enable(bool enable = TRUE); | ||||
|     virtual bool Show(bool show = TRUE); | ||||
|  | ||||
| #if wxUSE_TOOLTIPS | ||||
|     virtual void DoSetToolTip( wxToolTip *tip ); | ||||
| #endif // wxUSE_TOOLTIPS | ||||
|  | ||||
| protected: | ||||
|     // override the base class virtuals involved into geometry calculations | ||||
|     virtual wxSize DoGetBestClientSize() const; | ||||
|   | ||||
| @@ -84,6 +84,10 @@ public: | ||||
|     virtual wxString GetLabel() const; | ||||
|     virtual void SetLabel(const wxString& label); | ||||
|  | ||||
| #if wxUSE_TOOLTIPS | ||||
|     virtual void DoSetToolTip( wxToolTip *tip ); | ||||
| #endif // wxUSE_TOOLTIPS | ||||
|  | ||||
|     // wxUniversal-only methods | ||||
|  | ||||
|     // another Append() version | ||||
|   | ||||
| @@ -352,7 +352,7 @@ void wxToolTip::SetWindow(wxWindow *win) | ||||
|     { | ||||
|         Add(m_window->GetHWND()); | ||||
|     } | ||||
|  | ||||
| #if !defined(__WXUNIVERSAL__) | ||||
|     // and all of its subcontrols (e.g. radiobuttons in a radiobox) as well | ||||
|     wxControl *control = wxDynamicCast(m_window, wxControl); | ||||
|     if ( control ) | ||||
| @@ -393,6 +393,7 @@ void wxToolTip::SetWindow(wxWindow *win) | ||||
|             Add(hwndComboEdit); | ||||
|         } | ||||
|     } | ||||
| #endif // !defined(__WXUNIVERSAL__) | ||||
| } | ||||
|  | ||||
| void wxToolTip::SetTip(const wxString& tip) | ||||
|   | ||||
| @@ -1519,7 +1519,7 @@ void wxWindowMSW::DoSetToolTip(wxToolTip *tooltip) | ||||
|     wxWindowBase::DoSetToolTip(tooltip); | ||||
|  | ||||
|     if ( m_tooltip ) | ||||
|         m_tooltip->SetWindow(this); | ||||
|         m_tooltip->SetWindow((wxWindow *)this); | ||||
| } | ||||
|  | ||||
| #endif // wxUSE_TOOLTIPS | ||||
|   | ||||
| @@ -41,6 +41,7 @@ | ||||
|     #include "wx/validate.h" | ||||
| #endif | ||||
|  | ||||
| #include "wx/tooltip.h" | ||||
| #include "wx/popupwin.h" | ||||
|  | ||||
| #include "wx/univ/renderer.h" | ||||
| @@ -351,6 +352,29 @@ bool wxComboControl::Show(bool show) | ||||
|     return TRUE; | ||||
| } | ||||
|  | ||||
| #if wxUSE_TOOLTIPS | ||||
| void wxComboControl::DoSetToolTip(wxToolTip *tooltip) | ||||
| { | ||||
|     wxControl::DoSetToolTip(tooltip);     | ||||
|  | ||||
|     // Set tool tip for button and text box | ||||
|     if (m_text && m_btn) | ||||
|     { | ||||
|         if (tooltip) | ||||
|         { | ||||
|             const wxString &tip = tooltip->GetTip(); | ||||
|             m_text->SetToolTip(tip); | ||||
|             m_btn->SetToolTip(tip); | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|             m_text->SetToolTip(NULL); | ||||
|             m_btn->SetToolTip(NULL); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| #endif // wxUSE_TOOLTIPS | ||||
|  | ||||
| // ---------------------------------------------------------------------------- | ||||
| // popup window handling | ||||
| // ---------------------------------------------------------------------------- | ||||
|   | ||||
| @@ -36,6 +36,8 @@ | ||||
|     #include "wx/validate.h" | ||||
| #endif | ||||
|  | ||||
| #include "wx/tooltip.h" | ||||
|  | ||||
| #include "wx/univ/theme.h" | ||||
| #include "wx/univ/renderer.h" | ||||
| #include "wx/univ/inphand.h" | ||||
| @@ -341,6 +343,23 @@ void wxRadioBox::SetLabel(const wxString& label) | ||||
|     wxStaticBox::SetLabel(label); | ||||
| } | ||||
|  | ||||
| #if wxUSE_TOOLTIPS | ||||
| void wxRadioBox::DoSetToolTip(wxToolTip *tooltip) | ||||
| { | ||||
|     wxControl::DoSetToolTip(tooltip); | ||||
|  | ||||
|     // Also set them for all Radio Buttons | ||||
|     size_t count = m_buttons.GetCount(); | ||||
|     for ( size_t n = 0; n < count; n++ ) | ||||
|     { | ||||
|         if (tooltip) | ||||
|             m_buttons[n]->SetToolTip(tooltip->GetTip()); | ||||
|         else | ||||
|             m_buttons[n]->SetToolTip(NULL); | ||||
|     } | ||||
| } | ||||
| #endif // wxUSE_TOOLTIPS | ||||
|  | ||||
| // ---------------------------------------------------------------------------- | ||||
| // buttons positioning | ||||
| // ---------------------------------------------------------------------------- | ||||
|   | ||||
		Reference in New Issue
	
	Block a user