Use wx-prefixed macros in documentation

This commit is contained in:
Paul Cornett
2015-09-06 21:13:49 -07:00
parent de402edc09
commit 641784c42a
8 changed files with 28 additions and 28 deletions

View File

@@ -41,7 +41,7 @@ public:
virtual bool OnInit(); virtual bool OnInit();
}; };
IMPLEMENT_APP(DerivedApp) wxIMPLEMENT_APP(DerivedApp);
bool DerivedApp::OnInit() bool DerivedApp::OnInit()
{ {
@@ -53,14 +53,14 @@ bool DerivedApp::OnInit()
} }
@endcode @endcode
Note the use of IMPLEMENT_APP(appClass), which allows wxWidgets to dynamically Note the use of wxIMPLEMENT_APP(appClass), which allows wxWidgets to dynamically
create an instance of the application object at the appropriate point in create an instance of the application object at the appropriate point in
wxWidgets initialization. Previous versions of wxWidgets used to rely on the wxWidgets initialization. Previous versions of wxWidgets used to rely on the
creation of a global application object, but this is no longer recommended, creation of a global application object, but this is no longer recommended,
because required global initialization may not have been performed at because required global initialization may not have been performed at
application object construction time. application object construction time.
You can also use DECLARE_APP(appClass) in a header file to declare the wxGetApp You can also use wxDECLARE_APP(appClass) in a header file to declare the wxGetApp
function which returns a reference to the application object. Otherwise you can function which returns a reference to the application object. Otherwise you can
only use the global @c wxTheApp pointer which is of type @c wxApp*. only use the global @c wxTheApp pointer which is of type @c wxApp*.

View File

@@ -108,8 +108,8 @@ protected:
} }
private: private:
DECLARE_DYNAMIC_CLASS(MySpecialWidget) wxDECLARE_DYNAMIC_CLASS(MySpecialWidget);
DECLARE_EVENT_TABLE() wxDECLARE_EVENT_TABLE();
}; };
@endcode @endcode

View File

@@ -38,7 +38,7 @@ be running on are unusually constrained (notice that when asserts are disabled
their condition is not even evaluated so the only run-time cost is a single their condition is not even evaluated so the only run-time cost is a single
condition check and the extra space taken by the asserts in the code). condition check and the extra space taken by the asserts in the code).
This automatic deactivation of debugging code is done by IMPLEMENT_APP() macro This automatic deactivation of debugging code is done by wxIMPLEMENT_APP() macro
so if you don't use you may need to explicitly call wxDISABLE_DEBUG_SUPPORT() so if you don't use you may need to explicitly call wxDISABLE_DEBUG_SUPPORT()
yourself. yourself.

View File

