Added wxHelpEvent, wxContextHelp (MSW only so far), modified help sample
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8271 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -917,6 +917,10 @@ enum wxStretch
|
||||
// Add for normal Windows frame behaviour
|
||||
#define wxFRAME_FLOAT_ON_PARENT 0x0020
|
||||
|
||||
// Context-sensitive help
|
||||
#define wxFRAME_EX_CONTEXTHELP 0x00000004
|
||||
#define wxDIALOG_EX_CONTEXTHELP 0x00000004
|
||||
|
||||
/*
|
||||
* MDI parent frame style flags
|
||||
* Can overlap with some of the above.
|
||||
|
@@ -291,6 +291,9 @@ enum
|
||||
wxEVT_PLOT_END_TITLE_EDIT = wxEVT_FIRST + 1025,
|
||||
wxEVT_PLOT_AREA_CREATE = wxEVT_FIRST + 1026,
|
||||
|
||||
/* Help events */
|
||||
wxEVT_HELP = wxEVT_FIRST + 1050,
|
||||
|
||||
wxEVT_USER_FIRST = wxEVT_FIRST + 2000
|
||||
};
|
||||
|
||||
@@ -1400,6 +1403,26 @@ public:
|
||||
wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); }
|
||||
};
|
||||
|
||||
/*
|
||||
wxEVT_HELP
|
||||
Sent when the user clicks on a window in context-help mode.
|
||||
The cursor position is in screen coordinates.
|
||||
*/
|
||||
|
||||
class WXDLLEXPORT wxHelpEvent : public wxCommandEvent
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxHelpEvent)
|
||||
|
||||
public:
|
||||
wxHelpEvent(wxEventType type = wxEVT_NULL, wxWindowID id = 0, const wxPoint& pt = wxPoint(0, 0))
|
||||
{ m_eventType = type; m_id = id; m_pos = pt; }
|
||||
|
||||
const wxPoint& GetPosition() const { return m_pos; }
|
||||
void SetPosition(const wxPoint& pos) { m_pos = pos; }
|
||||
|
||||
wxPoint m_pos;
|
||||
};
|
||||
|
||||
#endif // wxUSE_GUI
|
||||
|
||||
// Idle event
|
||||
@@ -1603,6 +1626,7 @@ typedef void (wxEvtHandler::*wxWindowCreateEventFunction)(wxWindowCreateEvent&);
|
||||
typedef void (wxEvtHandler::*wxWindowDestroyEventFunction)(wxWindowDestroyEvent&);
|
||||
typedef void (wxEvtHandler::*wxSetCursorEventFunction)(wxSetCursorEvent&);
|
||||
typedef void (wxEvtHandler::*wxNotifyEventFunction)(wxNotifyEvent&);
|
||||
typedef void (wxEvtHandler::*wxHelpEventFunction)(wxHelpEvent&);
|
||||
#endif // wxUSE_GUI
|
||||
|
||||
// N.B. In GNU-WIN32, you *have* to take the address of a member function
|
||||
@@ -1818,6 +1842,13 @@ const wxEventTableEntry theClass::sm_eventTableEntries[] = { \
|
||||
#define EVT_UPDATE_UI_RANGE(id1, id2, func) \
|
||||
{ wxEVT_UPDATE_UI, id1, id2, (wxObjectEventFunction)(wxEventFunction)(wxUpdateUIEventFunction)&func, (wxObject *) NULL },
|
||||
|
||||
// Help events
|
||||
#define EVT_HELP(id, func) \
|
||||
{ wxEVT_HELP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxHelpEventFunction) & func, (wxObject *) NULL },
|
||||
|
||||
#define EVT_HELP_RANGE(id1, id2, func) \
|
||||
{ wxEVT_HELP, id1, id2, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxHelpEventFunction) & func, (wxObject *) NULL },
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Global data
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@@ -76,6 +76,35 @@ public:
|
||||
virtual void OnQuit(void) {};
|
||||
};
|
||||
|
||||
/*
|
||||
* wxContextHelp
|
||||
* Invokes context-sensitive help. When the user
|
||||
* clicks on a window, a wxEVT_HELP event will be sent to that
|
||||
* window for the application to display help for.
|
||||
*/
|
||||
|
||||
class WXDLLEXPORT wxContextHelp: public wxObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxContextHelp)
|
||||
public:
|
||||
wxContextHelp(wxWindow* win = NULL, bool beginHelp = TRUE);
|
||||
~wxContextHelp();
|
||||
|
||||
bool BeginContextHelp(wxWindow* win);
|
||||
bool EndContextHelp();
|
||||
|
||||
bool EventLoop(const wxCursor& cursor, wxWindow* win);
|
||||
bool DispatchEvent(wxWindow* win, const wxPoint& pt);
|
||||
|
||||
#ifdef __WXMSW__
|
||||
bool ProcessHelpMessage(WXMSG* wxmsg, const wxCursor& cursor, wxWindow* win);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
bool m_inHelp;
|
||||
};
|
||||
|
||||
#endif // wxUSE_HELP
|
||||
#endif
|
||||
// _WX_HELPBASEH__
|
||||
|
Reference in New Issue
Block a user