| Methods Index |
CNotifierSubclasses:
CApplication, CDocument, CView
CBoss provides access to global objects and global data, and it ties in classes under a common memory manager. Also, CBoss provides basic internal functionality to the classes, such as the basis for the event and message passing structure. An abstract class, it is used mainly for purposes of inheritance. All classes in the XVT-Power++ application framework (consisting of view, document, and application branches) inherit from CBoss.
CBoss is used through the CApplication class, which initializes and creates its static globals. You should never need to derive an object directly from CBoss, but you could do it to extend the class library.
|
|
|
|
friend class
|
CApplication;
|
Allow application to set G
|
friend class
|
CUnits;
|
Allow units to call UpdateUnits
|
CBoss has three methods for event hooks that are located in objects within the application framework hierarchy. These are the three primary events that every application, document, and view object can handle.
virtual void DoCommand(long theCommand,
void* theData = NULL);
DoCommand event starts at some object and then chains upward through the application framework event hierarchy, stopping at any point. Such events can be passed all the way up to the application object. The path a DoCommand travels is based on a supervisor relationship. It follows the rule of looking for its boss, which is the object that is in charge of it.The void pointer theData can be used to pass any user-defined structure to the DoCommand method.
virtual void DoMenuCommand(MENU_TAG theMenuItem, BOOLEAN isShiftKey, BOOLEAN isControlKey);
DoMenuCommand first goes to the window from which the selection was made. If the window cannot handle the command, it sends the command to its document. The event chains upward, stopping at any point, to the application. theMenuItem is the menu item number of the command, starting at one. Disabled commands and dividing lines count in the numbering. isShiftKey and isControlKey specify whether the mouse is used with the Shift key or Control key. Note that this method is not called for menubar font selections; instead the ChangeFont method is called.
virtual void ChangeFont(const CFont &theFont);
ChangeFont sends a font object, theFont, that indicates the current state of the Font/Style menu.
ChangeFont is an event that chains upward from some view, as does DoMenuCommand. You must override this method to define actions for updating fonts. CWindow, CDocument, and CApplication all have the appropriate overridden methods.
CBoss, which provides for broadcasting commands, menu commands, timer events, and user events. Commands and events arrive at the children through normal methods calls. For example, children will receive a command broadcast in their DoCommand() methods. By default, broadcasts from a parent only go to that parent's children and no deeper in the object tree. However, you can force deep broadcast by passing TRUE for the isDeep parameter in each of the broadcast methods.
virtual void BroadcastCommand(long theCommand, void* theData=NULL, BOOLEAN isDeep = FALSE);
virtual void BroadcastMenuCommand(
MENU_TAG theTag,
BOOLEAN isShift,
BOOLEAN isCtrl,
BOOLEAN isDeep = FALSE);
virtual void BroadcastTimer(long theTimerId,
BOOLEAN isDeep = FALSE);
virtual void BroadcastUser(long theUserId, void* theData
BOOLEAN isDeep = FALSE);
BOOLEAN IsBroadcasting() const;
TRUE if the received command or event is the result of a broadcast command as opposed to normal messaging. DSC++ uses this information to decide whether a command or event should be sent to an object's children or its parent.
virtual void DoTimer(long theTimerId);
E_TIMER) event. You set a timer using the XVT Portability Toolkit's xvt_timer_create function, which takes a window and a time interval (in milliseconds) and returns an ID number for the timer. This is the ID number that is passed to theTimerId of DoTimer. When the timer generates a timer event, CSwitchBoard passes it to the XVT Portability Toolkit-designated window via DoTimer. The window passes it on to its selected view, if it has one. The timer event may propagate upwards from a view to the window to the document and all the way to the application object, stopping at any point.
virtual void DoUser(long theUserId, void* theData);
E_USER) event. As noted in the XVT Portability Toolkit Guide, user events allow you to pass custom events to windows and dialogs. theUserId is the ID number that designates a particular kind of user event. The void pointer theData can be used to pass any user-defined structure to DoUser, just as you would for a DoCommand. As with timer events, CSwitchBoard passes a user event to a designated window. The window passes it on to its selected view, if it has one. The timer event may propagate upwards from a view to the window to the document and all the way to the application object, stopping at any point.
virtual CUnits* GetUnits(void) const;
CUnits object. That is, this method returns the logical units for an object of type CBoss. The logical units are mapped out to the physical device on which you are displaying your information. We use the term "physical device" because the units can be mapped not only to a screen display but also to a printer display. If they are mapped to the screen, the logical units are translated into pixels; if they are mapped to a printer, then the logical units are translated into printer units. See CUnits.
virtual void SetUnits(CUnits* theCoordinateUnits);
CBoss object. The units are logical units that are mapped either to the screen or to the printer. Logical units can be measured in inches, centimeters, characters, pixels, or a user-defined measurement. In XVT-Power++, the default unit is pixels. See CUnits.
static CUnits* GetCreationUnits(void);
SetCreationUnits must be called before each object that is to use those units, unless the units would be set through the default unit sharing mechanism.
static void SetCreationUnits(CUnits* theUnits);
CBoss-derived object. If the creation are NULL each object initializes its units as best fit. See the different CBoss-derived classes for specifics.
virtual const RWOrdered* GetSubObjects(void)
const = NULL;
CBoss, specifically, CApplication, CDocument, CView, and CSubview. It returns a list of any subobjects associated with a given object. For example, the application would return a list of all its documents, a document would return a list of all its windows, a window would return a list of all its enclosed views, and so on.
virtual long GetId(void) const; virtual void SetId(long theId = PWRIdBase);
CSubview::FindSubview(long . . .)).
CBoss (void);
CBoss (const CBoss& theBoss);
CBoss& operator = (const CBoss& theBoss);
CBoss. This is a shallow copy; it does not copy the pointers of all the objects inside it. This method should be called by the equal operator of derived classes.
virtual ~CBoss(void);
CBoss.
BOOLEAN IBoss(CGlobalUser *theGlobalUser);
CBoss of the existence of the user-specified globals. theGlobalUser is a pointer to an object of type CGlobalUser, which contains global utilities for a user application.
virtual void UpdateUnits(CUnits* theUnits);
CUnits object indicated by theUnits, which is the object owned by the CBoss object. The owner updates itself and propagates the update message to any of its child objects. For example, the application would update all of its documents, the documents would update all of their windows, and so on, but only if they are sharing the same CUnits object. Basically, the owner of a CUnits object is the top-most object in the hierarchy that is using the CUnits object.
BOOLEAN IBoss(CGlobalClassLib *theGlobalClassLib);
CBoss of the existence of the globals. theGlobalClassLib is a pointer to an object of type CGlobalClassLib, which contains global utilities for XVT-Power++.