QbWidgetController.h

00001 #ifndef QBWIDGETCONTROLLER_H
00002 #define QBWIDGETCONTROLLER_H
00003 
00004 #include "QbWidget.h"
00005 
00006 class QbWidget;
00007 
00008 class QbWidgetController : public SoSeparator {
00009   SO_NODE_HEADER(QbWidgetController);
00010   typedef SoSeparator inherited;
00011 
00012  public:
00013   static void initClass(void);
00014   QbWidgetController(void);
00015 
00016   SoSFNode camera;
00017   SoSFVec2s windowSize; // field for SbViewportRegion (values for ViewportSize etc cannot be set as field yet)
00018   void setViewportRegion(const SbViewportRegion & vpreg);
00019   const SbViewportRegion & getViewportRegion(void);
00020 
00021   virtual void handleEvent(SoHandleEventAction * action);
00022 
00023   SoSFNode widgetWithFocus;
00024 
00025   QbWidget * getWidgetWithFocus();
00026   QbWidget * getWidgetWithHover();
00027   QbWidget * getWidgetBeingClicked();
00028 
00029   /* functions for focussing - used by QbWidget
00030     do not use directly, use QbWidget::focus()/unFocus() instead
00031   */
00032   void widgetGotFocus(QbWidget *widget);
00033   void widgetLostFocus(QbWidget *widget);
00034 
00035   /* functions for unclick and unhover - used by QbWidget's destructor
00036     do not use directly, use QbWidget::focus()/unFocus() instead
00037   */
00038   void widgetCanceledClick(QbWidget *widget);
00039   void widgetLostHover(QbWidget *widget);
00040 
00041   // overwrite for QbWidget::setWidgetController
00042   virtual void addChild(SoNode * node);
00043   virtual void insertChild(SoNode *child, int newchildindex);
00044   virtual void replaceChild(int index, SoNode *newchild);
00045   virtual void replaceChild(SoNode *oldchild, SoNode *newchild);
00046 
00047   void assignTo(SoNode *subgraph);
00048 
00049   virtual void notify(SoNotList * list);
00050 
00051 private:
00052   SbViewportRegion viewport;
00053   QbWidget * widgetWithHover;
00054   QbWidget * widgetBeingClicked;
00055   SoCamera * lastCamera;
00056 };
00057 
00058 
00059 inline const SbViewportRegion & QbWidgetController::getViewportRegion() {
00060   return viewport;
00061 }
00062 
00063 inline QbWidget * QbWidgetController::getWidgetWithHover() {
00064   return widgetWithHover;
00065 }
00066 
00067 inline QbWidget * QbWidgetController::getWidgetBeingClicked() {
00068   return widgetBeingClicked;
00069 }
00070 
00071 #endif

Generated on Thu Oct 28 10:59:16 2004 for gitk by doxygen 1.3.6