Sourceforge.net - The VCF's Project Host
   The VCF Website Home   |   Online Discussion Forums   |   Sourceforge.net Project Page   

VCF::UIToolkit Class Reference

The UIToolkit is used to create instances of various peer's needed by the VCF, as well as providing certain low level services, such as modal and non-modal event loops, and getting at UI metrics. More...

#include <vcf/ApplicationKit/UIToolkit.h>

Inheritance diagram for VCF::UIToolkit:

VCF::ObjectWithCallbacks VCF::Object VCF::OSXUIToolkit VCF::Win32ToolKit VCF::XCBUIToolkit List of all members.

Public Types

enum  ModalReturnType {
  mrNone = 0, mrOK, mrCancel, mrYes,
  mrNo, mrRetry, mrIgnore, mrHelp,
  mrAbort, mrTrue, mrFalse
}
 These enum values specify the various return values that a modal loop can return. More...
enum  { defaultUpdateSpeed = 200 }

Public Member Functions

 UIToolkit ()
virtual ~UIToolkit ()
void init ()

Static Public Member Functions

static void initToolKit ()
 Initializes the toolkit.
static void closeToolkit ()
 cleans up the toolkit instance and deletes it
static ControlPeercreateControlPeer (Control *component, ComponentType componentType=CT_DEFAULT)
 creates a new instance of a ControlPeer the component passed in represents the component the implmenter will get attached to.
static ContextPeercreateContextPeer (Control *component)
 creates a context peer for a control
static ContextPeercreateContextPeer (OSHandleID contextID)
 creates a context peer given a windowing specific context id.
static ContextPeercreateContextPeer (const uint32 &width, const uint32 &height)
 creates a memory based context peer given a width and height.
static ListviewPeercreateListViewPeer (ListViewControl *component)
 This creates a peer that implements the ListviewPeer interface.
static TreePeercreateTreePeer (TreeControl *component)
 This creates a peer that implements the TreePeer interface.
static TextPeercreateTextPeer (const bool &autoWordWrap, const bool &multiLined)
 This creates a peer that implements the TextPeer interface.
static TextEditPeercreateTextEditPeer (TextControl *component, const bool &isMultiLineControl)
static ButtonPeercreateButtonPeer (CommandButton *component)
 This creates a peer that implements the ButtonPeer interface.
static DialogPeercreateDialogPeer (Control *owner, Dialog *component)
static DialogPeercreateDialogPeer ()
static WindowPeercreateWindowPeer (Control *component, Control *owner)
static PopupWindowPeercreatePopupWindowPeer (Frame *frame, Window *owner)
static TransparentWindowPeercreateTransparentWindowPeer (Frame *frame)
static DropDownPeercreateDropDownPeer (Control *control)
static ToolbarPeercreateToolbarPeer (Toolbar *toolbar)
static MenuItemPeercreateMenuItemPeer (MenuItem *item)
static MenuBarPeercreateMenuBarPeer (MenuBar *menuBar)
static PopupMenuPeercreatePopupMenuPeer (PopupMenu *popupMenu)
static ClipboardPeercreateClipboardPeer ()
static DragDropPeercreateDragDropPeer ()
static DataObjectPeercreateDataObjectPeer ()
static DropTargetPeercreateDropTargetPeer ()
static ApplicationPeercreateApplicationPeer ()
static ClipboardgetSystemClipboard ()
static CommonFileDialogPeercreateCommonFileOpenDialogPeer (Control *owner)
static CommonFolderBrowseDialogPeercreateCommonFolderBrowseDialogPeer (Control *owner)
static CommonFileDialogPeercreateCommonFileSaveDialogPeer (Control *owner)
static CommonColorDialogPeercreateCommonColorDialogPeer (Control *owner)
static CommonFontDialogPeercreateCommonFontDialogPeer (Control *owner)
static CommonPrintDialogPeercreateCommonPrintDialogPeer (Control *owner)
static UIShellPeercreateUIShellPeer (UIShell *shell)
static ScrollPeercreateScrollPeer (Control *control)
static CursorPeercreateCursorPeer (Cursor *cursor)
static SystemTrayPeercreateSystemTrayPeer ()
static MenuManagerPeercreateMenuManagerPeer ()
static GraphicsResourceBundlePeercreateGraphicsResourceBundlePeer (AbstractApplication *app)
static bool createCaret (Control *owningControl, Image *caretImage)
static bool destroyCaret (Control *owningControl)
static void setCaretVisible (const bool &caretVisible)
static void setCaretPos (Point *point)
static void postEvent (EventHandler *eventHandler, Event *event, const bool &deleteHandler=true)
 This method posts an event to the underlying platform's windowing system.
