File: wx53.htm

package info (click to toggle)
wxwin2-doc 2.01-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 6,540 kB
  • ctags: 5,968
  • sloc: cpp: 15,157; makefile: 434; sh: 6
file content (134 lines) | stat: -rw-r--r-- 4,970 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<HTML>
<head><title>wxCommandProcessor</title></head>

<BODY BGCOLOR=#FFFFFF>
<A NAME="wxcommandprocessor"></A><CENTER>
<A HREF="wx.htm"><img align=center src="contents.gif" BORDER=0 ALT="Contents"></A> <A HREF="wx22.htm#classref"><img align=center src="up.gif" BORDER=0 ALT="Up"></A> <A HREF="wx52.htm#wxcommandevent"><img align=center src="back.gif" BORDER=0 ALT="Previous"></A> <A HREF="wx54.htm#wxcondition"><img align=center src="forward.gif" BORDER=0 ALT="Next"></A> </CENTER><HR>

<H2>wxCommandProcessor</H2>
<P>
wxCommandProcessor is a class that maintains a history of wxCommands,
with undo/redo functionality built-in. Derive a new class from this
if you want different behaviour.<P>
<B><FONT COLOR="#FF0000">Derived from</FONT></B><P>
<A HREF="wx158.htm#wxobject">wxObject</A><P>
<B><FONT COLOR="#FF0000">Include files</FONT></B><P>
&lt;wx/docview.h&gt;<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx298.htm#wxcommandprocessoroverview">wxCommandProcessor overview</A>, <A HREF="wx51.htm#wxcommand">wxCommand</A><P>
<B><FONT COLOR="#FF0000">Members</FONT></B><P>
<A HREF="#topic117">wxCommandProcessor::wxCommandProcessor</A><BR>
<A HREF="#topic118">wxCommandProcessor::~wxCommandProcessor</A><BR>
<A HREF="#topic119">wxCommandProcessor::CanUndo</A><BR>
<A HREF="#topic120">wxCommandProcessor::ClearCommands</A><BR>
<A HREF="#topic121">wxCommandProcessor::Do</A><BR>
<A HREF="#topic122">wxCommandProcessor::GetCommands</A><BR>
<A HREF="#topic123">wxCommandProcessor::GetMaxCommands</A><BR>
<A HREF="#topic124">wxCommandProcessor::GetEditMenu</A><BR>
<A HREF="#topic125">wxCommandProcessor::Initialize</A><BR>
<A HREF="#topic126">wxCommandProcessor::SetEditMenu</A><BR>
<A HREF="#topic127">wxCommandProcessor::Submit</A><BR>
<A HREF="#topic128">wxCommandProcessor::Undo</A><BR>
<P>

<HR>
<A NAME="topic117"></A>
<H3>wxCommandProcessor::wxCommandProcessor</H3>
<P>
<B></B> <B>wxCommandProcessor</B>(<B>int</B><I> maxCommands = 100</I>)<P>
Constructor.<P>
<I>maxCommands</I> defaults to a rather arbitrary 100, but can be set from 1 to any integer.
If your wxCommand classes store a lot of data, you may wish the limit the number of
commands stored to a smaller number.<P>

<HR>
<A NAME="topic118"></A>
<H3>wxCommandProcessor::~wxCommandProcessor</H3>
<P>
<B></B> <B>~wxCommandProcessor</B>()<P>
Destructor.<P>

<HR>
<A NAME="topic119"></A>
<H3>wxCommandProcessor::CanUndo</H3>
<P>
<B>virtual bool</B> <B>CanUndo</B>()<P>
Returns TRUE if the currently-active command can be undone, FALSE otherwise.<P>

<HR>
<A NAME="topic120"></A>
<H3>wxCommandProcessor::ClearCommands</H3>
<P>
<B>virtual void</B> <B>ClearCommands</B>()<P>
Deletes all the commands in the list and sets the current command pointer to NULL.<P>

<HR>
<A NAME="topic121"></A>
<H3>wxCommandProcessor::Do</H3>
<P>
<B>virtual bool</B> <B>Do</B>()<P>
Executes (redoes) the current command (the command that has just been undone if any).<P>

<HR>
<A NAME="topic122"></A>
<H3>wxCommandProcessor::GetCommands</H3>
<P>
<B>wxList&amp;</B> <B>GetCommands</B>() <B>const</B><P>
Returns the list of commands.<P>

<HR>
<A NAME="topic123"></A>
<H3>wxCommandProcessor::GetMaxCommands</H3>
<P>
<B>int</B> <B>GetMaxCommands</B>() <B>const</B><P>
Returns the maximum number of commands that the command processor stores.<P>

<HR>
<A NAME="topic124"></A>
<H3>wxCommandProcessor::GetEditMenu</H3>
<P>
<B>wxMenu*</B> <B>GetEditMenu</B>() <B>const</B><P>
Returns the edit menu associated with the command processor.<P>

<HR>
<A NAME="topic125"></A>
<H3>wxCommandProcessor::Initialize</H3>
<P>
<B>virtual void</B> <B>Initialize</B>()<P>
Initializes the command processor, setting the current command to the
last in the list (if any), and updating the edit menu (if one has been
specified).<P>

<HR>
<A NAME="topic126"></A>
<H3>wxCommandProcessor::SetEditMenu</H3>
<P>
<B>void</B> <B>SetEditMenu</B>(<B>wxMenu* </B><I>menu</I>)<P>
Tells the command processor to update the Undo and Redo items on this
menu as appropriate. Set this to NULL if the menu is about to be
destroyed and command operations may still be performed, or the command
processor may try to access an invalid pointer.<P>

<HR>
<A NAME="topic127"></A>
<H3>wxCommandProcessor::Submit</H3>
<P>
<B>virtual bool</B> <B>Submit</B>(<B>wxCommand *</B><I>command</I>, <B>bool</B><I> storeIt = TRUE</I>)<P>
Submits a new command to the command processor. The command processor
calls wxCommand::Do to execute the command; if it succeeds, the command
is stored in the history list, and the associated edit menu (if any) updated
appropriately. If it fails, the command is deleted
immediately. Once Submit has been called, the passed command should not
be deleted directly by the application.<P>
<I>storeIt</I> indicates whether the successful command should be stored
in the history list.<P>

<HR>
<A NAME="topic128"></A>
<H3>wxCommandProcessor::Undo</H3>
<P>
<B>virtual bool</B> <B>Undo</B>()<P>
Undoes the command just executed.<P>


</BODY></HTML>