1. wxWindow::IsTopLevel() added and documented
2. wxDynamicClass() added and documented 3. first Motif fixes (doesn't compile yet) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2693 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1596,23 +1596,6 @@ Returns a pointer to the wxClassInfo object associated with this class.
|
||||
|
||||
<wx/object.h>
|
||||
|
||||
\membersection{WXDEBUG\_NEW}\label{debugnew}
|
||||
|
||||
\func{}{WXDEBUG\_NEW}{arg}
|
||||
|
||||
This is defined in debug mode to be call the redefined new operator
|
||||
with filename and line number arguments. The definition is:
|
||||
|
||||
\begin{verbatim}
|
||||
#define WXDEBUG_NEW new(__FILE__,__LINE__)
|
||||
\end{verbatim}
|
||||
|
||||
In non-debug mode, this is defined as the normal new operator.
|
||||
|
||||
\wxheading{Include files}
|
||||
|
||||
<wx/object.h>
|
||||
|
||||
\membersection{DECLARE\_ABSTRACT\_CLASS}
|
||||
|
||||
\func{}{DECLARE\_ABSTRACT\_CLASS}{className}
|
||||
@@ -1810,8 +1793,59 @@ base classes.
|
||||
|
||||
<wx/object.h>
|
||||
|
||||
\membersection{WXDEBUG\_NEW}\label{debugnew}
|
||||
|
||||
\func{}{WXDEBUG\_NEW}{arg}
|
||||
|
||||
This is defined in debug mode to be call the redefined new operator
|
||||
with filename and line number arguments. The definition is:
|
||||
|
||||
\begin{verbatim}
|
||||
#define WXDEBUG_NEW new(__FILE__,__LINE__)
|
||||
\end{verbatim}
|
||||
|
||||
In non-debug mode, this is defined as the normal new operator.
|
||||
|
||||
\wxheading{Include files}
|
||||
|
||||
<wx/object.h>
|
||||
|
||||
\membersection{wxDynamicCast}\label{wxdynamiccast}
|
||||
|
||||
\func{}{wxDynamicCast}{ptr, classname}
|
||||
|
||||
This macro returns the pointer {\it ptr} cast to the type {\it classname *} if
|
||||
the pointer is of this type (the check is done during the run-time) or NULL
|
||||
otherwise. Usage of this macro is prefered over obsoleted wxObject::IsKindOf()
|
||||
function.
|
||||
|
||||
The {\it ptr} argument may be NULL, in which case NULL will be returned.
|
||||
|
||||
Example:
|
||||
|
||||
\begin{verbatim}
|
||||
wxWindow *win = wxWindow::FindFocus();
|
||||
wxTextCtrl *text = wxDynamicCast(win, wxTextCtrl);
|
||||
if ( text )
|
||||
{
|
||||
// a text control has the focus...
|
||||
}
|
||||
else
|
||||
{
|
||||
// no window has the focus or it's not a text control
|
||||
}
|
||||
\end{verbatim}
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{RTTI overview}{runtimeclassoverview}
|
||||
|
||||
\membersection{WXTRACE}\label{trace}
|
||||
|
||||
\wxheading{Include files}
|
||||
|
||||
<wx/object.h>
|
||||
|
||||
\func{}{WXTRACE}{formatString, ...}
|
||||
|
||||
Calls wxTrace with printf-style variable argument syntax. Output
|
||||
|
@@ -2,13 +2,25 @@
|
||||
|
||||
Classes: \helpref{wxObject}{wxobject}, \helpref{wxClassInfo}{wxclassinfo}.
|
||||
|
||||
One of the failings of C++ is that no run-time information is provided
|
||||
One of the failings of C++ used to be that no run-time information was provided
|
||||
about a class and its position in the inheritance hierarchy.
|
||||
Another is that instances of a class cannot be created just by knowing the name of a class,
|
||||
which makes facilities such as persistent storage hard to implement.
|
||||
Another, which still persists, is that instances of a class cannot be created
|
||||
just by knowing the name of a class, which makes facilities such as persistent
|
||||
storage hard to implement.
|
||||
|
||||
Most C++ GUI frameworks overcome these limitations by means of a set of
|
||||
macros and functions and wxWindows is no exception.
|
||||
macros and functions and wxWindows is no exception. As it originated before the
|
||||
addition of RTTI to the standard C++ and as support for it still missing from
|
||||
some (albeit old) compilers, wxWindows doesn't (yet) use it, but provides its
|
||||
own macro-based RTTI system.
|
||||
|
||||
In the future, the standard C++ RTTI will be used though and you're encouraged
|
||||
to use whenever possible \helpref{wxDynamicCast()}{wxdynamiccast} macro which,
|
||||
for the implementations that support it, is defined just as dynamic\_cast<> and
|
||||
uses wxWindows RTTI for all the others. This macro is limited to wxWindows
|
||||
classes only and only works with pointers (unlike the real dynamic\_cast<> which
|
||||
also accepts referencies).
|
||||
|
||||
Each class that you wish to be known the type system should have
|
||||
a macro such as DECLARE\_DYNAMIC\_CLASS just inside the class declaration.
|
||||
The macro IMPLEMENT\_DYNAMIC\_CLASS should be in the implementation file.
|
||||
@@ -31,9 +43,9 @@ dynamic 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.
|
||||
|
||||
wxObject::IsKindOf uses the linked list of wxClassInfo. It takes
|
||||
a wxClassInfo argument, so use CLASSINFO(className) to return an
|
||||
appropriate wxClassInfo pointer to use in this function.
|
||||
\helpref{wxObject::IsKindOf}{wxobjectiskindof} uses the linked list of
|
||||
wxClassInfo. It takes a wxClassInfo argument, so use CLASSINFO(className)
|
||||
to return an appropriate wxClassInfo pointer to use in this function.
|
||||
|
||||
The function \helpref{wxCreateDynamicObject}{wxcreatedynamicobject} can be used
|
||||
to construct a new object of a given type, by supplying a string name.
|
||||
@@ -68,26 +80,27 @@ See also \helpref{wxObject}{wxobject} and \helpref{wxCreateDynamicObject}{wxcrea
|
||||
|
||||
\subsection{Example}
|
||||
|
||||
In a header file wx\_frame.h:
|
||||
In a header file frame.h:
|
||||
|
||||
\begin{verbatim}
|
||||
class wxFrame: public wxWindow
|
||||
class wxFrame : public wxWindow
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxFrame)
|
||||
DECLARE_DYNAMIC_CLASS(wxFrame)
|
||||
|
||||
private:
|
||||
char *frameTitle;
|
||||
public:
|
||||
...
|
||||
private:
|
||||
wxString m_title;
|
||||
|
||||
public:
|
||||
...
|
||||
};
|
||||
\end{verbatim}
|
||||
|
||||
In a C++ file wx\_frame.cc:
|
||||
In a C++ file frame.cpp:
|
||||
|
||||
\begin{verbatim}
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow)
|
||||
|
||||
wxFrame::wxFrame(void)
|
||||
wxFrame::wxFrame()
|
||||
{
|
||||
...
|
||||
}
|
||||
|
@@ -253,9 +253,9 @@ implements the following methods:\par
|
||||
|
||||
Additionally, the following helper functions are defined:\par
|
||||
\indented{2cm}{\begin{twocollist}
|
||||
\twocolitem{\bf{wxDLG_PNT(win, point)}}{Converts a wxPoint from dialog
|
||||
\twocolitem{\bf{wxDLG\_PNT(win, point)}}{Converts a wxPoint from dialog
|
||||
units to pixels}
|
||||
\twocolitem{\bf{wxDLG_SZE(win, size)}}{Converts a wxSize from dialog
|
||||
\twocolitem{\bf{wxDLG\_SZE(win, size)}}{Converts a wxSize from dialog
|
||||
units to pixels}
|
||||
\end{twocollist}}
|
||||
}
|
||||
@@ -757,6 +757,14 @@ Retained windows are only available on X platforms.
|
||||
|
||||
Returns TRUE if the window is shown, FALSE if it has been hidden.
|
||||
|
||||
\membersection{wxWindow::IsTopLevel}\label{wxwindowistoplevel}
|
||||
|
||||
\constfunc{bool}{IsTopLevel}{\void}
|
||||
|
||||
Returns TRUE if the given window is a top-level one. Currently all frames and
|
||||
dialogs are considered to be top-level windows (even if they have a parent
|
||||
window).
|
||||
|
||||
\membersection{wxWindow::Layout}\label{wxwindowlayout}
|
||||
|
||||
\func{void}{Layout}{\void}
|
||||
|
Reference in New Issue
Block a user