static void registerTimerHandler (Object *source, EventHandler *handler, const uint32 &timeoutInMilliSeconds)
static void unregisterTimerHandler (EventHandler *handler)
static void runEventLoop ()
static ModalReturnType runModalEventLoopFor (Control *control)
static void quitCurrentEventLoop ()
 this will attempt to send a message/event to the underlying windowing system's event loop (started due to a call to runEventLoop() or runModalEventLoopFor(.
static void quitModalEventLoop ()
static EventcreateEventFromNativeOSEventData (void *eventData)
 This method creates a new event from native windowing OS event data.
static Size getDragDropDelta ()
 Override this - this should return whatever the appropriate x/y deltas are for starting a drag drop operation are for the specific windowing system.
static const ImagegetStandardStopImage ()
static const ImagegetStandardWarningImage ()
static const ImagegetStandardQuestionImage ()
static const ImagegetStandardInformationImage ()
static void registerComponentInfo (const String &componentUUID, ComponentInfo *info)
static void removeComponentInfo (ComponentInfo *info)
static void registerAccelerator (AcceleratorKey *accelerator)
static void removeAccelerator (const VirtualKeyCode &keyCode, const uint32 &modifierMask, Object *src)
static ButtongetDefaultButton ()
static void setDefaultButton (Button *defaultButton)
static void removeDefaultButton (Button *defaultButton)
static AcceleratorKeygetAccelerator (const VirtualKeyCode &keyCode, const uint32 &modifierMask, Object *src)
static bool findMatchingAccelerators (AcceleratorKey *key, std::vector< AcceleratorKey * > &matchingAccelerators)
 Finds all the matching accelerators and store them in a list.
static void getAcceleratorKeysForControl (Control *control, std::vector< AcceleratorKey * > &matchingAccelerators)
static void getAcceleratorKeysForMenuItem (MenuItem *item, std::vector< AcceleratorKey * > &matchingAccelerators)
static void getAcceleratorKeysForObject (Object *src, std::vector< AcceleratorKey * > &matchingAccelerators)
static void removeAcceleratorKeysForControl (Control *control)
static void removeAcceleratorKeysForMenuItem (MenuItem *item)
static void removeAcceleratorKeysForObject (Object *src)
static void handleKeyboardEvent (KeyboardEvent *event)
static VirtualKeyCode findMnemonic (const String &caption)
static ComponentInfogetComponentInfo (const String &componentUUID)
static ComponentInfogetComponentInfo (Class *componentClass)
static UIMetricsManagergetUIMetricsManager ()
static double getUIMetricValue (const UIMetricsManager::MetricType &type, const String &text="", Font *alternateFont=NULL)
static Size getUIMetricSize (const UIMetricsManager::MetricType &type, const String &text="", Font *alternateFont=NULL)
static Rect getUIMetricRect (const UIMetricsManager::MetricType &type, Rect *rect=NULL, Font *alternateFont=NULL)
static UIPolicyManagergetUIPolicyManager ()
static void displayHelpContents ()
 This attempts to to display the help contents for the application.
static void displayHelpIndex ()
 This attempts to to display the help index for the application.
static void displayHelpSection (const String &helpSection, const String &helpBookName="", const String &helpDirectory="")
 This attempts to to display a specific help section for a given help book and help directory.
static void displayContextHelpForControl (Control *control)
 This attempts to display the context sensitive help for a control.
static UIToolkitinternal_getDefaultUIToolkit ()
 public so platform implementers can get at it easily
static void addToUpdateList (Component *component)
static void removeFromUpdateList (Component *component)
static void setUpdateTimerSpeed (const uint32 &milliseconds)
static void systemSettingsChanged ()

Protected Member Functions

void onAcceleratorMnemonic (KeyboardEvent *event)
void onDefaultButton (KeyboardEvent *event)
virtual ControlPeerinternal_createControlPeer (Control *component, ComponentType componentType=CT_DEFAULT)=0
 creates a new instance of a ControlPeer the component passed in represents the component the implmenter will get attached to.