@@ -114,7 +114,7 @@ wxDocument class, you need to derive a new class and override at least the
member functions SaveObject and LoadObject. SaveObject and LoadObject will be member functions SaveObject and LoadObject. SaveObject and LoadObject will be
called by the framework when the document needs to be saved or loaded. called by the framework when the document needs to be saved or loaded.
Use the macros DECLARE_DYNAMIC_CLASS and IMPLEMENT_DYNAMIC_CLASS in order to Use the macros wxDECLARE_DYNAMIC_CLASS and wxIMPLEMENT_DYNAMIC_CLASS in order to
allow the framework to create document objects on demand. When you create a allow the framework to create document objects on demand. When you create a
wxDocTemplate object on application initialization, you should pass wxDocTemplate object on application initialization, you should pass
CLASSINFO(YourDocumentClass) to the wxDocTemplate constructor so that it knows CLASSINFO(YourDocumentClass) to the wxDocTemplate constructor so that it knows
@@ -139,7 +139,7 @@ To use the abstract wxView class, you need to derive a new class and override
at least the member functions OnCreate, OnDraw, OnUpdate and OnClose. You will at least the member functions OnCreate, OnDraw, OnUpdate and OnClose. You will
probably want to respond to menu commands from the frame containing the view. probably want to respond to menu commands from the frame containing the view.
Use the macros DECLARE_DYNAMIC_CLASS and IMPLEMENT_DYNAMIC_CLASS in order to Use the macros wxDECLARE_DYNAMIC_CLASS and wxIMPLEMENT_DYNAMIC_CLASS in order to
allow the framework to create view objects on demand. When you create a allow the framework to create view objects on demand. When you create a
wxDocTemplate object on application initialization, you should pass wxDocTemplate object on application initialization, you should pass
CLASSINFO(YourViewClass) to the wxDocTemplate constructor so that it knows how CLASSINFO(YourViewClass) to the wxDocTemplate constructor so that it knows how
@@ -295,10 +295,10 @@ In order to respond to a file load command from one of these identifiers, you
need to handle them using an event handler, for example: need to handle them using an event handler, for example:
@code @code
BEGIN_EVENT_TABLE(wxDocParentFrame, wxFrame) wxBEGIN_EVENT_TABLE(wxDocParentFrame, wxFrame)
EVT_MENU(wxID_EXIT, wxDocParentFrame::OnExit) EVT_MENU(wxID_EXIT, wxDocParentFrame::OnExit)
EVT_MENU_RANGE(wxID_FILE1, wxID_FILE9, wxDocParentFrame::OnMRUFile) EVT_MENU_RANGE(wxID_FILE1, wxID_FILE9, wxDocParentFrame::OnMRUFile)
END_EVENT_TABLE() wxEND_EVENT_TABLE()
void wxDocParentFrame::OnExit(wxCommandEvent& WXUNUSED(event)) void wxDocParentFrame::OnExit(wxCommandEvent& WXUNUSED(event))
{ {

View File

@@ -40,8 +40,8 @@ same code to draw to several different devices. You can draw using the member
functions of wxDC, such as wxDC::DrawLine and wxDC::DrawText. Control colour on functions of wxDC, such as wxDC::DrawLine and wxDC::DrawText. Control colour on
a window (wxColour) with brushes (wxBrush) and pens (wxPen). a window (wxColour) with brushes (wxBrush) and pens (wxPen).
To intercept events, you add a DECLARE_EVENT_TABLE macro to the window class To intercept events, you add a wxDECLARE_EVENT_TABLE macro to the window class
declaration, and put a BEGIN_EVENT_TABLE ... END_EVENT_TABLE block in the declaration, and put a wxBEGIN_EVENT_TABLE ... wxEND_EVENT_TABLE block in the
implementation file. Between these macros, you add event macros which map the implementation file. Between these macros, you add event macros which map the
event (such as a mouse click) to a member function. These might override event (such as a mouse click) to a member function. These might override
predefined event handlers such as for wxKeyEvent and wxMouseEvent. predefined event handlers such as for wxKeyEvent and wxMouseEvent.

View File

@@ -30,8 +30,8 @@ all the others. This macro is limited to wxWidgets classes only and only works
with pointers (unlike the real dynamic_cast which also accepts references). with pointers (unlike the real dynamic_cast which also accepts references).
Each class that you wish to be known to the type system should have a macro Each class that you wish to be known to the type system should have a macro
such as DECLARE_DYNAMIC_CLASS just inside the class declaration. The macro such as wxDECLARE_DYNAMIC_CLASS just inside the class declaration. The macro
IMPLEMENT_DYNAMIC_CLASS should be in the implementation file. Note that these wxIMPLEMENT_DYNAMIC_CLASS should be in the implementation file. Note that these
are entirely optional; use them if you wish to check object types, or create are entirely optional; use them if you wish to check object types, or create
instances of classes using the class name. However, it is good to get into the instances of classes using the class name. However, it is good to get into the
habit of adding these macros for all classes. habit of adding these macros for all classes.
@@ -39,13 +39,13 @@ habit of adding these macros for all classes.
Variations on these macros are used for multiple inheritance, and abstract Variations on these macros are used for multiple inheritance, and abstract
classes that cannot be instantiated dynamically or otherwise. classes that cannot be instantiated dynamically or otherwise.
DECLARE_DYNAMIC_CLASS inserts a static wxClassInfo declaration into the class, wxDECLARE_DYNAMIC_CLASS inserts a static wxClassInfo declaration into the class,
initialized by IMPLEMENT_DYNAMIC_CLASS. When initialized, the wxClassInfo initialized by wxIMPLEMENT_DYNAMIC_CLASS. When initialized, the wxClassInfo
object inserts itself into a linked list (accessed through wxClassInfo::first object inserts itself into a linked list (accessed through wxClassInfo::first
and wxClassInfo::next pointers). The linked list is fully created by the time and wxClassInfo::next pointers). The linked list is fully created by the time
all global initialisation is done. all global initialisation is done.
IMPLEMENT_DYNAMIC_CLASS is a macro that not only initialises the static wxIMPLEMENT_DYNAMIC_CLASS is a macro that not only initialises the static
wxClassInfo member, but defines a global function capable of creating a dynamic wxClassInfo member, but defines a global function capable of creating a dynamic
object of the class in question. A pointer to this function is stored in object of the class in question. A pointer to this function is stored in
wxClassInfo, and is used when an object should be created dynamically. wxClassInfo, and is used when an object should be created dynamically.
@@ -64,7 +64,7 @@ wxClassInfo object instead, then you can simply call wxClassInfo::CreateObject.
@section overview_rtti_classinfo wxClassInfo @section overview_rtti_classinfo wxClassInfo
This class stores meta-information about classes. An application may use macros This class stores meta-information about classes. An application may use macros
such as DECLARE_DYNAMIC_CLASS and IMPLEMENT_DYNAMIC_CLASS to record runtime such as wxDECLARE_DYNAMIC_CLASS and wxIMPLEMENT_DYNAMIC_CLASS to record runtime
information about a class, including: information about a class, including:
@li Its position in the inheritance hierarchy. @li Its position in the inheritance hierarchy.
@@ -72,8 +72,8 @@ information about a class, including:
@li A string representation of the class name. @li A string representation of the class name.
@li A function that can be called to construct an instance of this class. @li A function that can be called to construct an instance of this class.
The DECLARE_... macros declare a static wxClassInfo variable in a class, which The wxDECLARE_... macros declare a static wxClassInfo variable in a class, which
is initialized by macros of the form IMPLEMENT_... in the implementation C++ is initialized by macros of the form wxIMPLEMENT_... in the implementation C++
file. Classes whose instances may be constructed dynamically are given a global file. Classes whose instances may be constructed dynamically are given a global
constructor function which returns a new object. constructor function which returns a new object.
@@ -89,7 +89,7 @@ In a header file frame.h:
@code @code
class wxFrame : public wxWindow class wxFrame : public wxWindow
{ {
DECLARE_DYNAMIC_CLASS(wxFrame) wxDECLARE_DYNAMIC_CLASS(wxFrame);
private: private:
wxString m_title; wxString m_title;
@@ -102,7 +102,7 @@ public:
In a C++ file frame.cpp: In a C++ file frame.cpp:
@code @code
IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow) wxIMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow);
wxFrame::wxFrame() wxFrame::wxFrame()
{ {

View File

@@ -402,12 +402,12 @@ public:
{ {
Close(); Close();
} }
DECLARE_EVENT_TABLE(); wxDECLARE_EVENT_TABLE();
}; };
BEGIN_EVENT_TABLE(TestWnd,TestWnd_Base) wxBEGIN_EVENT_TABLE(TestWnd,TestWnd_Base)
EVT_BUTTON(XRCID("B"), TestWnd::OnBPressed) EVT_BUTTON(XRCID("B"), TestWnd::OnBPressed)
END_EVENT_TABLE() wxEND_EVENT_TABLE()
@endcode @endcode
It is also possible to access the wxSizerItem of a sizer that is part of a It is also possible to access the wxSizerItem of a sizer that is part of a
@@ -452,7 +452,7 @@ public:
virtual bool CanHandle(wxXmlNode *node); virtual bool CanHandle(wxXmlNode *node);
// Register with wxWidgets' dynamic class subsystem. // Register with wxWidgets' dynamic class subsystem.
DECLARE_DYNAMIC_CLASS(MyControlXmlHandler) wxDECLARE_DYNAMIC_CLASS(MyControlXmlHandler);
}; };
@endcode @endcode
@@ -460,7 +460,7 @@ The implementation of your custom XML handler will typically look as:
@code @code
// Register with wxWidgets' dynamic class subsystem. // Register with wxWidgets' dynamic class subsystem.
IMPLEMENT_DYNAMIC_CLASS(MyControlXmlHandler, wxXmlResourceHandler) wxIMPLEMENT_DYNAMIC_CLASS(MyControlXmlHandler, wxXmlResourceHandler);
MyControlXmlHandler::MyControlXmlHandler() MyControlXmlHandler::MyControlXmlHandler()
{ {

View File

@@ -2523,7 +2523,7 @@ The subclass must satisfy a number of requirements:
-# It must be derived from the class specified in @c class attribute. -# It must be derived from the class specified in @c class attribute.
-# It must be visible in wxWidget's pseudo-RTTI mechanism, i.e. there must be -# It must be visible in wxWidget's pseudo-RTTI mechanism, i.e. there must be
a DECLARE_DYNAMIC_CLASS() entry for it. a wxDECLARE_DYNAMIC_CLASS() entry for it.
-# It must support two-phase creation. In particular, this means that it has -# It must support two-phase creation. In particular, this means that it has
to have default constructor. to have default constructor.
-# It cannot provide custom Create() method and must be constructible using -# It cannot provide custom Create() method and must be constructible using