// event handlers
void OnPaint(wxPaintEvent& event);
void OnMouseClick(wxMouseEvent& event);
+ void OnActivate(wxActivateEvent& event);
+ void OnKillFocus(wxFocusEvent& event);
// calculate the client rect we need to display the text
void Adjust(const wxString& text, wxCoord maxLength);
#include "wx/tipwin.h"
#include "wx/app.h"
-
+#include "wx/module.h"
#include "wx/cshelp.h"
// ----------------------------------------------------------------------------
return FALSE;
}
+// ----------------------------------------------------------------------------
+// wxHelpProviderModule: module responsible for cleaning up help provider.
+// ----------------------------------------------------------------------------
+
+class wxHelpProviderModule : public wxModule
+{
+public:
+ bool OnInit();
+ void OnExit();
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxHelpProviderModule)
+};
+
+IMPLEMENT_DYNAMIC_CLASS(wxHelpProviderModule, wxModule)
+
+bool wxHelpProviderModule::OnInit()
+{
+ // Probably we don't want to do anything by default,
+ // since it could pull in extra code
+ // wxHelpProvider::Set(new wxSimpleHelpProvider);
+
+ return TRUE;
+}
+
+void wxHelpProviderModule::OnExit()
+{
+ if (wxHelpProvider::Get())
+ {
+ delete wxHelpProvider::Get();
+ wxHelpProvider::Set(NULL);
+ }
+}
+
#endif // wxUSE_HELP
EVT_LEFT_DOWN(wxTipWindow::OnMouseClick)
EVT_RIGHT_DOWN(wxTipWindow::OnMouseClick)
EVT_MIDDLE_DOWN(wxTipWindow::OnMouseClick)
+ EVT_KILL_FOCUS(wxTipWindow::OnKillFocus)
+ EVT_ACTIVATE(wxTipWindow::OnActivate)
END_EVENT_TABLE()
// ----------------------------------------------------------------------------
Adjust(text, maxLength);
- // capture mouse as we want to dismiss the window when it is clicked
- CaptureMouse();
+ SetFocus();
Show(TRUE);
}
// first filll the background
dc.SetBrush(wxBrush(GetBackgroundColour(), wxSOLID));
- dc.SetPen(*wxBLACK_PEN);
+
+ // Under Windows, you apparently get a thin black border whether you like it or not :-(
+#ifdef __WXMSW__
+ dc.SetPen( * wxTRANSPARENT_PEN );
+#else
+ dc.SetPen( * wxBLACK_PEND );
+#endif
dc.DrawRectangle(rect);
// and then draw the text line by line
void wxTipWindow::OnMouseClick(wxMouseEvent& event)
{
- ReleaseMouse();
+ Close();
+}
+
+void wxTipWindow::OnActivate(wxActivateEvent& event)
+{
+ if (!event.GetActive())
+ Close();
+}
+void wxTipWindow::OnKillFocus(wxFocusEvent& event)
+{
Close();
}
# End Source File
# Begin Source File
+SOURCE=.\generic\tipwin.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\generic\treectlg.cpp
# End Source File
# Begin Source File
# End Source File
# Begin Source File
+SOURCE=.\generic\tipwin.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\generic\treectlg.cpp
# End Source File
# Begin Source File