virtual ContextPeerinternal_createContextPeer (Control *component)
virtual ContextPeerinternal_createContextPeer (OSHandleID contextID)
virtual ContextPeerinternal_createContextPeer (const uint32 &width, const uint32 &height)
virtual ListviewPeerinternal_createListViewPeer (ListViewControl *component)=0
virtual TreePeerinternal_createTreePeer (TreeControl *component)=0
virtual TextPeerinternal_createTextPeer (const bool &autoWordWrap, const bool &multiLined)=0
virtual TextEditPeerinternal_createTextEditPeer (TextControl *component, const bool &isMultiLineControl)=0
virtual ButtonPeerinternal_createButtonPeer (CommandButton *component)=0
virtual DialogPeerinternal_createDialogPeer (Control *owner, Dialog *component)=0
virtual DialogPeerinternal_createDialogPeer ()=0
virtual WindowPeerinternal_createWindowPeer (Control *component, Control *owner)=0
virtual PopupWindowPeerinternal_createPopupWindowPeer (Frame *frame, Window *owner)=0
virtual TransparentWindowPeerinternal_createTransparentWindowPeer (Frame *frame)=0
virtual DropDownPeerinternal_createDropDownPeer (Control *control)=0
virtual ToolbarPeerinternal_createToolbarPeer (Toolbar *toolbar)=0
virtual MenuItemPeerinternal_createMenuItemPeer (MenuItem *item)=0
virtual MenuBarPeerinternal_createMenuBarPeer (MenuBar *menuBar)=0
virtual PopupMenuPeerinternal_createPopupMenuPeer (PopupMenu *popupMenu)=0
virtual ClipboardPeerinternal_createClipboardPeer ()=0
virtual DragDropPeerinternal_createDragDropPeer ()=0
virtual DataObjectPeerinternal_createDataObjectPeer ()=0
virtual DropTargetPeerinternal_createDropTargetPeer ()=0
virtual ApplicationPeerinternal_createApplicationPeer ()=0
virtual Clipboardinternal_getSystemClipboard ()
virtual CommonFileDialogPeerinternal_createCommonFileOpenDialogPeer (Control *owner)=0
virtual CommonFolderBrowseDialogPeerinternal_createCommonFolderBrowseDialogPeer (Control *owner)=0
virtual CommonFileDialogPeerinternal_createCommonFileSaveDialogPeer (Control *owner)=0
virtual CommonColorDialogPeerinternal_createCommonColorDialogPeer (Control *owner)=0
virtual CommonFontDialogPeerinternal_createCommonFontDialogPeer (Control *owner)=0
virtual CommonPrintDialogPeerinternal_createCommonPrintDialogPeer (Control *owner)=0
virtual UIShellPeerinternal_createUIShellPeer (UIShell *shell)=0
virtual ScrollPeerinternal_createScrollPeer (Control *control)=0
virtual CursorPeerinternal_createCursorPeer (Cursor *cursor)=0
virtual SystemTrayPeerinternal_createSystemTrayPeer ()=0
virtual MenuManagerPeerinternal_createMenuManagerPeer ()=0
virtual GraphicsResourceBundlePeerinternal_createGraphicsResourceBundlePeer (AbstractApplication *app)=0
virtual bool internal_createCaret (Control *owningControl, Image *caretImage)=0
virtual bool internal_destroyCaret (Control *owningControl)=0
virtual void internal_setCaretVisible (const bool &caretVisible)=0
virtual void internal_setCaretPos (Point *point)=0
virtual void internal_postEvent (EventHandler *eventHandler, Event *event, const bool &deleteHandler=true)=0
virtual void internal_registerTimerHandler (Object *source, EventHandler *handler, const uint32 &timeoutInMilliSeconds)=0
virtual void internal_unregisterTimerHandler (EventHandler *handler)=0
virtual void internal_runEventLoop ()=0
virtual ModalReturnType internal_runModalEventLoopFor (Control *control)=0
virtual void internal_quitCurrentEventLoop ()=0
 this will attempt to send a message/event to the underlying windowing system's event loop (started due to a call to runEventLoop() or runModalEventLoopFor(.
virtual Eventinternal_createEventFromNativeOSEventData (void *eventData)=0
 This method creates a new event from native windowing OS event data.
virtual Size internal_getDragDropDelta ()=0
 Override this - this should return whatever the appropriate x/y deltas are for starting a drag drop operation are for the specific windowing system.
virtual void internal_displayHelpContents (const String &helpBookName, const String &helpDirectory)=0
virtual void internal_displayHelpIndex (const String &helpBookName, const String &helpDirectory)=0
virtual void internal_displayHelpSection (const String &helpBookName, const String &helpDirectory, const String &helpSection)=0
virtual bool internal_displayContextHelpForControl (Control *control, const String &helpBookName, const String &helpDirectory)=0
 This should display the appropriate context sensitive infor for the control, and return true, or it should return false, indicating that the control didn't have any context help to display.
