Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // @(#)root/gui:$Id$
0002 // Author: Fons Rademakers   28/12/97
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TGWindow
0013 #define ROOT_TGWindow
0014 
0015 
0016 #include "TGObject.h"
0017 #include "TGClient.h"
0018 
0019 class TGClient;
0020 class TGIdleHandler;
0021 
0022 
0023 class TGWindow : public TGObject {
0024 
0025 friend class TGClient;
0026 
0027 protected:
0028    const TGWindow   *fParent;         ///< Parent window
0029    Bool_t            fNeedRedraw;     ///< kTRUE if window needs to be redrawn
0030    TString           fName;           ///< name of the window used in SavePrimitive()
0031    static Int_t      fgCounter;       ///< counter of created windows in SavePrimitive
0032    UInt_t            fEditDisabled;   ///< flags used for "guibuilding"
0033 
0034    TGWindow(Window_t id) :
0035       fParent(nullptr), fNeedRedraw(kFALSE), fName(), fEditDisabled(0) { fClient = nullptr; fId = id; }
0036    TGWindow(const TGWindow& tgw) :
0037       TGObject(tgw), fParent(tgw.fParent), fNeedRedraw(tgw.fNeedRedraw),
0038       fName(tgw.fName), fEditDisabled(tgw.fEditDisabled) {}
0039 
0040    TGWindow& operator=(const TGWindow& tgw)
0041    {
0042       if (this != &tgw) {
0043          TGObject::operator=(tgw);
0044          fParent = tgw.fParent;
0045          fNeedRedraw = tgw.fNeedRedraw;
0046          fName = tgw.fName;
0047          fEditDisabled = tgw.fEditDisabled;
0048       }
0049       return *this;
0050    }
0051 
0052    virtual void DoRedraw() { }
0053 
0054 public:
0055    enum  EEditMode {
0056       kEditEnable        = 0,          ///< allow edit of this window
0057       kEditDisable       = BIT(0),     ///< disable edit of this window
0058       kEditDisableEvents = BIT(1),     ///< window events cannot be edited
0059       kEditDisableGrab   = BIT(2),     ///< window grab cannot be edited
0060       kEditDisableLayout = BIT(3),     ///< window layout cannot be edited
0061       kEditDisableResize = BIT(4),     ///< window size cannot be edited
0062       kEditDisableHeight = BIT(5),     ///< window height cannot be edited
0063       kEditDisableWidth  = BIT(6),     ///< window width cannot be edited
0064       kEditDisableBtnEnable = BIT(7),  ///< window can handle mouse button events
0065       kEditDisableKeyEnable = BIT(8)   ///< window can handle keyboard events
0066    };
0067 
0068    enum EStatusBits {
0069       kIsHtmlView = BIT(14)
0070    };
0071 
0072    TGWindow(const TGWindow *p = nullptr, Int_t x = 0, Int_t y = 0,
0073             UInt_t w = 0, UInt_t h = 0, UInt_t border = 0,
0074             Int_t depth = 0,
0075             UInt_t clss = 0,
0076             void *visual = nullptr,
0077             SetWindowAttributes_t *attr = nullptr,
0078             UInt_t wtype = 0);
0079    TGWindow(TGClient *c, Window_t id, const TGWindow *parent = nullptr);
0080 
0081    ~TGWindow() override;
0082 
0083    const TGWindow *GetParent() const { return fParent; }
0084    virtual const TGWindow *GetMainFrame() const;
0085 
0086    virtual void MapWindow();
0087    virtual void MapSubwindows();
0088    virtual void MapRaised();
0089    virtual void UnmapWindow();
0090    virtual void DestroyWindow();
0091    virtual void DestroySubwindows();
0092    virtual void RaiseWindow();
0093    virtual void LowerWindow();
0094    virtual void IconifyWindow();
0095    virtual void ReparentWindow(const TGWindow *p, Int_t x = 0, Int_t y = 0);
0096    virtual void RequestFocus();
0097 
0098    virtual void SetBackgroundColor(Pixel_t color);
0099    virtual void SetBackgroundPixmap(Pixmap_t pixmap);
0100 
0101    virtual Bool_t HandleExpose(Event_t *event)
0102                   { if (event->fCount == 0) fClient->NeedRedraw(this); return kTRUE; }
0103    virtual Bool_t HandleEvent(Event_t *) { return kFALSE; }
0104    Bool_t         HandleTimer(TTimer *) override { return kFALSE; }
0105    virtual Bool_t HandleIdleEvent(TGIdleHandler *) { return kFALSE; }
0106 
0107    virtual void   Move(Int_t x, Int_t y);
0108    virtual void   Resize(UInt_t w, UInt_t h);
0109    virtual void   MoveResize(Int_t x, Int_t y, UInt_t w, UInt_t h);
0110    virtual Bool_t IsMapped();
0111    virtual Bool_t IsEditable() const { return (fClient->GetRoot() == this); }
0112    virtual UInt_t GetEditDisabled() const { return fEditDisabled; }
0113    virtual void   SetEditDisabled(UInt_t on = kEditDisable) { fEditDisabled = on; }
0114    virtual void   SetEditable(Bool_t on = kTRUE)
0115                   { if (!(fEditDisabled & kEditDisable)) fClient->SetRoot(on ? this : nullptr); }
0116    virtual Int_t  MustCleanup() const { return 0; }
0117    void           Print(Option_t *option="") const override;
0118 
0119    virtual void   SetWindowName(const char *name = nullptr);
0120    const char    *GetName() const override;
0121    virtual void   SetName(const char *name) { fName = name; }
0122 
0123    virtual void   SetMapSubwindows(Bool_t /*on*/) {  }
0124    virtual Bool_t IsMapSubwindows() const { return kTRUE; }
0125 
0126    static Int_t   GetCounter();
0127 
0128    ClassDefOverride(TGWindow, 0);  // GUI Window base class
0129 };
0130 
0131 
0132 /** \class TGUnknownWindowHandler
0133     \ingroup guiwidgets
0134 
0135 Handle events for windows that are not part of the native ROOT GUI.
0136 Typically windows created by Xt or Motif.
0137 
0138 */
0139 
0140 
0141 class TGUnknownWindowHandler : public TObject {
0142 
0143 public:
0144    TGUnknownWindowHandler() {}
0145    ~TGUnknownWindowHandler() override {}
0146 
0147    virtual Bool_t HandleEvent(Event_t *) = 0;
0148 
0149    ClassDefOverride(TGUnknownWindowHandler,0)  // Abstract event handler for unknown windows
0150 };
0151 
0152 #endif