wxHelpProvider now cleans itself up. wxTipWindow doesn't

grab the mouse, but instead deletes itself when it's deactivated
or loses the focus.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8325 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2000-09-11 12:37:44 +00:00
parent afb02ca57c
commit 129caaddf1
5 changed files with 66 additions and 6 deletions

View File

@@ -55,6 +55,8 @@ BEGIN_EVENT_TABLE(wxTipWindow, wxFrame)
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()
// ----------------------------------------------------------------------------
@@ -79,8 +81,7 @@ wxTipWindow::wxTipWindow(wxWindow *parent,
Adjust(text, maxLength);
// capture mouse as we want to dismiss the window when it is clicked
CaptureMouse();
SetFocus();
Show(TRUE);
}
@@ -158,7 +159,13 @@ void wxTipWindow::OnPaint(wxPaintEvent& event)
// 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
@@ -178,7 +185,16 @@ void wxTipWindow::OnPaint(wxPaintEvent& event)
void wxTipWindow::OnMouseClick(wxMouseEvent& event)
{
ReleaseMouse();
Close();
}
void wxTipWindow::OnActivate(wxActivateEvent& event)
{
if (!event.GetActive())
Close();
}
void wxTipWindow::OnKillFocus(wxFocusEvent& event)
{
Close();
}