virtual void internal_systemSettingsChanged ()=0
virtual void internal_handleKeyboardEvent (KeyboardEvent *event)
virtual VirtualKeyCode internal_findMnemonic (const String &caption)
const Imageinternal_getStandardStopImage ()
const Imageinternal_getStandardWarningImage ()
const Imageinternal_getStandardQuestionImage ()
const Imageinternal_getStandardInformationImage ()
void internal_registerComponentInfo (const String &componentUUID, ComponentInfo *info)
void internal_removeComponentInfo (ComponentInfo *info)
void internal_registerAccelerator (AcceleratorKey *accelerator)
void internal_removeAccelerator (const VirtualKeyCode &keyCode, const uint32 &modifierMask, Object *src)
Buttoninternal_getDefaultButton ()
void internal_setDefaultButton (Button *defaultButton)
void internal_removeDefaultButton (Button *defaultButton)
AcceleratorKeyinternal_getAccelerator (const VirtualKeyCode &keyCode, const uint32 &modifierMask, Object *src)
void internal_removeAcceleratorKeysForControl (Control *control)
void internal_removeAcceleratorKeysForMenuItem (MenuItem *menuItem)
void internal_removeAcceleratorKeysForObject (Object *src)
bool internal_findMatchingAccelerators (AcceleratorKey *key, std::vector< AcceleratorKey * > &matchingAccelerators)
void internal_getAcceleratorKeysForControl (Control *control, std::vector< AcceleratorKey * > &matchingAccelerators)
void internal_getAcceleratorKeysForMenuItem (MenuItem *item, std::vector< AcceleratorKey * > &matchingAccelerators)
void internal_getAcceleratorKeysForObject (Object *src, std::vector< AcceleratorKey * > &matchingAccelerators)
virtual void internal_idleTime ()
ComponentInfointernal_getComponentInfo (const String &componentUUID)
ComponentInfointernal_getComponentInfo (Class *componentClass)
UIMetricsManagerinternal_getUIMetricsManager ()
UIPolicyManagerinternal_getUIPolicyManager ()
void internal_addToUpdateList (Component *component)
void internal_removeFromUpdateList (Component *component)
void internal_setUpdateTimerSpeed (const uint32 &milliseconds)
void onUpdateComponentsTimer (TimerEvent *e)
void handleTabKeyboardEvent (KeyboardEvent *event)

Static Protected Member Functions

static String getControlConstants (const String &name)

Protected Attributes

std::map< String, ComponentInfo * > componentInfoMap_
std::multimap< uint32, AcceleratorKey * > acceleratorMap_
std::vector< Control * > visitedContainers_
ClipboardsystemClipboard_
GraphicsToolkitgraphicsToolKit_
ImagestopImage_
ImagewarningImage_
ImageinformationImage_
ImagequestionImage_
KeyboardHandleracceleratorMnemonicHandler_
KeyboardHandlerdefaultButtonHandler_
UIMetricsManagermetricsMgr_
UIPolicyManagerpolicyMgr_
std::vector< Button * > defaultButtonList_
std::vector< Component * > componentsToUpdate_
bool quitModalLoop_

Static Protected Attributes

static UIToolkittoolKitInstance

Detailed Description

The UIToolkit is used to create instances of various peer's needed by the VCF, as well as providing certain low level services, such as modal and non-modal event loops, and getting at UI metrics.

Each system the VCF is ported to has a concrete implementation of the UIToolkit. The UIToolkit is a singleton, and there should only be one instance for a given process running the VCF libraries.

To work with the toolkit you just call it's static functions. These in turn forward the call to the toolkit instance.

The UIToolkit is a singleton, meaning there is only ever one single instance of it. Developers porting the VCF to another platform will have to create a derived class from UIToolkit and implement the various virtual functions.


Member Enumeration Documentation

anonymous enum
 

Enumerator:
defaultUpdateSpeed 

enum VCF::UIToolkit::ModalReturnType
 

These enum values specify the various return values that a modal loop can return.

The most typical values are mrTrue or mrFalse. If used in conjuction with displaying a modal dialog then some of the other values may come into play ot indicate a common button that was clicked, such as OK, Cancel, Yes, No, etc.

Enumerator:
mrNone 
mrOK 
mrCancel 
mrYes 
mrNo 
mrRetry 
mrIgnore 
mrHelp 
mrAbort 
mrTrue 
mrFalse 


Constructor & Destructor Documentation

VCF::UIToolkit::UIToolkit  ) 
 

virtual VCF::UIToolkit::~UIToolkit  )  [virtual]
 


Member Function Documentation

static void VCF::UIToolkit::addToUpdateList Component component  )  [static]
 

static void VCF::UIToolkit::closeToolkit  )  [static]
 

cleans up the toolkit instance and deletes it

static ApplicationPeer* VCF::UIToolkit::createApplicationPeer  )  [static]
 

