CBossprovides access to global objects and global data, and it ties in classes under a common memory manager. Also,
CBossprovides 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
CBossis used through the
CApplicationclass, 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.
||The logical coordinates used by the object|
||The object's ID|
Flag used to determine if |
Allow application to set |
Allow units to call |
CBosshas 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);
DoCommandevent 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
DoCommandtravels 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
theDatacan be used to pass any user-defined structure to the
virtual void DoMenuCommand(MENU_TAG theMenuItem, BOOLEAN isShiftKey, BOOLEAN isControlKey);
DoMenuCommandfirst 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.
theMenuItemis the menu item number of the command, starting at one. Disabled commands and dividing lines count in the numbering.
isControlKeyspecify 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
ChangeFontmethod is called.
virtual void ChangeFont(const CFont &theFont);
ChangeFontsends a font object,
theFont, that indicates the current state of the Font/Style menu.
ChangeFontis an event that chains upward from some view, as does
DoMenuCommand. You must override this method to define actions for updating fonts.
CApplicationall 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
isDeepparameter in each of the broadcast methods.
virtual void BroadcastCommand(long theCommand, void* theData=NULL, BOOLEAN isDeep = FALSE);
virtual void BroadcastMenuCommand(
BOOLEAN isDeep = FALSE);
virtual void BroadcastTimer(long theTimerId,
BOOLEAN isDeep = FALSE);
virtual void BroadcastUser(long theUserId, void* theData
BOOLEAN isDeep = FALSE);
BOOLEAN IsBroadcasting() const;
TRUEif 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_createfunction, 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
DoTimer. When the timer generates a timer event,
CSwitchBoardpasses 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.
theUserIdis the ID number that designates a particular kind of user event. The void pointer
theDatacan be used to pass any user-defined structure to
DoUser, just as you would for a
DoCommand. As with timer events,
CSwitchBoardpasses 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;
CUnitsobject. 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
virtual void SetUnits(CUnits* theCoordinateUnits);
CBossobject. 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
static CUnits* GetCreationUnits(void);
SetCreationUnitsmust 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
NULLeach object initializes its units as best fit. See the different
CBoss-derived classes for specifics.
virtual const RWOrdered* GetSubObjects(void)
const = NULL;
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 (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.
BOOLEAN IBoss(CGlobalUser *theGlobalUser);
CBossof the existence of the user-specified globals.
theGlobalUseris a pointer to an object of type
CGlobalUser, which contains global utilities for a user application.
virtual void UpdateUnits(CUnits* theUnits);
CUnitsobject indicated by
theUnits, which is the object owned by the
CBossobject. 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
CUnitsobject. Basically, the owner of a
CUnitsobject is the top-most object in the hierarchy that is using the
BOOLEAN IBoss(CGlobalClassLib *theGlobalClassLib);
CBossof the existence of the globals.
theGlobalClassLibis a pointer to an object of type
CGlobalClassLib, whichcontains global utilities for XVT-Power++.