umode.hpp

00001 /* ==================================================== ======== ======= *
00002  *
00003  *  umode.hpp
00004  *  Ubit Project
00005  *  Part of the Ubit Toolkit: A Brick Construction Game Model for Creating GUIs
00006  *  (C) 1999-2006 / Eric Lecolinet / ENST Paris /http://www.enst.fr/~elc/ubit
00007  *
00008  * ***********************************************************************
00009  * COPYRIGHT NOTICE : 
00010  * THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY AND WITHOUT EVEN THE 
00011  * IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 
00012  * YOU CAN REDISTRIBUTE IT AND/OR MODIFY IT UNDER THE TERMS OF THE GNU 
00013  * GENERAL PUBLIC LICENSE AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION; 
00014  * EITHER VERSION 2 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
00015  * SEE FILES 'COPYRIGHT' AND 'COPYING' FOR MORE DETAILS.
00016  * ***********************************************************************
00017  * ==================================================== [-c-Elc] ======= *
00018  * ==================================================== ======== ======= */
00019 
00020 #ifndef _umode_hpp_
00021 #define _umode_hpp_
00022 //pragma ident  "@(#)umode.hpp  ubit:05.05.00"
00023 #include <ubit/ubrick.hpp>
00024 namespace ubit {
00025 
00026 /* ==================================================== ===== ======= */
00031 class UMode: public UBrick {
00032 public:
00033     UBIT_CLASS(UMode,UBrick)
00034 
00035   static UMode 
00036     // the parents are initially selected (see UMode::CAN_SELECT)
00037     selected,
00038 
00040     canSelect,
00041 
00043     enterHighlight,
00044 
00046     autoRepeat,
00047 
00049     canArm,
00050 
00052     canDrag,
00053 
00055     canDrop,
00056 
00058     ignoreEvents;
00059 
00060   // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00061 
00062   enum BMODES {
00064     UCONST = 1<<0,
00065 
00067     CAN_DELETE = 1<<1,
00068     
00070     UPDATING = 1<<2,
00071 
00073     DESTRUCTING = 1<<3,
00074 
00077     DESTRUCTED = 1<<4,
00078 
00080     DONT_PROPAGATE = UCONST | CAN_DELETE | UPDATING | DESTRUCTED | DESTRUCTING,
00081 
00082     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00083 
00085     NO_AUTO_UPDATE = 1<<5,
00086 
00088     IN_SELECTION = 1<<6,
00089 
00091     HAS_ORIENT  = 1<<7,
00092     IS_VERTICAL = 1<<8,
00093     
00094     CANT_RESIZE_WIDTH  = 1<<9,
00095     CANT_RESIZE_HEIGHT = 1<<10,
00096 
00098     IGNORE_EVENTS = 1<<11,
00099 
00100     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00102 
00103     DESTRUCT_CB      = 1<<12,
00104     CONTAINER_CB     = 1<<13,
00105     CHANGE_CB        = 1<<14,
00106     CHILD_CHANGE_CB  = 1<<15,
00107     VIEW_PAINT_CB    = 1<<16,
00108     VIEW_CHANGE_CB   = 1<<17,
00109     SHOW_HIDE_CB     = 1<<18,
00110     MOUSE_CB         = 1<<19,
00111     MOUSE_CROSS_CB   = 1<<20,
00112     MOUSE_DRAG_CB    = 1<<21,
00113     MOUSE_MOVE_CB    = 1<<22,
00114     KEY_CB           = 1<<23,
00115     DND_CB           = 1<<24,
00116     FILTER_EVENT_CB  = 1<<26,
00117     WINDOW_EVENT_CB  = 1<<27,
00118     MSG_PROP_EVENT_CB= 1<<28,
00119     USER_EVENT_CB    = 1<<29,
00120     MISC_EVENT_CB    = 1<<30,
00121 
00122     CALLBACKS =  DESTRUCT_CB | CONTAINER_CB | CHANGE_CB | CHILD_CHANGE_CB
00123     | VIEW_PAINT_CB | VIEW_CHANGE_CB | SHOW_HIDE_CB
00124     | MOUSE_CB | MOUSE_CROSS_CB | MOUSE_DRAG_CB | MOUSE_MOVE_CB 
00125     | KEY_CB | DND_CB | FILTER_EVENT_CB | WINDOW_EVENT_CB 
00126     | MSG_PROP_EVENT_CB | USER_EVENT_CB | MISC_EVENT_CB
00129   };
00130 
00131   // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00132 
00133   enum CMODES {
00134     GROUP         = 1<<0,   
00135     BOX           = 1<<1,   
00136     SOFTWIN       = 1<<2,   
00137     HARDWIN       = 1<<3,   
00138     CHILDWIN      = 1<<4,   
00139     MENUWIN       = 1<<5,   
00140     
00141     HAS_POS       = 1<<6,   
00142     PSEUDO_PARENT = 1<<7,   
00143     BORDER_LIST   = 1<<8,   
00144     SOFTWIN_LIST  = 1<<9,   
00145 
00147     CAN_SHOW = 1<<10,
00148 
00150     MODAL = 1<<12,
00151 
00152     //ENABLED (ISTATE::DISABLED used instead)
00153 
00155     SELECTED = 1<<13,
00156 
00158     CAN_SELECT = 1<<14, 
00159 
00161     CAN_SELECT_TEXT = 1<<15,
00163     CAN_EDIT_TEXT = 1<<16,
00164 
00166     CAN_BROWSE_CHILDREN = 1<<17, 
00167     
00169     CAN_DRAG = 1<<18,
00170     CAN_DROP = 1<<19,
00171 
00174     CAN_ARM = 1<<20,
00175 
00177     AUTO_REPEAT = 1<<21,
00178 
00180     ENTER_HIGHLIGHT = 1<<23,
00181 
00183     HAS_TIP = 1<<24,
00184 
00186     HAS_CURSOR = 1<<25,
00187 
00189     HAS_LAYOUT = 1<<26,
00190 
00193     HAS_CLOSE_MENU_MODE  = 1<<27,
00194     CLOSE_MENU_MODE = 1<<28,
00195 
00196     //--- Win and menu attributes
00197 
00199     WIN_MAPPED = 1<<29,
00200 
00202     WIN_AUTO_OPEN_MODE = 1<<30
00203 
00204     // !no comma after last item!
00205     // !BEWARE total size must be coherent with typedef UMask in udefs.hh !!
00206   };
00207 
00208   // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00209   // interaction state
00210   
00211   enum ISTATE {
00212     ANY = -1,
00213     IDLE = 0,                   // must be 0 (index in style arrays)
00214     DISABLED, ENTERED, ARMED, ACTIONED, DRAGGED, DROP_ENTERED,
00215     ACTION_COUNT
00216   };
00217   
00218   // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00219 
00220   UMode(UMask bmodes, UMask cmodes, bool on_off);
00221   UMode(UMask bmodes = 0);
00222   virtual ~UMode() {destructs();}
00223 
00224   virtual void setParentModes(UControl *parent) const;
00225   virtual void addingTo(UChild*, UGroup *parent);
00226   virtual void removingFrom(UChild*, UGroup *parent);
00228 
00229 protected:
00230     friend class UControl;
00231   // NB: bmodes is inherited from UBrick
00232   UMask cmodes, bmask, cmask;
00233 };
00234 
00235 }
00236 #endif
00237 /* ==================================================== [TheEnd] ======= */
00238 /* ==================================================== [(c)Elc] ======= */
00239 

Generated on Mon Jan 29 00:20:39 2007 for Ubit by  doxygen 1.4.7