static ButtonPeer* VCF::UIToolkit::createButtonPeer CommandButton component  )  [static]
 

This creates a peer that implements the ButtonPeer interface.

This ensures that you have a button control that correctly implements ALL the look and feel requirements for the windowing system. Some windowing systems have a more complex button control than others, making it more complicated to try and emulate, as opposed to just providing a peer that creates a native button control. For Win32 systems this is equivalent to creating a window handle with the BUTTON window class name.

static bool VCF::UIToolkit::createCaret Control owningControl,
Image caretImage
[static]
 

static ClipboardPeer* VCF::UIToolkit::createClipboardPeer  )  [static]
 

static CommonColorDialogPeer* VCF::UIToolkit::createCommonColorDialogPeer Control owner  )  [static]
 

static CommonFileDialogPeer* VCF::UIToolkit::createCommonFileOpenDialogPeer Control owner  )  [static]
 

static CommonFileDialogPeer* VCF::UIToolkit::createCommonFileSaveDialogPeer Control owner  )  [static]
 

static CommonFolderBrowseDialogPeer* VCF::UIToolkit::createCommonFolderBrowseDialogPeer Control owner  )  [static]
 

static CommonFontDialogPeer* VCF::UIToolkit::createCommonFontDialogPeer Control owner  )  [static]
 

static CommonPrintDialogPeer* VCF::UIToolkit::createCommonPrintDialogPeer Control owner  )  [static]
 

static ContextPeer* VCF::UIToolkit::createContextPeer const uint32 width,
const uint32 height
[static]
 

creates a memory based context peer given a width and height.

This simply calls the GraphicsToolkit's createContextPeer().

See also:
GraphicsToolkit::createContextPeer

static ContextPeer* VCF::UIToolkit::createContextPeer OSHandleID  contextID  )  [static]
 

creates a context peer given a windowing specific context id.

This simply calls the GraphicsToolkit's createContextPeer().

See also:
GraphicsToolkit::createContextPeer

static ContextPeer* VCF::UIToolkit::createContextPeer Control component  )  [static]
 

creates a context peer for a control

static ControlPeer* VCF::UIToolkit::createControlPeer Control component,
ComponentType  componentType = CT_DEFAULT
[static]
 

creates a new instance of a ControlPeer the component passed in represents the component the implmenter will get attached to.

static CursorPeer* VCF::UIToolkit::createCursorPeer Cursor cursor  )  [static]
 

static DataObjectPeer* VCF::UIToolkit::createDataObjectPeer  )  [static]
 

static DialogPeer* VCF::UIToolkit::createDialogPeer  )  [static]
 

static DialogPeer* VCF::UIToolkit::createDialogPeer Control owner,
Dialog component
[static]
 

static DragDropPeer* VCF::UIToolkit::createDragDropPeer  )  [static]
 

static DropDownPeer* VCF::UIToolkit::createDropDownPeer Control control  )  [static]
 

static DropTargetPeer* VCF::UIToolkit::createDropTargetPeer  )  [static]
 

static Event* VCF::UIToolkit::createEventFromNativeOSEventData void *  eventData  )  [static]
 

This method creates a new event from native windowing OS event data.

Each UIToolkit implementation must implement this method and since we can't possibly know the event data at this point, we just specify a void*. The concrete implementation will have to typecast this to the specific datatype or structure.

static GraphicsResourceBundlePeer* VCF::UIToolkit::createGraphicsResourceBundlePeer AbstractApplication app  )  [static]
 

static ListviewPeer* VCF::UIToolkit::createListViewPeer ListViewControl component  )  [static]
 

This creates a peer that implements the ListviewPeer interface.

A ListviewPeer allows you to view a list of data in multiple ways. For Win32 systems this is equivalent to creating a window handle with the WC_LISTVIEW window class name.

static MenuBarPeer* VCF::UIToolkit::createMenuBarPeer MenuBar menuBar  )  [static]
 

static MenuItemPeer* VCF::UIToolkit::createMenuItemPeer MenuItem item  )  [static]
 

static MenuManagerPeer* VCF::UIToolkit::createMenuManagerPeer  )  [static]
 

static PopupMenuPeer* VCF::UIToolkit::createPopupMenuPeer PopupMenu popupMenu  )  [static]
 

static PopupWindowPeer* VCF::UIToolkit::createPopupWindowPeer Frame frame,
Window owner
[static]
 

static ScrollPeer* VCF::UIToolkit::createScrollPeer Control control  )  [static]
 

static SystemTrayPeer* VCF::UIToolkit::createSystemTrayPeer  )  [static]