12 #ifndef ROOT_TGMdiDecorFrame
13 #define ROOT_TGMdiDecorFrame
36 enum EMdiResizerPlacement {
38 kMdiResizerBottom = 2,
45 class TGMdiDecorFrame;
54 class TGMdiWinResizer :
public TGFrame,
public TGWidget {
56 friend class TGMdiMainFrame;
59 const TGWindow *fMdiWin;
60 Int_t fWinX, fWinY, fWinW, fWinH;
61 Int_t fOldX, fOldY, fOldW, fOldH;
62 Int_t fNewX, fNewY, fNewW, fNewH;
67 Bool_t fLeftButPressed, fRightButPressed, fMidButPressed;
73 void DrawBox(Int_t x, Int_t y, UInt_t width, UInt_t height);
76 TGMdiWinResizer(
const TGWindow *p,
const TGWindow *mdiwin, Int_t pos,
77 const TGGC *boxGC, Int_t linew,
78 Int_t mdioptions = kMdiDefaultResizeMode,
79 Int_t w = 1, Int_t h = 1, UInt_t options = kOwnBackground);
81 virtual Bool_t HandleButton(Event_t *event);
82 virtual void DrawBorder() {};
84 void SetResizeMode(Int_t mode) { fMdiOptions = mode; }
85 void SetMinSize(Int_t w = 50, Int_t h = 20) { fMinW = w; fMinH = h; }
87 ClassDef(TGMdiWinResizer, 0)
91 class TGMdiVerticalWinResizer :
public TGMdiWinResizer {
94 TGMdiVerticalWinResizer(
const TGWindow *p,
const TGWindow *mdiwin,
95 Int_t pos,
const TGGC *boxGC, Int_t linew,
96 Int_t mdioptions = kMdiDefaultResizeMode,
97 Int_t w = 4, Int_t h = 5);
99 virtual Bool_t HandleMotion(Event_t *event);
100 virtual void DrawBorder();
102 ClassDef(TGMdiVerticalWinResizer, 0)
106 class TGMdiHorizontalWinResizer :
public TGMdiWinResizer {
109 TGMdiHorizontalWinResizer(
const TGWindow *p,
const TGWindow *mdiwin,
110 Int_t pos,
const TGGC *boxGC, Int_t linew,
111 Int_t mdioptions = kMdiDefaultResizeMode,
112 Int_t w = 5, Int_t h = 4);
114 virtual Bool_t HandleMotion(Event_t *event);
115 virtual void DrawBorder();
117 ClassDef(TGMdiHorizontalWinResizer, 0)
121 class TGMdiCornerWinResizer :
public TGMdiWinResizer {
124 TGMdiCornerWinResizer(
const TGWindow *p,
const TGWindow *mdiwin,
125 Int_t pos,
const TGGC *boxGC, Int_t linew,
126 Int_t mdioptions = kMdiDefaultResizeMode,
127 Int_t w = 20, Int_t h = 20);
129 virtual Bool_t HandleMotion(Event_t *event);
130 virtual void DrawBorder();
132 ClassDef(TGMdiCornerWinResizer, 0)
138 class TGMdiButtons :
public TGCompositeFrame {
140 friend class TGMdiTitleBar;
143 TGPictureButton *fButton[5];
144 TGLayoutHints *fDefaultHint, *fCloseHint;
145 const TGWindow *fMsgWindow;
148 TGMdiButtons(
const TGWindow *p,
const TGWindow *titlebar);
149 virtual ~TGMdiButtons();
151 TGPictureButton *GetButton(Int_t no)
const {
return fButton[no]; }
153 ClassDef(TGMdiButtons, 0)
159 class TGMdiTitleIcon :
public TGIcon {
161 friend class TGMdiFrame;
162 friend class TGMdiTitleBar;
165 const TGWindow *fMsgWindow;
168 virtual void DoRedraw();
171 TGMdiTitleIcon(
const TGWindow *p,
const TGWindow *titlebar,
172 const TGPicture *pic, Int_t w, Int_t h);
173 virtual ~TGMdiTitleIcon();
175 virtual Bool_t HandleDoubleClick(Event_t *event);
176 virtual Bool_t HandleButton(Event_t *event);
177 TGPopupMenu *GetPopup()
const {
return fPopup; }
179 ClassDef(TGMdiTitleIcon, 0)
185 class TGMdiTitleBar :
public TGCompositeFrame {
187 friend class TGMdiDecorFrame;
188 friend class TGMdiMainFrame;
191 const TGWindow *fMdiWin;
192 TGMdiButtons *fButtons;
193 TGMdiTitleIcon *fWinIcon;
195 TGCompositeFrame *fLFrame, *fMFrame,*fRFrame;
196 TGLayoutHints *fLHint, *fLeftHint, *fMiddleHint, *fRightHint;
198 Bool_t fLeftButPressed, fRightButPressed, fMidButPressed;
200 TGMdiTitleBar(
const TGWindow *p,
const TGWindow *mdiwin,
201 const char *name =
"Untitled");
202 void LayoutButtons(UInt_t buttonmask, Bool_t isMinimized,
205 void AddFrames(TGMdiTitleIcon *icon, TGMdiButtons *buttons);
206 void RemoveFrames(TGMdiTitleIcon *icon, TGMdiButtons *buttons);
209 virtual ~TGMdiTitleBar();
211 virtual Bool_t HandleButton(Event_t *event);
212 virtual Bool_t HandleDoubleClick(Event_t *event);
213 virtual Bool_t HandleMotion(Event_t *event);
214 virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
216 void SetTitleBarColors(UInt_t fore, UInt_t back, TGFont *f);
217 TGMdiButtons *GetButtons()
const {
return fButtons; }
218 TGMdiTitleIcon *GetWinIcon()
const {
return fWinIcon; }
219 TGLabel *GetWinName()
const {
return fWinName; }
220 Int_t GetX0() {
return fX0; }
221 Int_t GetY0() {
return fY0; }
222 Bool_t IsLeftButPressed() {
return fLeftButPressed; }
223 Bool_t IsRightButPressed() {
return fRightButPressed; }
224 Bool_t IsMidButPressed() {
return fMidButPressed; }
226 void SetX0(Int_t x0) { fX0 = x0; }
227 void SetY0(Int_t y0) { fY0 = y0; }
228 void SetLeftButPressed(Bool_t press = kTRUE) { fLeftButPressed = press; }
229 void SetRightButPressed(Bool_t press = kTRUE) { fRightButPressed= press; }
230 void SetMidButPressed(Bool_t press = kTRUE) { fMidButPressed = press; }
232 ClassDef(TGMdiTitleBar, 0)
238 class TGMdiDecorFrame :
public TGCompositeFrame {
240 friend class TGMdiMainFrame;
243 Int_t fPreResizeX, fPreResizeY;
244 Int_t fPreResizeWidth, fPreResizeHeight;
245 Int_t fMinimizedX, fMinimizedY;
246 Bool_t fIsMinimized, fIsMaximized;
247 Bool_t fMinimizedUserPlacement;
251 TGMdiMainFrame *fMdiMainFrame;
253 TGMdiVerticalWinResizer *fUpperHR, *fLowerHR;
254 TGMdiCornerWinResizer *fUpperLeftCR, *fLowerLeftCR;
255 TGMdiCornerWinResizer *fUpperRightCR, *fLowerRightCR;
256 TGMdiHorizontalWinResizer *fLeftVR, *fRightVR;
257 TGLayoutHints *fLHint, *fExpandHint;
260 TGMdiTitleBar *fTitlebar;
268 TGMdiDecorFrame(TGMdiMainFrame *main, TGMdiFrame *frame, Int_t w, Int_t h,
269 const TGGC *boxGC, UInt_t options = 0,
270 Pixel_t back = GetDefaultFrameBackground());
271 virtual ~TGMdiDecorFrame();
273 virtual Bool_t HandleButton(Event_t *event);
274 virtual Bool_t HandleConfigureNotify(Event_t *event);
276 virtual Int_t CloseWindow() {
return fFrame->CloseWindow(); }
277 virtual void Layout();
279 virtual void Move(Int_t x, Int_t y);
280 virtual void MoveResize(Int_t x, Int_t y, UInt_t w, UInt_t h);
282 void SetMdiButtons(ULong_t buttons);
283 ULong_t GetMdiButtons()
const {
return fButtonMask; }
285 void SetResizeMode(Int_t mode = kMdiDefaultResizeMode);
287 void SetWindowName(
const char *name);
288 void SetWindowIcon(
const TGPicture *pic);
289 const char *GetWindowName() {
290 return (
const char *)fTitlebar->GetWinName()->GetText()->GetString();
292 const TGPicture *GetWindowIcon() {
return fTitlebar->GetWinIcon()->GetPicture(); }
293 Bool_t IsCurrent()
const {
return fIsCurrent; }
294 Bool_t IsMinimized()
const {
return fIsMinimized; }
295 Bool_t IsMaximized()
const {
return fIsMaximized; }
296 Int_t GetPreResizeX()
const {
return fPreResizeX; }
297 Int_t GetPreResizeY()
const {
return fPreResizeY; }
298 Int_t GetPreResizeWidth()
const {
return fPreResizeWidth; }
299 Int_t GetPreResizeHeight()
const {
return fPreResizeHeight; }
300 Int_t GetMinimizedX()
const {
return fMinimizedX; }
301 Int_t GetMinimizedY()
const {
return fMinimizedY; }
302 Bool_t GetMinUserPlacement()
const {
return fMinimizedUserPlacement; }
304 void SetCurrent(Bool_t cur = kTRUE) {fIsCurrent = cur; }
305 void SetDecorBorderWidth(Int_t bw);
306 void SetPreResizeX(Int_t x) { fPreResizeX = x; }
307 void SetPreResizeY(Int_t y) { fPreResizeY = y; }
308 void SetPreResizeWidth(Int_t w) { fPreResizeWidth = w; }
309 void SetPreResizeHeight(Int_t h) { fPreResizeHeight = h; }
310 void SetMinimizedX(Int_t x) { fMinimizedX = x; }
311 void SetMinimizedY(Int_t y) { fMinimizedY = y; }
312 void Minimize(Bool_t min = kTRUE) { fIsMinimized = min; }
313 void Maximize(Bool_t max = kTRUE) { fIsMaximized = max; }
314 void SetMinUserPlacement(Bool_t place = kTRUE) { fMinimizedUserPlacement = place; }
316 TGMdiFrame *GetMdiFrame()
const {
return fFrame; }
317 TGMdiTitleBar *GetTitleBar()
const {
return fTitlebar; }
319 TGMdiVerticalWinResizer *GetUpperHR()
const {
return fUpperHR; }
320 TGMdiVerticalWinResizer *GetLowerHR()
const {
return fLowerHR; }
321 TGMdiCornerWinResizer *GetUpperLeftCR()
const {
return fUpperLeftCR; }
322 TGMdiCornerWinResizer *GetLowerLeftCR()
const {
return fLowerLeftCR; }
323 TGMdiCornerWinResizer *GetUpperRightCR()
const {
return fUpperRightCR; }
324 TGMdiCornerWinResizer *GetLowerRightCR()
const {
return fLowerRightCR; }
325 TGMdiHorizontalWinResizer *GetLeftVR()
const {
return fLeftVR; }
326 TGMdiHorizontalWinResizer *GetRightVR()
const {
return fRightVR; }
328 ClassDef(TGMdiDecorFrame, 0)