This class is used for pseudo-events which are called by wxWidgets to give an application the chance to update various user interface elements.
Derived from
wxCommandEvent
wxEvent
wxObject
Include files
<wx/event.h>
Event table macros
To process an update event, use these event handler macros to direct input to member functions that take a wxUpdateUIEvent argument.
| EVT_UPDATE_UI(id, func) | Process a wxEVT_UPDATE_UI event for the command with the given id. |
| EVT_UPDATE_UI_RANGE(id1, id2, func) | Process a wxEVT_UPDATE_UI event for any command with id included in the given range. |
Without update UI events, an application has to work hard to check/uncheck, enable/disable, and set the text for elements such as menu items and toolbar buttons. The code for doing this has to be mixed up with the code that is invoked when an action is invoked for a menu item or button.
With update UI events, you define an event handler to look at the state of the application and change UI elements accordingly. wxWidgets will call your member functions in idle time, so you don't have to worry where to call this code. In addition to being a clearer and more declarative method, it also means you don't have to worry whether you're updating a toolbar or menubar identifier. The same handler can update a menu item and toolbar button, if the identifier is the same.
Instead of directly manipulating the menu or button, you call functions in the event object, such as wxUpdateUIEvent::Check. wxWidgets will determine whether such a call has been made, and which UI element to update.
These events will work for popup menus as well as menubars. Just before a menu is popped
up, wxMenu::UpdateUItom, F="#topic1006">wxTreeLayout::SetNodeName
wxTreeLayout::SetNodeX
wxTreeLayout::SetNodeY
wxTreeLayout::SetOrientation
wxTreeLayout::SetTopNode
wxTreeLayout::SetSpacing
wxTreeLayout::SetMargins
wxTreeLayout()
Constructor.
void ActivateNode(long id, bool active)
Define this so wxTreeLayout can turn nodes on and off for drawing purposes (not all nodes may be connected in the tree). See also wxTreeLayout::NodeActive.
void CalcLayout(long id, int level)
Private function for laying out a branch.
void DoLayout(wxDC& dc, long topNode = -1)
Calculates the layout for the tree, optionally specifying the top node.
void Draw(wxDC& dc)
Call this to let wxTreeLayout draw the tree itself, once the layout has been calculated with wxTreeLayout::DoLayout.
void DrawBranch(long from, long to, wxDC& dc)
Defined by wxTreeLayout to draw an arc between two nodes.
void DrawBranches(wxDC& dc)
Defined by wxTreeLayout to draw the arcs between nodes.
void DrawNode(long id, wxDC& dc)
Defined by wxTreeLayout to draw a node.
void DrawNodes(wxDC& dc)
Defined by wxTreeLayout to draw the nodes.
void GetChildren(long id, wxList &list)
Must be defined to return the children of node id in the given list of integers.
long GetNextNode(long id)
Must be defined to return the next node after id, so that wxTreeLayout can iterate through all relevant nodes. The ordering is not important. The function should return -1 if there are no more nodes.
wxString GetNodeName(long id) const
May optionally be defined to get a node's name (for example if leaving the drawing to wxTreeLayout).
void GetNodeSize(long id, long* x, long* y) const
Can be defined to indicate a node's size, or left to wxTreeLayout to use the name as an indication of size.
long GetNodeParent(long id) const
Must be defined to return the parent node of id. The function should return -1 if there is no parent.
long GetNodeX(long id) const
Must be defined to return the current X position of the node. Note that coordinates are assumed to be at the top-left of the node so some conversion may be necessary for your application.