Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/GuiTypes.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /* @(#)root/base:$Id$ */
0002 
0003 /*************************************************************************
0004  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
0005  * All rights reserved.                                                  *
0006  *                                                                       *
0007  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0008  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0009  *************************************************************************/
0010 
0011 #ifndef ROOT_GuiTypes
0012 #define ROOT_GuiTypes
0013 
0014 //////////////////////////////////////////////////////////////////////////
0015 //                                                                      //
0016 // GuiTypes                                                             //
0017 //                                                                      //
0018 // Types used by the GUI classes.                                       //
0019 //                                                                      //
0020 //////////////////////////////////////////////////////////////////////////
0021 
0022 #include "Rtypes.h"
0023 #include <climits>
0024 
0025 // Basic GUI types
0026 typedef ULongptr_t         Handle_t;     ///< Generic resource handle
0027 typedef Handle_t           Display_t;    ///< Display handle
0028 typedef Handle_t           Visual_t;     ///< Visual handle
0029 typedef Handle_t           Window_t;     ///< Window handle
0030 typedef Handle_t           WinContext_t; ///< Window drawing context
0031 typedef Handle_t           Pixmap_t;     ///< Pixmap handle
0032 typedef Handle_t           Drawable_t;   ///< Drawable handle
0033 typedef Handle_t           Region_t;     ///< Region handle
0034 typedef Handle_t           Colormap_t;   ///< Colormap handle
0035 typedef Handle_t           Cursor_t;     ///< Cursor handle
0036 typedef Handle_t           FontH_t;      ///< Font handle (as opposed to Font_t which is an index)
0037 typedef Handle_t           KeySym_t;     ///< Key symbol handle
0038 typedef Handle_t           Atom_t;       ///< WM token
0039 typedef Handle_t           GContext_t;   ///< Graphics context handle
0040 typedef Handle_t           FontStruct_t; ///< Pointer to font structure
0041 typedef ULong_t            Pixel_t;      ///< Pixel value
0042 typedef UInt_t             Mask_t;       ///< Structure mask type
0043 typedef ULong_t            Time_t;       ///< Event time
0044 
0045 enum EGuiConstants {
0046    kNotUseful = 0, kWhenMapped = 1, kAlways = 2,
0047    kIsUnmapped = 0, kIsUnviewable = 1, kIsViewable = 2,
0048    kInputOutput = 1, kInputOnly = 2,
0049    kLineSolid = 0, kLineOnOffDash = 1, kLineDoubleDash = 2,
0050    kCapNotLast = 0, kCapButt = 1, kCapRound = 2, kCapProjecting = 3,
0051    kJoinMiter = 0, kJoinRound = 1, kJoinBevel = 2,
0052    kFillSolid = 0, kFillTiled = 1, kFillStippled = 2, kFillOpaqueStippled = 3,
0053    kEvenOddRule = 0, kWindingRule = 1,
0054    kClipByChildren = 0, kIncludeInferiors = 1,
0055    kArcChord = 0, kArcPieSlice = 1
0056 };
0057 
0058 // GUI event types. Later merge with EEventType in Button.h and rename to
0059 // EEventTypes. Also rename in that case kGKeyPress to kKeyPress.
0060 enum EGEventType {
0061    kGKeyPress, kKeyRelease, kButtonPress, kButtonRelease,
0062    kMotionNotify, kEnterNotify, kLeaveNotify, kFocusIn, kFocusOut,
0063    kExpose, kConfigureNotify, kMapNotify, kUnmapNotify, kDestroyNotify,
0064    kClientMessage, kSelectionClear, kSelectionRequest, kSelectionNotify,
0065    kColormapNotify, kButtonDoubleClick, kOtherEvent
0066 };
0067 
0068 enum EGraphicsFunction {
0069    kGXclear = 0,               ///< 0
0070    kGXand,                     ///< src AND dst
0071    kGXandReverse,              ///< src AND NOT dst
0072    kGXcopy,                    ///< src
0073    kGXandInverted,             ///< NOT src AND dst
0074    kGXnoop,                    ///< dst
0075    kGXxor,                     ///< src XOR dst
0076    kGXor,                      ///< src OR dst
0077    kGXnor,                     ///< NOT src AND NOT dst
0078    kGXequiv,                   ///< NOT src XOR dst
0079    kGXinvert,                  ///< NOT dst
0080    kGXorReverse,               ///< src OR NOT dst
0081    kGXcopyInverted,            ///< NOT src
0082    kGXorInverted,              ///< NOT src OR dst
0083    kGXnand,                    ///< NOT src OR NOT dst
0084    kGXset                      ///< 1
0085 };
0086 
0087 enum { kDefaultScrollBarWidth = 16 };
0088 
0089 const Handle_t kNone = 0;
0090 const Handle_t kCopyFromParent = 0;
0091 const Handle_t kParentRelative = 1;
0092 
0093 /// Attributes that can be used when creating or changing a window
0094 struct SetWindowAttributes_t {
0095    Pixmap_t   fBackgroundPixmap;     ///< background or kNone or kParentRelative
0096    ULong_t    fBackgroundPixel;      ///< background pixel
0097    Pixmap_t   fBorderPixmap;         ///< border of the window
0098    ULong_t    fBorderPixel;          ///< border pixel value
0099    UInt_t     fBorderWidth;          ///< border width in pixels
0100    Int_t      fBitGravity;           ///< one of bit gravity values
0101    Int_t      fWinGravity;           ///< one of the window gravity values
0102    Int_t      fBackingStore;         ///< kNotUseful, kWhenMapped, kAlways
0103    ULong_t    fBackingPlanes;        ///< planes to be preserved if possible
0104    ULong_t    fBackingPixel;         ///< value to use in restoring planes
0105    Bool_t     fSaveUnder;            ///< should bits under be saved (popups)?
0106    Long_t     fEventMask;            ///< set of events that should be saved
0107    Long_t     fDoNotPropagateMask;   ///< set of events that should not propagate
0108    Bool_t     fOverrideRedirect;     ///< boolean value for override-redirect
0109    Colormap_t fColormap;             ///< color map to be associated with window
0110    Cursor_t   fCursor;               ///< cursor to be displayed (or kNone)
0111    Mask_t     fMask;                 ///< bit mask specifying which fields are valid
0112 };
0113 
0114 /// Window attributes that can be inquired
0115 struct WindowAttributes_t {
0116    Int_t      fX, fY;                 ///< location of window
0117    Int_t      fWidth, fHeight;        ///< width and height of window
0118    Int_t      fBorderWidth;           ///< border width of window
0119    Int_t      fDepth;                 ///< depth of window
0120    void      *fVisual;                ///< the associated visual structure
0121    Window_t   fRoot;                  ///< root of screen containing window
0122    Int_t      fClass;                 ///< kInputOutput, kInputOnly
0123    Int_t      fBitGravity;            ///< one of bit gravity values
0124    Int_t      fWinGravity;            ///< one of the window gravity values
0125    Int_t      fBackingStore;          ///< kNotUseful, kWhenMapped, kAlways
0126    ULong_t    fBackingPlanes;         ///< planes to be preserved if possible
0127    ULong_t    fBackingPixel;          ///< value to be used when restoring planes
0128    Bool_t     fSaveUnder;             ///< boolean, should bits under be saved?
0129    Colormap_t fColormap;              ///< color map to be associated with window
0130    Bool_t     fMapInstalled;          ///< boolean, is color map currently installed
0131    Int_t      fMapState;              ///< kIsUnmapped, kIsUnviewable, kIsViewable
0132    Long_t     fAllEventMasks;         ///< set of events all people have interest in
0133    Long_t     fYourEventMask;         ///< my event mask
0134    Long_t     fDoNotPropagateMask;    ///< set of events that should not propagate
0135    Bool_t     fOverrideRedirect;      ///< boolean value for override-redirect
0136    void      *fScreen;                ///< back pointer to correct screen
0137 };
0138 
0139 // Bits telling which SetWindowAttributes_t fields are valid
0140 const Mask_t kWABackPixmap       = BIT(0);
0141 const Mask_t kWABackPixel        = BIT(1);
0142 const Mask_t kWABorderPixmap     = BIT(2);
0143 const Mask_t kWABorderPixel      = BIT(3);
0144 const Mask_t kWABorderWidth      = BIT(4);
0145 const Mask_t kWABitGravity       = BIT(5);
0146 const Mask_t kWAWinGravity       = BIT(6);
0147 const Mask_t kWABackingStore     = BIT(7);
0148 const Mask_t kWABackingPlanes    = BIT(8);
0149 const Mask_t kWABackingPixel     = BIT(9);
0150 const Mask_t kWAOverrideRedirect = BIT(10);
0151 const Mask_t kWASaveUnder        = BIT(11);
0152 const Mask_t kWAEventMask        = BIT(12);
0153 const Mask_t kWADontPropagate    = BIT(13);
0154 const Mask_t kWAColormap         = BIT(14);
0155 const Mask_t kWACursor           = BIT(15);
0156 
0157 // Input event masks, used to set SetWindowAttributes_t::fEventMask
0158 // and to be passed to TVirtualX::SelectInput()
0159 const Mask_t kNoEventMask         = 0;
0160 const Mask_t kKeyPressMask        = BIT(0);
0161 const Mask_t kKeyReleaseMask      = BIT(1);
0162 const Mask_t kButtonPressMask     = BIT(2);
0163 const Mask_t kButtonReleaseMask   = BIT(3);
0164 const Mask_t kPointerMotionMask   = BIT(4);
0165 const Mask_t kButtonMotionMask    = BIT(5);
0166 const Mask_t kExposureMask        = BIT(6);
0167 const Mask_t kStructureNotifyMask = BIT(7);
0168 const Mask_t kEnterWindowMask     = BIT(8);
0169 const Mask_t kLeaveWindowMask     = BIT(9);
0170 const Mask_t kFocusChangeMask     = BIT(10);
0171 const Mask_t kOwnerGrabButtonMask = BIT(11);
0172 const Mask_t kColormapChangeMask  = BIT(12);
0173 
0174 /// Event structure
0175 struct Event_t {
0176    EGEventType fType;              ///< of event (see EGEventType)
0177    Window_t    fWindow;            ///< window reported event is relative to
0178    Time_t      fTime;              ///< time event event occurred in ms
0179    Int_t       fX, fY;             ///< pointer x, y coordinates in event window
0180    Int_t       fXRoot, fYRoot;     ///< coordinates relative to root
0181    UInt_t      fCode;              ///< key or button code
0182    UInt_t      fState;             ///< key or button mask
0183    UInt_t      fWidth, fHeight;    ///< width and height of exposed area
0184    Int_t       fCount;             ///< if non-zero, at least this many more exposes
0185    Bool_t      fSendEvent;         ///< true if event came from SendEvent
0186    Handle_t    fHandle;            ///< general resource handle (used for atoms or windows)
0187    Int_t       fFormat;            ///< Next fields only used by kClientMessageEvent
0188    Longptr_t   fUser[5];           ///< 5 longs can be used by client message events
0189                                    ///< NOTE: only [0], [1] and [2] may be used.
0190                                    ///< [1] and [2] may contain >32 bit quantities
0191                                    ///< (i.e. pointers on 64 bit machines)
0192 };
0193 
0194 // Key masks, used as modifiers to GrabButton and GrabKey and
0195 // in Event_t::fState in various key-, mouse-, and button-related events
0196 const Mask_t kKeyShiftMask   = BIT(0);
0197 const Mask_t kKeyLockMask    = BIT(1);
0198 const Mask_t kKeyControlMask = BIT(2);
0199 const Mask_t kKeyMod1Mask    = BIT(3);   ///< typically the Alt key
0200 const Mask_t kKeyMod2Mask    = BIT(4);   ///< typically mod on numeric keys
0201 const Mask_t kKeyMod3Mask    = BIT(5);
0202 const Mask_t kKeyMod4Mask    = BIT(6);
0203 const Mask_t kKeyMod5Mask    = BIT(7);
0204 const Mask_t kButton1Mask    = BIT(8);
0205 const Mask_t kButton2Mask    = BIT(9);
0206 const Mask_t kButton3Mask    = BIT(10);
0207 const Mask_t kButton4Mask    = BIT(11);
0208 const Mask_t kButton5Mask    = BIT(12);
0209 const Mask_t kButton6Mask    = BIT(13);
0210 const Mask_t kButton7Mask    = BIT(14);
0211 const Mask_t kAnyModifier    = BIT(15);
0212 
0213 /// Button names. Used as arguments to GrabButton and as Event_t::fCode
0214 /// for button events. Maps to the X11 values.
0215 enum EMouseButton { kAnyButton, kButton1, kButton2, kButton3,
0216                     kButton4, kButton5, kButton6, kButton7 };
0217 
0218 /// Some magic X notify modes used in TGTextEntry widget.
0219 /// Values must match the ones in /usr/include/X11/X.h. Check when porting.
0220 enum EXMagic { kNotifyNormal = 0, kNotifyGrab = 1, kNotifyUngrab = 2,
0221                kNotifyPointer = 5, kColormapUninstalled = 0,
0222                kColormapInstalled = 1 };
0223 
0224 /// Graphics context structure
0225 struct GCValues_t {
0226    EGraphicsFunction fFunction;  ///< logical operation
0227    ULong_t  fPlaneMask;          ///< plane mask
0228    ULong_t  fForeground;         ///< foreground pixel
0229    ULong_t  fBackground;         ///< background pixel
0230    Int_t    fLineWidth;          ///< line width
0231    Int_t    fLineStyle;          ///< kLineSolid, kLineOnOffDash, kLineDoubleDash
0232    Int_t    fCapStyle;           ///< kCapNotLast, kCapButt,
0233                                  ///< kCapRound, kCapProjecting
0234    Int_t    fJoinStyle;          ///< kJoinMiter, kJoinRound, kJoinBevel
0235    Int_t    fFillStyle;          ///< kFillSolid, kFillTiled,
0236                                  ///< kFillStippled, kFillOpaeueStippled
0237    Int_t    fFillRule;           ///< kEvenOddRule, kWindingRule
0238    Int_t    fArcMode;            ///< kArcChord, kArcPieSlice
0239    Pixmap_t fTile;               ///< tile pixmap for tiling operations
0240    Pixmap_t fStipple;            ///< stipple 1 plane pixmap for stippling
0241    Int_t    fTsXOrigin;          ///< offset for tile or stipple operations
0242    Int_t    fTsYOrigin;
0243    FontH_t  fFont;               ///< default text font for text operations
0244    Int_t    fSubwindowMode;      ///< kClipByChildren, kIncludeInferiors
0245    Bool_t   fGraphicsExposures;  ///< boolean, should exposures be generated
0246    Int_t    fClipXOrigin;        ///< origin for clipping
0247    Int_t    fClipYOrigin;
0248    Pixmap_t fClipMask;           ///< bitmap clipping; other calls for rects
0249    Int_t    fDashOffset;         ///< patterned/dashed line information
0250    Char_t   fDashes[8];          ///< dash pattern list (dash length per byte)
0251    Int_t    fDashLen;            ///< number of dashes in fDashes
0252    Mask_t   fMask;               ///< bit mask specifying which fields are valid
0253 
0254    GCValues_t() : // default constructor
0255       fFunction  (kGXcopy),
0256       fPlaneMask  (0),
0257       fForeground  (0),
0258       fBackground  (1),
0259       fLineWidth  (0),
0260       fLineStyle  (kLineSolid),
0261       fCapStyle  (kCapButt),
0262       fJoinStyle  (kJoinMiter),
0263       fFillStyle  (kFillSolid),
0264       fFillRule  (kEvenOddRule),
0265       fArcMode  (kArcPieSlice),
0266       fTile  (0),
0267       fStipple  (0),
0268       fTsXOrigin  (0),
0269       fTsYOrigin  (0),
0270       fFont  (0),
0271       fSubwindowMode  (kClipByChildren),
0272       fGraphicsExposures  (kTRUE),
0273       fClipXOrigin  (0),
0274       fClipYOrigin  (0),
0275       fClipMask  (0),
0276       fDashOffset  (0),
0277       fDashLen  (2),
0278       fMask  (0)
0279    {
0280       for (int i = 2; i < 8; i++) fDashes[i] = 0;
0281       fDashes[0] = 5; // dashed
0282       fDashes[1] = 5;
0283    }
0284 };
0285 
0286 // Bits telling which GCValues_t fields are valid
0287 const Mask_t kGCFunction          = BIT(0);
0288 const Mask_t kGCPlaneMask         = BIT(1);
0289 const Mask_t kGCForeground        = BIT(2);
0290 const Mask_t kGCBackground        = BIT(3);
0291 const Mask_t kGCLineWidth         = BIT(4);
0292 const Mask_t kGCLineStyle         = BIT(5);
0293 const Mask_t kGCCapStyle          = BIT(6);
0294 const Mask_t kGCJoinStyle         = BIT(7);
0295 const Mask_t kGCFillStyle         = BIT(8);
0296 const Mask_t kGCFillRule          = BIT(9);
0297 const Mask_t kGCTile              = BIT(10);
0298 const Mask_t kGCStipple           = BIT(11);
0299 const Mask_t kGCTileStipXOrigin   = BIT(12);
0300 const Mask_t kGCTileStipYOrigin   = BIT(13);
0301 const Mask_t kGCFont              = BIT(14);
0302 const Mask_t kGCSubwindowMode     = BIT(15);
0303 const Mask_t kGCGraphicsExposures = BIT(16);
0304 const Mask_t kGCClipXOrigin       = BIT(17);
0305 const Mask_t kGCClipYOrigin       = BIT(18);
0306 const Mask_t kGCClipMask          = BIT(19);
0307 const Mask_t kGCDashOffset        = BIT(20);
0308 const Mask_t kGCDashList          = BIT(21);
0309 const Mask_t kGCArcMode           = BIT(22);
0310 
0311 struct ColorStruct_t {
0312    ULong_t   fPixel;    ///< color pixel value (index in color table)
0313    UShort_t  fRed;      ///< red component (0..65535)
0314    UShort_t  fGreen;    ///< green component (0..65535)
0315    UShort_t  fBlue;     ///< blue component (0..65535)
0316    UShort_t  fMask;     ///< mask telling which color components are valid
0317 };
0318 
0319 // Bits telling which ColorStruct_t fields are valid
0320 const Mask_t kDoRed   = BIT(0);
0321 const Mask_t kDoGreen = BIT(1);
0322 const Mask_t kDoBlue  = BIT(2);
0323 
0324 struct PictureAttributes_t {
0325    Colormap_t   fColormap;   ///< colormap to use
0326    Int_t        fDepth;      ///< depth of window
0327    UInt_t       fWidth;      ///< width of picture
0328    UInt_t       fHeight;     ///< height of picture
0329    UInt_t       fXHotspot;   ///< picture x hotspot coordinate
0330    UInt_t       fYHotspot;   ///< picture y hotspot coordinate
0331    ULong_t     *fPixels;     ///< list of used color pixels (if set use delete[])
0332    UInt_t       fNpixels;    ///< number of used color pixels
0333    UInt_t       fCloseness;  ///< allowable RGB deviation
0334    Mask_t       fMask;       ///< mask specifying which attributes are defined
0335 };
0336 
0337 // PictureAttributes_t masks bits
0338 const Mask_t kPAColormap     = BIT(0);
0339 const Mask_t kPADepth        = BIT(1);
0340 const Mask_t kPASize         = BIT(2);   ///< width and height
0341 const Mask_t kPAHotspot      = BIT(3);   ///< x and y hotspot
0342 const Mask_t kPAReturnPixels = BIT(4);
0343 const Mask_t kPACloseness    = BIT(5);
0344 
0345 /// Initial window mapping state
0346 enum EInitialState {
0347    kNormalState = BIT(0),
0348    kIconicState = BIT(1)
0349 };
0350 
0351 /// Used for drawing line segments (maps to the X11 XSegments structure)
0352 struct Segment_t {
0353    Short_t fX1, fY1, fX2, fY2;
0354 };
0355 
0356 /// Point structure (maps to the X11 XPoint structure)
0357 struct Point_t {
0358    Short_t fX, fY;
0359 };
0360 
0361 /// Rectangle structure (maps to the X11 XRectangle structure)
0362 struct Rectangle_t {
0363    Short_t  fX, fY;
0364    UShort_t fWidth, fHeight;
0365 };
0366 
0367 // Atoms used for text cut and paste between windows
0368 const Atom_t kPrimarySelection = 1;       ///< magic values, must match the ones
0369 const Atom_t kCutBuffer        = 9;       ///< in /usr/include/X11/Xatom.h
0370 const Int_t  kMaxPixel         = INT_MAX; ///< Max value for an int
0371 
0372 const int kNumCursors = 19;
0373 enum ECursor { kBottomLeft, kBottomRight, kTopLeft, kTopRight,
0374                kBottomSide, kLeftSide, kTopSide, kRightSide,
0375                kMove, kCross, kArrowHor, kArrowVer, kHand, kRotate,
0376                kPointer, kArrowRight, kCaret, kWatch, kNoDrop };
0377 
0378 /// types of frames (and borders), moved from TGFrame.h
0379 enum EFrameType {
0380    kChildFrame      = 0,
0381    kMainFrame       = BIT(0),
0382    kVerticalFrame   = BIT(1),
0383    kHorizontalFrame = BIT(2),
0384    kSunkenFrame     = BIT(3),
0385    kRaisedFrame     = BIT(4),
0386    kDoubleBorder    = BIT(5),
0387    kFitWidth        = BIT(6),
0388    kFixedWidth      = BIT(7),
0389    kFitHeight       = BIT(8),
0390    kFixedHeight     = BIT(9),
0391    kFixedSize       = (kFixedWidth | kFixedHeight),
0392    kOwnBackground   = BIT(10),
0393    kTransientFrame  = BIT(11),
0394    kTempFrame       = BIT(12),
0395    kMdiMainFrame    = BIT(13),
0396    kMdiFrame        = BIT(14)
0397 };
0398 
0399 
0400 #endif