Put wxContextHelp into cshelp.h/cpp, added wxContextHelpButton

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8294 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2000-09-08 10:49:39 +00:00
parent d134f1702e
commit fb6261e9ba
23 changed files with 399 additions and 205 deletions

74
include/wx/cshelp.h Normal file
View File

@@ -0,0 +1,74 @@
/////////////////////////////////////////////////////////////////////////////
// Name: cshelp.h
// Purpose: Context-sensitive help classes
// Author: Julian Smart
// Modified by:
// Created: 08/09/2000
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_CSHELPH__
#define _WX_CSHELPH__
#ifdef __GNUG__
#pragma interface "cshelp.h"
#endif
#include "wx/defs.h"
#if wxUSE_HELP
#include "wx/bmpbuttn.h"
/*
* 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();
bool DispatchEvent(wxWindow* win, const wxPoint& pt);
void SetStatus(bool status) { m_status = status; }
protected:
bool m_inHelp;
bool m_status; // TRUE if the user left-clicked
};
/*
* wxContextHelpButton
* You can add this to your dialogs (especially on non-Windows platforms)
* to put the application into context help mode.
*/
class WXDLLEXPORT wxContextHelpButton: public wxBitmapButton
{
public:
wxContextHelpButton(wxWindow* parent, wxWindowID id = wxID_CONTEXT_HELP,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(20, -1),
long style = wxBU_AUTODRAW);
void OnContextHelp(wxCommandEvent& event);
DECLARE_CLASS(wxContextHelpButton)
DECLARE_EVENT_TABLE()
};
#endif // wxUSE_HELP
#endif
// _WX_CSHELPH__

View File

@@ -1310,6 +1310,7 @@ enum wxStretch
#define wxID_MORE 5109
#define wxID_SETUP 5110
#define wxID_RESET 5111
#define wxID_CONTEXT_HELP 5112
// IDs used by generic file dialog (11 consecutive starting from this value)
#define wxID_FILEDLGG 5900

View File

@@ -293,6 +293,7 @@ enum
/* Help events */
wxEVT_HELP = wxEVT_FIRST + 1050,
wxEVT_DETAILED_HELP,
wxEVT_USER_FIRST = wxEVT_FIRST + 2000
};
@@ -1404,7 +1405,7 @@ public:
};
/*
wxEVT_HELP
wxEVT_HELP, wxEVT_DETAILED_HELP
Sent when the user clicks on a window in context-help mode.
The cursor position is in screen coordinates.
*/
@@ -1417,10 +1418,21 @@ public:
wxHelpEvent(wxEventType type = wxEVT_NULL, wxWindowID id = 0, const wxPoint& pt = wxPoint(0, 0))
{ m_eventType = type; m_id = id; m_pos = pt; }
// Position of event
const wxPoint& GetPosition() const { return m_pos; }
void SetPosition(const wxPoint& pos) { m_pos = pos; }
// Optional link to further help
const wxString& GetLink() const { return m_link; }
void SetLink(const wxString& link) { m_link = link; }
// Optional target to display help in. E.g. a window specification
const wxString& GetTarget() const { return m_target; }
void SetTarget(const wxString& target) { m_target = target; }
wxPoint m_pos;
wxString m_target;
wxString m_link;
};
#endif // wxUSE_GUI
@@ -1849,6 +1861,12 @@ const wxEventTableEntry theClass::sm_eventTableEntries[] = { \
#define EVT_HELP_RANGE(id1, id2, func) \
{ wxEVT_HELP, id1, id2, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxHelpEventFunction) & func, (wxObject *) NULL },
#define EVT_DETAILED_HELP(id, func) \
{ wxEVT_DETAILED_HELP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxHelpEventFunction) & func, (wxObject *) NULL },
#define EVT_DETAILED_HELP_RANGE(id1, id2, func) \
{ wxEVT_DETAILED_HELP, id1, id2, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxHelpEventFunction) & func, (wxObject *) NULL },
// ----------------------------------------------------------------------------
// Global data
// ----------------------------------------------------------------------------

View File

@@ -76,34 +76,6 @@ 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();
bool DispatchEvent(wxWindow* win, const wxPoint& pt);
void SetStatus(bool status) { m_status = status; }
protected:
bool m_inHelp;
bool m_status; // TRUE if the user left-clicked
};
#endif // wxUSE_HELP
#endif
// _WX_HELPBASEH__

BIN
include/wx/msw/csquery.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 B

View File

@@ -155,3 +155,6 @@ plot_enl_bmp BITMAP "wx/msw/plot_enl.bmp"
plot_shr_bmp BITMAP "wx/msw/plot_shr.bmp"
plot_zin_bmp BITMAP "wx/msw/plot_zin.bmp"
plot_zot_bmp BITMAP "wx/msw/plot_zot.bmp"
// For wxContextHelpButton
csquery_bmp BITMAP "wx/msw/csquery.bmp"