Logo ROOT  
Reference Guide
Go to the documentation of this file.
1// @(#)root/guibuilder:$Id$
2// Author: Valeriy Onuchin 12/09/04
5 * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
12#ifndef ROOT_TGuiBldDragManager
13#define ROOT_TGuiBldDragManager
17// //
18// TGuiBldDragManager //
19// //
22#include "TGFrame.h"
24#include "TVirtualDragManager.h"
26class TTimer;
28class TRootGuiBuilder;
29class TQUndoManager;
30class TGPopupMenu;
31class TGuiBldEditor;
32class TGColorDialog;
33class TGFontDialog;
34class TGTextButton;
35class TGPictureButton;
36class TGCanvas;
37class TGComboBox;
38class TGLabel;
39class TGListBox;
40class TGProgressBar;
41class TGScrollBar;
42class TGTextEntry;
43class TGIcon;
60friend class TGClient;
61friend class TGFrame;
62friend class TGMainFrame;
63friend class TGGrabRect;
64friend class TRootGuiBuilder;
66friend class TGuiBldMenuDialog;
68friend class TGuiBldEditor;
73 TRootGuiBuilder *fBuilder; // pointer to gui builder
74 TGuiBldEditor *fEditor; // frame property editor
75 Bool_t fLassoDrawn; // kTRUE if lasso drawn
76 TString fPasteFileName; // paste_clippboard file name
77 TString fTmpBuildFile; // temporary file name
78 Bool_t fSelectionIsOn; // selection with Shift key pressed
79 TGPopupMenu *fFrameMenu; // context menu for frames
80 TGPopupMenu *fLassoMenu; // context menu for lasso drawn
81 Window_t fTargetId; // an id of window where drop
82 Bool_t fDropStatus; // kTRUE if drop was successfull
83 Bool_t fStop; // kTRUE if stopped
84 TGFrame *fSelected; // selected frame. In most cases selected is
85 // the same frame as grabbed frame.
86 TList *fListOfDialogs; // list of dialog methods
88 static TGColorDialog *fgGlobalColorDialog; // color dialog
91 static TGFontDialog *fgGlobalFontDialog; // font dialog
95 void Reset1();
97 void DrawGrabRect(Int_t i, Int_t x, Int_t y);
101 void CloseMenus();
102 Bool_t IsEditDisabled(TGWindow *f) const { return (f && (f->GetEditDisabled() & kEditDisable)); }
103 Bool_t IsGrabDisabled(TGWindow *f) const { return (f && (f->GetEditDisabled() & kEditDisableGrab)); }
104 Bool_t IsEventsDisabled(TGWindow *f) const { return (f && (f->GetEditDisabled() & kEditDisableEvents)); }
105 Bool_t IsFixedLayout(TGWindow *f) const { return (f && (f->GetEditDisabled() & kEditDisableLayout)); }
106 Bool_t IsFixedH(TGWindow *f) const { return (f && (f->GetEditDisabled() & kEditDisableHeight)); }
107 Bool_t IsFixedW(TGWindow *f) const { return (f && (f->GetEditDisabled() & kEditDisableWidth)); }
108 Bool_t IsFixedSize(TGWindow *f) const { return (f && (f->GetEditDisabled() & kEditDisableResize)); }
111 Bool_t CanCompact(TGWindow *w) const;
113 void ChangeSelected(TGFrame *f);
119 void RaiseMdiFrame(TGFrame *in);
121 void AddClassMenuMethods(TGPopupMenu *menu, TObject *object);
122 void AddDialogMethods(TGPopupMenu *menu, TObject *object);
123 void DeleteMenuDialog();
124 void CreateListOfDialogs();
128 void GrabFrame(TGFrame *frame);
129 void UngrabFrame();
134 void ToGrid(Int_t &x, Int_t &y);
135 void DoReplace(TGFrame *frame);
136 void DeleteFrame(TGFrame *frame);
137 void HandleDelete(Bool_t crop = kFALSE);
139 void HandleAlignment(Int_t to, Bool_t lineup = kFALSE);
140 void HandleCut();
141 void HandleCopy(Bool_t brk_layout = kTRUE);
142 void HandlePaste();
143 void HandleReplace();
144 void HandleGrid();
145 void CloneEditable();
146 void DropCanvas(TGCanvas *canvas);
147 void PutToCanvas(TGCompositeFrame *cont);
148 Bool_t Save(const char *file = "");
149 Bool_t SaveFrame(const char *file = 0);
151 void DoResize();
152 void DoMove();
153 void DrawLasso();
155 void ReparentFrames(TGFrame *newfr,
156 TGCompositeFrame *oldfr);
158 void SetCursorType(Int_t cur);
161 void Compact(Bool_t global = kTRUE);
163 Bool_t EndDrag();
164 Bool_t Drop();
165 Bool_t Cancel(Bool_t delSrc);
166 void Menu4Frame(TGFrame *, Int_t x, Int_t y);
167 void Menu4Lasso(Int_t x, Int_t y);
169 void DoRedraw();
170 void SwitchEditable(TGFrame *frame);
171 void UnmapAllPopups();
172 void BreakLayout();
173 void SwitchLayout();
175 Bool_t RecognizeGesture(Event_t *, TGFrame *frame = 0);
187 void HandleButon3Pressed(Event_t *, TGFrame *frame = 0);
191 Bool_t IsMoveWaiting() const;
192 Bool_t IsLassoDrawn() const { return fLassoDrawn; }
193 void SetLassoDrawn(Bool_t on);
194 void HideGrabRectangles();
201 virtual ~TGuiBldDragManager();
203 void HandleAction(Int_t act);
206 TGFrame *GetTarget() const { return fTarget; }
207 TGFrame *GetSelected() const;
208 void Snap2Grid();
209 void SetGridStep(UInt_t step);
212 Int_t GetStrartDragX() const;
213 Int_t GetStrartDragY() const;
214 Int_t GetEndDragX() const;
215 Int_t GetEndDragY() const;
217 Bool_t GetDropStatus() const { return fDropStatus; }
220 Bool_t IsStopped() const { return fStop; }
221 void SetEditable(Bool_t on = kTRUE);
222 void SelectFrame(TGFrame *frame, Bool_t add = kFALSE);
224 static void MapGlobalDialog(TGMainFrame *dialog, TGFrame *fr);
228 { Emit("TimerEvent(Event_t*)", (Longptr_t)ev); } // *SIGNAL*
230 // hadndling dynamic context menus
231 void DoClassMenu(Int_t);
232 void DoDialogOK();
233 void DoDialogApply();
234 void DoDialogCancel();
236 void ChangeProperties(TGLabel *); //*MENU* *DIALOG*icon=bld_fontselect.png*
237 void ChangeProperties(TGTextButton *); //*MENU* *DIALOG*icon=bld_fontselect.png*
239 void ChangeTextFont(TGGroupFrame *); //*MENU* *DIALOG*icon=bld_fontselect.png*
240 void ChangeTextFont(TGTextEntry *); //*MENU* *DIALOG*icon=bld_fontselect.png*
242 void ChangePicture(TGPictureButton *); //*MENU* *DIALOG*icon=bld_open.png*
243 void ChangeImage(TGIcon *); //*MENU* *DIALOG*icon=bld_open.png*
245 void ChangeBarColor(TGProgressBar *); //*MENU* *DIALOG*icon=bld_colorselect.png*
247 void ChangeTextColor(TGGroupFrame *); //*MENU* *DIALOG*icon=bld_colorselect.png*
248 void ChangeTextColor(TGLabel *); //*MENU* *DIALOG*icon=bld_colorselect.png*
249 void ChangeTextColor(TGTextButton *); //*MENU* *DIALOG*icon=bld_colorselect.png*
250 void ChangeTextColor(TGProgressBar *); //*MENU* *DIALOG*icon=bld_colorselect.png*
251 void ChangeTextColor(TGTextEntry *); //*MENU* *DIALOG*icon=bld_colorselect.png*
253 void ChangeBackgroundColor(TGListBox *); //*MENU* *DIALOG*icon=bld_colorselect.png*
254 void ChangeBackgroundColor(TGCanvas *); //*MENU* *DIALOG*icon=bld_colorselect.png*
255 void ChangeBackgroundColor(TGComboBox *); //*MENU* *DIALOG*icon=bld_colorselect.png*
256 void ChangeBackgroundColor(TGFrame *); //*MENU* *DIALOG*icon=bld_colorselect.png*
257 void ChangeBackgroundColor(TGCompositeFrame *); //*MENU* *DIALOG*icon=bld_colorselect.png*
259 ClassDef(TGuiBldDragManager,0) // drag and drop manager
Handle_t Window_t
Window handle.
Definition: GuiTypes.h:29
#define f(i)
Definition: RSha256.hxx:104
#define e(i)
Definition: RSha256.hxx:103
bool Bool_t
Definition: RtypesCore.h:63
int Int_t
Definition: RtypesCore.h:45
long Longptr_t
Definition: RtypesCore.h:82
const Bool_t kFALSE
Definition: RtypesCore.h:101
unsigned int UInt_t
Definition: RtypesCore.h:46
const Bool_t kTRUE
Definition: RtypesCore.h:100
#define ClassDef(name, id)
Definition: Rtypes.h:335
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t b
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t win
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t src
@ kLayUpAct
@ kCloneAct
@ kEditableAct
@ kDropAct
@ kSelectAct
@ kEndEditAct
@ kReparentAct
@ kLayoutHAct
@ kSwitchLayoutAct
@ kCompactAct
@ kReplaceAct
@ kBreakLayoutAct
@ kCutAct
@ kRedoAct
@ kPropertyAct
@ kLeftAct
@ kLayoutVAct
@ kLayDownAct
@ kToggleMenuAct
@ kMethodMenuAct
@ kDownAct
@ kUndoAct
@ kSaveAct
@ kGrabAct
@ kPasteAct
@ kNewAct
@ kDeleteAct
@ kNoneAct
@ kCopyAct
@ kGridAct
@ kCompactGlobalAct
@ kUpAct
@ kSaveFrameAct
@ kRightAct
@ kOpenAct
@ kCropAct
A frame containing two scrollbars (a horizontal and a vertical) and a viewport.
Definition: TGCanvas.h:192
Window client.
Definition: TGClient.h:37
A full featured color selection dialog.
A combobox (also known as a drop down listbox) allows the selection of one item out of a list of item...
Definition: TGComboBox.h:47
The base class for composite widgets (menu bars, list boxes, etc.).
Definition: TGFrame.h:287
Font selection dialog, allowing to select one in the list of available fonts in the system.
Definition: TGFontDialog.h:24
A subclasses of TGWindow, and is used as base class for some simple widgets (buttons,...
Definition: TGFrame.h:80
A composite frame with a border and a title.
Definition: TGFrame.h:522
This class handles GUI icons.
Definition: TGIcon.h:22
This class handles GUI labels.
Definition: TGLabel.h:24
This class describes layout hints used by the layout classes.
Definition: TGLayout.h:50
A listbox is a box, possibly with scrollbar, containing entries.
Definition: TGListBox.h:221
Defines top level windows that interact with the system Window Manager.
Definition: TGFrame.h:397
Yield an action as soon as it is clicked.
Definition: TGButton.h:228
This class creates a popup menu object.
Definition: TGMenu.h:110
The classes in this file implement progress bars.
Definition: TGProgressBar.h:19
The classes in this file implement scrollbars.
Definition: TGScrollBar.h:61
Yield an action as soon as it is clicked.
Definition: TGButton.h:142
A TGTextEntry is a one line text input widget.
Definition: TGTextEntry.h:24
ROOT GUI Window base class.
Definition: TGWindow.h:23
@ kEditDisableResize
window size cannot be edited
Definition: TGWindow.h:54
@ kEditDisableHeight
window height cannot be edited
Definition: TGWindow.h:55
@ kEditDisableLayout
window layout cannot be edited
Definition: TGWindow.h:53
@ kEditDisableWidth
window width cannot be edited
Definition: TGWindow.h:56
@ kEditDisableGrab
window grab cannot be edited
Definition: TGWindow.h:52
@ kEditDisable
disable edit of this window
Definition: TGWindow.h:50
@ kEditDisableEvents
window events cannot be edited
Definition: TGWindow.h:51
Drag and drop manager used by the ROOT GUI Builder.
Bool_t IsLassoDrawn() const
TGFrame * GetEditableParent(TGFrame *f)
Return the parent frame which can be edited.
void ChangeSelected(TGFrame *f)
Inform outside wold that selected frame was changed.
void HandleAction(Int_t act)
Main handler of actions.
Bool_t IsFixedH(TGWindow *f) const
void DoDialogCancel()
Process dialog Cancel button pressed.
void DeleteMenuDialog()
Delete dialog and trash.
void SetCursorType(Int_t cur)
Set cursor for selected/grabbed frame.
void SwitchLayout()
Switch Horizontal/Vertical layout of selected/grabbed composite frame.
void SetBuilder(TRootGuiBuilder *b)
void ChangeImage(TGIcon *)
Invoke file dialog to assign a new image.
void DoClassMenu(Int_t)
Process a method chosen via frame context menu.
Bool_t IsMoveWaiting() const
Waits for either the mouse move from the given initial ButtonPress location or for the mouse button t...
void ChangeTextFont(TGGroupFrame *)
Change text font via font selection dialog.
Bool_t CheckDragResize(Event_t *event)
Check resize type event.
void SelectFrame(TGFrame *frame, Bool_t add=kFALSE)
Grab/Select frame.
TGFrame * InEditable(Window_t id)
Return a pointer to the parent window (which is being edited)
Bool_t CanChangeLayoutOrder(TGWindow *w) const
kTRUE - if it's possible to change layout order in the parent's layout of window w
Bool_t HandleSelection(Event_t *)
not used yet.
void HandlePaste()
Handle paste action.
virtual ~TGuiBldDragManager()
void Snap2Grid()
Draw grid on editable frame and restore background on previously edited one.
Bool_t IsPointVisible(Int_t x, Int_t y)
Helper function for IsSelectedWindow method.
void PutToCanvas(TGCompositeFrame *cont)
Create a new TGCanvas and place container into it.
Bool_t HandleMotion(Event_t *)
Handle motion event.
void CheckTargetUnderGrab()
Look for the drop target under grabbed/selected frame while moving.
void HideGrabRectangles()
Hide/Unmap grab rectangles.
void CreatePropertyEditor()
Create widget property editor (it could be located outside of guibuilder)
void SetGridStep(UInt_t step)
Set the grid step.
void Compact(Bool_t global=kTRUE)
Layout and Resize frame.
Bool_t HandleTimerEvent(Event_t *ev, TTimer *t)
Handle timer events or events coming from the recorder.
void DrawLasso()
Draw lasso for allocation new object.
void Menu4Frame(TGFrame *, Int_t x, Int_t y)
Create and place context menu for selected frame.
Int_t GetEndDragY() const
Returns the current Y coordinate of the dragged frame.
void RaiseMdiFrame(TGFrame *in)
Raise guibuilder's mdi frame.
void DeleteFrame(TGFrame *frame)
Delete frame.
void DoDialogApply()
Process dialog Apply button pressed.
Bool_t HandleExpose(Event_t *)
Handle repaint event.
void DoMove()
Handle move.
void ChangeBarColor(TGProgressBar *)
Set progress bar color via TGColorDialog.
void HandleDelete(Bool_t crop=kFALSE)
Handle delete or crop action.
void HandleButon3Pressed(Event_t *, TGFrame *frame=0)
Handle 3d mouse pressed (popup context menu)
void Menu4Lasso(Int_t x, Int_t y)
Create context menu for lasso actions.
void ReparentFrames(TGFrame *newfr, TGCompositeFrame *oldfr)
Reparent frames.
Int_t GetStrartDragX() const
Return the X coordinate where drag started.
void HandleLayoutOrder(Bool_t forward=kTRUE)
Change layout order.
Bool_t SaveFrame(const char *file=0)
Save composite frame as macro.
Bool_t IgnoreEvent(Event_t *e)
Return kTRUE if event is rejected for processing by drag manager.
void CloneEditable()
Create a frame which is the same as currently edited frame.
Bool_t Cancel(Bool_t delSrc)
Do cancel action.
void HandleReplace()
Handle replace.
void DoDialogOK()
Process dialog OK button pressed.
TList * GetFramesInside(Int_t x0, Int_t y0, Int_t x, Int_t y)
Return the list of frames inside of some area.
void DoResize()
handle resize
Bool_t HandleSelectionRequest(Event_t *)
not used yet.
TGCompositeFrame * FindCompositeFrame(Window_t id)
Find the first composite parent of window.
Bool_t EndDrag()
End dragging.
Bool_t HandleButtonPress(Event_t *)
Handle button press event.
Bool_t GetDropStatus() const
Int_t GetStrartDragY() const
Return the Y coordinate where drag started.
void DrawGrabRectangles(TGWindow *win=0)
Draw small grab rectangles around grabbed/selected/frame.
void TimerEvent(Event_t *ev)
TGPopupMenu * fFrameMenu
void HandleAlignment(Int_t to, Bool_t lineup=kFALSE)
Align frames located inside lasso area.
void SwitchEditable(TGFrame *frame)
Switch editable.
void DrawGrabRect(Int_t i, Int_t x, Int_t y)
Helper method to draw grab rectangle at position x,y.
TGFrame * GetTarget() const
Bool_t Drop()
Drop grabbed frame.
void UnmapAllPopups()
Unmap all popups.
void ChangePicture(TGPictureButton *)
Invoke file dialog to assign a new picture.
void DoRedraw()
Redraw the edited window.
Bool_t IsEditDisabled(TGWindow *f) const
TGFrame * FindMdiFrame(TGFrame *in)
Return a pointer to the parent mdi frame.
void ChangeBackgroundColor(TGListBox *)
Set background color for list box entries.
Bool_t HandleKey(Event_t *)
Handle key event.
Bool_t StartDrag(TGFrame *src, Int_t x, Int_t y)
Start dragging.
Bool_t IsStopped() const
TGuiBldDragManagerPimpl * fPimpl
Bool_t CanCompact(TGWindow *w) const
kTRUE is frame could be compacted/"laid out"
void CloseMenus()
Helper to close all menus.
Bool_t HandleEvent(Event_t *)
Handle all events.
void GrabFrame(TGFrame *frame)
grab frame (see SelectFrame)
void AddClassMenuMethods(TGPopupMenu *menu, TObject *object)
Add entries with class //*MENU* methods.
void HandleCopy(Bool_t brk_layout=kTRUE)
Handle copy.
void ToGrid(Int_t &x, Int_t &y)
Return grid coordinates which are close to given.
void CreateListOfDialogs()
Create a list of dialog methods.
static TGFontDialog * fgGlobalFontDialog
void SetLassoDrawn(Bool_t on)
Set lasso drawn flag.
Bool_t IsFixedW(TGWindow *f) const
Bool_t RecognizeGesture(Event_t *, TGFrame *frame=0)
Recognize what was done when mouse button pressed.
void HandleCut()
Handle cut action.
TGWindow * GetResizableParent(TGWindow *p)
Find parent frame which can be resized.
static void MapGlobalDialog(TGMainFrame *dialog, TGFrame *fr)
Map dialog and place it relative to selected frame.
Bool_t HandleTimer(TTimer *)
The main event loop is originated here It repeatedly queries pointer state and position on the screen...
void HandleReturn(Bool_t on=kFALSE)
Handling of return/enter key pressing.
UInt_t GetGridStep()
Return the grid step.
Bool_t HandleButton(Event_t *)
Handle button event occurred in some ROOT frame.
Bool_t HandleButtonRelease(Event_t *)
Handle button release event.
static TGFontDialog * GetGlobalFontDialog()
Create global font dialog.
void Reset1()
Reset some parameters.
TGPopupMenu * fLassoMenu
Bool_t HandleDestroyNotify(Event_t *)
Handle destroy notify.
void PlaceFrame(TGFrame *, TGLayoutHints *)
Put created frame at position of the last mouse click.
Bool_t IsFixedLayout(TGWindow *f) const
void SetPropertyEditor(TGuiBldEditor *e)
Helper method.
Bool_t CheckTargetAtPoint(Int_t x, Int_t y)
Helper. Look for the drop target under grabbed/selected frame while moving.
Int_t GetEndDragX() const
Return the current X coordinate of the dragged frame.
void SetEditable(Bool_t on=kTRUE)
Grab server.
TGFrame * GetMovableParent(TGWindow *p)
Find parent frame which can be dragged.
static TGColorDialog * fgGlobalColorDialog
Bool_t HandleConfigureNotify(Event_t *)
Resize events.
Bool_t IsFixedSize(TGWindow *f) const
Bool_t HandleDoubleClick(Event_t *)
Mouse double click handler (never should happen)
void HighlightCompositeFrame(Window_t)
Raise composite frame when mouse is moving over it.
void DoReplace(TGFrame *frame)
Replace frame (doesn't work yet properly)
void HandleGrid()
Switch on/of grid drawn.
Bool_t CanChangeLayout(TGWindow *w) const
kTRUE - if it's possible to switch disable/enable layout
Bool_t Save(const char *file="")
Save an edited frame to the file.
void BreakLayout()
Disable/Enable layout for selected/grabbed composite frame.
Bool_t IsPasteFrameExist()
Return kTRUE if paste frame exist.
void UngrabFrame()
Ungrab/Unselect selected/grabbed frame.
TRootGuiBuilder * fBuilder
void DropCanvas(TGCanvas *canvas)
Drop canvas container.
TGuiBldEditor * fEditor
void ChangeProperties(TGLabel *)
Edit properties via font selection dialog.
Bool_t HandleClientMessage(Event_t *)
Handle client message.
Bool_t IsEventsDisabled(TGWindow *f) const
void AddDialogMethods(TGPopupMenu *menu, TObject *object)
Add DIALOG entries to the selected frame popup menu.
Bool_t IsSelectedVisible()
Return kTRUE if grabbed/selected frame is not overlapped by other windows.
void DeletePropertyEditor()
Delete widget property editor.
static TGColorDialog * GetGlobalColorDialog(Bool_t create=kTRUE)
Return pointer to global color dialog.
TGCompositeFrame * FindLayoutFrame(TGFrame *f)
Helper to find a frame which can be laid out.
TGFrame * GetBtnEnableParent(TGFrame *fr)
Return a parent which can handle button events.
TGFrame * GetSelected() const
Return the current grabbed/selected frame.
void HandleUpdateSelected(TGFrame *)
When selected frame was changed by guibuilder editor -> update its appearance.
Bool_t IsGrabDisabled(TGWindow *f) const
void ChangeTextColor(TGGroupFrame *)
Change text color via color selection dialog.
The property editor.
Definition: TGuiBldEditor.h:32
A doubly linked list.
Definition: TList.h:38
Mother of all ROOT objects.
Definition: TObject.h:37
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition: TQObject.h:164
Recorder of operations for undo and redo.
Definition: TQCommand.h:103
Basic string class.
Definition: TString.h:136
Handles synchronous and a-synchronous timer events.
Definition: TTimer.h:51
TGFrame * fTarget
drop target
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17
void forward(const LAYERDATA &prevLayerData, LAYERDATA &currLayerData)
apply the weights (and functions) in forward direction of the DNN
Definition: NeuralNet.icc:546
Definition: file.py:1
Event structure.
Definition: GuiTypes.h:174