User Interface Developments in ROOT Ilka Antcheva on
- Slides: 23
User Interface Developments in ROOT Ilka Antcheva on behalf of ROOT GUI Work Package LCG AA Meeting 26 April 2006
Overview • Basic Features • Widgets • Signals/Slots • C++ Code Generation • Applications • Canvas Interface • Object Browser • GUI Builder • ROOT and Qt • Conclusions Ilka Antcheva LCG AA Meeting 26 April 2006 2
Basic Features (1) • Cross-platform GUIs – consistent look everywhere • All machine dependent low graphics calls are abstracted via TVirtual. X • The GUI class library contains a rich and complete set of widgets and layout managers and supports both: • Conventional model of event processing • Signals/Slots communication mechanism, integrated into ROOT core by TQObject, TQConnection, TQClass. It uses dictionary information and the CINT interpreter to connect signal methods to slot methods • Important classes: • TGClient – sets up the graphics system • TGResource. Pool – global resource manager Ilka Antcheva LCG AA Meeting 26 April 2006 3
Basic Features (2) • Base classes • • TGObject – window identifier; connection to the graphics system TGWidget – important for event processing TGWindow – creates a new window with common characteristics TGFrame – base class for simple widgets TGComposite. Frame – base container class TGMain. Frame – main application window interacting with the system WM TGTransient. Frame – transient window, typically used for dialogs • GUI widgets • Buttons: text, picture, check, radio • Menus: menu bar, menu title, popup menu, cascaded menus • Containers: combo and list boxes, tabs, shutters, tool bar, dockable frames, MDI classes • Text widgets: label, text entry, number entry, text edit, tool tip • Color: color selector, color dialog, palette • Whiteboard: canvas (container & view port), list tree • Miscellaneous: slider, splitter, scroll bar, status bar, progress bar, 3 Dlines, etc. Ilka Antcheva LCG AA Meeting 26 April 2006 4
Basic Features (3) • Fast GUI prototyping thanks to the CINT – command script interpreter supporting pure C++ code: • From simple sequence of statements to complex class and method definitions • No need for special preprocessors or compilation // // f. Text = new TGText. Entry(f. Main, new TGText. Buffer(100)); f. Text->Set. Tool. Tip. Text("Enter the label and hit Enter key"); f. Text->Connect("Return. Pressed()", "My. Dialog", this, "Do. Setlabel()"); f. Main->Add. Frame(f. Text, new TGLayout. Hints(k. LHints. Top | k. LHints. Left, 5, 5)); f. Gframe = new TGGroup. Frame(f. Main, "Last File"); f. Label = new TGLabel(f. Gframe, "No Intut "); f. Gframe->Add. Frame(f. Label, new TGLayout. Hints(k. LHints. Top | k. LHints. Left, 5, 5)); f. Main->Add. Frame(f. Gframe, f. Text = new TGText. Entry(f. Gframe, new TGLayout. Hints(k. LHints. Expand. X, new TGText. Buffer(100)); 2, 2, 1, 1)); f. Text->Set. Tool. Tip. Text("Enter the label and hit Enter key"); f. Text->Connect("Return. Pressed()", "My. Dialog", this, "Do. Setlabel()"); f. Text->Resize(150, f. Text->Get. Default. Height()); f. Gframe->Add. Frame(f. Text, new TGLayout. Hints(k. LHints. Top | k. LHints. Left, 5, 5)); f. Main->Add. Frame(f. Gframe, new TGLayout. Hints(k. LHints. Expand. X, 2, 2, 1, 1)); root [0]. x my. Dialog. C root [1]. x my. Dialog. C … Ilka Antcheva LCG AA Meeting 26 April 2006 5
Basic Features (4) On interactions, widgets send out various signals (event senders) virtual void Pointer. Position. Changed() { Emit("Pointer. Position. Changed()"); } //*SIGNAL* Public object methods can be used as slots (event receivers) void My. Class: : Do. Slider() { // Slot method. Redraw the function in the canvas // window according to the slider pointer f. Func->Set. Parameters(sl->Get. Pointer. Position()); f. Func->Draw(); f. Canvas->Update(); } Signals and slots can be connected together sl->Connect("Position. Changed()", “My. Class", this, "Do. Slider()"); Ilka Antcheva LCG AA Meeting 26 April 2006 6
Basic Features (5) • Using Ctrl+S any GUI can be saved as a C++ macro via the Save. Primitive() methods • This macro can be edited and then can be interpreted or compiled via ACLi. C • Executing the macro restores the complete original GUI • Signal/slot connections are restored in a global way root [0]. x example. C // transient frame TGTransient. Frame *frame 2 = new TGTransient. Frame(g. Client->Get. Root(), 760, 590); // group frame TGGroup. Frame *frame 3 = new TGGroup. Frame(frame 2, "curve"); TGRadio. Button *frame 4 = new TGRadio. Button(frame 3, "gaus", 10); frame 3 ->Add. Frame(frame 4); Ilka Antcheva LCG AA Meeting 26 April 2006 7
Canvas Interface Toolbar • The dockable tool bar provides shortcuts for menu’s and buttons for primitive drawing • The Editor frame provides a GUI according to the selected objects in the canvas window Editor Frame Ilka Antcheva LCG AA Meeting 26 April 2006 8
Object Browser • Dynamic icon generation • Any executed C++ macro can be modified and re -executed • New toolbar buttons • history navigation • refreshing browser content • run/interrupt/save the executed macro Ilka Antcheva LCG AA Meeting 26 April 2006 9
GUI Builder (1) • First prototype by V. Onuchin took place in ROOT v 4. 02 (2004) • New design prototype (March 2006) is under development and validation Advantages: • GUI can be rapidly prototyped and implemented • Allows users to select from pre-defined sets of widgets, and place them on the working area • Drag-and-drop of already existing GUI elements between main frames, and after that modify them • Easy widget alignments • Easy layout settings • Easy attribute settings of widgets via context menus and property editors Ilka Antcheva LCG AA Meeting 26 April 2006 10
GUI Builder (2) • Save current design in a macro that can be edited and executed via the CINT interpreter: root [0]. x example. C root [1]. x example. C++ • The design process can start from a macro Prototypes related to the new Fit Panel Ilka Antcheva LCG AA Meeting 26 April 2006 11
ROOT and Qt (1) Qt BNL • Qt GSI by Valeri Fine [fine@bnl. gov] • by M. Al-Turani [m. al-turany@gsi. de] D. Bertini [d. bertini@gsi. de] • • Announced in ACAT 2002 In ROOT CVS since July 2004 SLOC ~12 500 Standard ROOT “plug-in” shared library, allows to be turned ON at run time if. rootrc setings are Gui. Backend qt Gui. Factory qt • Uses Qt v. 3 • Planned support of Qt v. 4 Ilka Antcheva • Works since 2001 on Linux • In ROOT CVS in April 2006 • SLOC ~2100 • How it works is explained in details at http: //root. cern. ch/root/Version 511. news. html • Uses Qt v. 3 • Planned native Qt v. 4 support LCG AA Meeting 26 April 2006 12
ROOT and Qt (2) Qt BNL • Uses Qt as a render engine for all ROOT graphics (GUI and Canvas) via TGQt (a Qt-based implementation of TVirtual. X) • ROOT Canvases can be embedded in Qt widgets and can be used with other Qt-based components and Qt-based 3 rd part libraries Ilka Antcheva LCG AA Meeting 26 April 2006 13
ROOT and Qt (3) Qt GSI • Lightweight interface that uses the Qt event loop to drive Qt widgets and the ROOT event loop to handle all ROOT events: GUI, timers, signals, etc. • Qt widgets are rendered via Qt, ROOT widgets are rendered either via TGX 11 or TGWin 32 GDK • ROOT Canvases can be embedded in Qt widgets For more information on Qt GSI, see ROOT v 5. 11/02 release notes at http: //root. cern. ch/root/Version 511. news. html Ilka Antcheva LCG AA Meeting 26 April 2006 14
Conclusions • The ROOT GUI is a rich and powerful scriptable cross-platform user interface library • It provides a solid basis for the development of many additional widgets and GUI components, like a Fit Panel, Help browser, object editors and event displays • The GUI builder will make the task of designing user interfaces much easier • The different ROOT/Qt integration interfaces give Qt users easy access to the ROOT graphics. Ilka Antcheva LCG AA Meeting 26 April 2006 15
Embedding ROOT TCanvas in any non “Root GUI” Application/Toolkit Bertrand Bellenot LCG AA Meeting 26 April 2006
Features • Allows to embed a TCanvas into any external application or any toolkit, using only a few lines of code, as soon as it is possible to: • Obtain a Window ID (XID on X 11, HWND on Win 32). • Create a timer to handle Root events. • Forward (i. e. mouse) events to the Canvas Bertrand Bellenot LCG AA Meeting 26 April 2006 2
How it Works • In the application constructor or in main(), create a TApplication: g. My. Root. App = new TApplication("My ROOT Application", &argc, argv); g. My. Root. App->Set. Return. From. Run(true); • Create a timer to process Root events : void My. Window: : On. Refresh. Timer() { g. Application->Start. Idleing(); g. System->Inner. Loop(); g. Application->Stop. Idleing(); } • Get the id of the window where you want to embed the TCanvas: void My. Window: : Create() { int wid = g. Virtual. X->Add. Window((ULong_t)getid(), get. Width(), get. Height()); f. Canvas = new TCanvas("f. Canvas", get. Width(), get. Height(), wid); } • Forward messages to the Canvas. i. e: void My. Window: : On. Paint() { if (f. Canvas) f. Canvas->Update(); } void My. Window: : On. LMouse. Down() { if (f. Canvas) f. Canvas->Handle. Input(k. Button 1 Down, ev->x, ev->y); } Bertrand Bellenot LCG AA Meeting 26 April 2006 3
Example with MFC (1) • Application and Timer Creation: CMFCRoot. App: : CMFCRoot. App() { int argc = 1; char *argv[] = { "MFCRoot. App. exe", NULL }; g. MFCRoot. App = new TApplication("MFC ROOT Application", & argc, argv); g. MFCRoot. App->Set. Return. From. Run(true); } VOID CALLBACK My. Timer. Proc(HWND hwnd, UINT message, UINT id. Timer, DWORD dw. Time) { g. Application->Start. Idleing(); g. System->Inner. Loop(); g. Application->Stop. Idleing(); } int CMain. Frame: : On. Create(LPCREATESTRUCT lp. Create. Struct) { if (CMDIFrame. Wnd: : On. Create(lp. Create. Struct) == -1) return -1; … Set. Timer(1, 20, (TIMERPROC) My. Timer. Proc); // timer callback return 0; } Bertrand Bellenot LCG AA Meeting 26 April 2006 4
Example with MFC (2) • Canvas creation and event forwarding: void CChild. View: : On. Paint() { CPaint. DC dc(this); // device context for painting RECT rect; if (f. Canvas == 0) { Get. Window. Rect(&rect); int width = rect. right-rect. left; int height = rect. bottom-rect. top; int wid = g. Virtual. X->Add. Window((ULong_t)m_h. Wnd, width, height); f. Canvas = new TCanvas("f. Canvas", width, height, wid); } else f. Canvas->Update(); } void CChild. View: : On. LButton. Up(UINT n. Flags, CPoint point) { if (f. Canvas) f. Canvas->Handle. Input(k. Button 1 Up, point. x, point. y); CWnd: : On. LButton. Up(n. Flags, point); } Bertrand Bellenot LCG AA Meeting 26 April 2006 5
Example of Qt. GSI Main File Qt. GSI main(): Standard Qt main(): #include "TQt. Application. h" #include "TQt. Root. Application. h" #include "My. Widget 1. h" #include "QApplication. h" #include "My. Widget 1. h" int main( int argc, char ** argv ) { TQRoot. Application a( argc, argv, 0); TQApplication app("uno", &argc, argv); My. Widget 1 *w = new Mywidget 1; w->show(); a. connect(&a, SIGNAL(last. Window. Closed()), &a, SLOT( quit() ) ); return a. exec(); } int main( int argc, char ** argv ) { QApplication a(argc, argv); My. Widget 1 *w = new Mywidget 1; w->show(); a. connect(&a, SIGNAL(last. Window. Closed()), &a, SLOT( quit() ) ); return a. exec(); } Where in blue are the differences to a standard Qt main file More information on Qt. GSI implementation, see ROOT v 5. 11/02 release notes : http: //root. cern. ch/root/Version 511. news. html Bertrand Bellenot LCG AA Meeting 26 April 2006 6
ROOT and PVSS ROOT & PVSS Screenshot (in collaboration with Piotr Golonka) Bertrand Bellenot LCG AA Meeting 26 April 2006
Screenshots Bertrand Bellenot LCG AA Meeting 26 April 2006 7
- Lesbische liefde
- Ilka meisel
- Ilka willand
- An interface
- Interface in interface java
- Areas of the screen that behave as if they were independent
- Industrial interfaces
- Interface structure design
- User interface theory
- Interface analysis means understanding
- Frontend user interface
- User interface toolkit
- User interface solutions
- Komponen user interface
- User interface design cycle
- User interface instagram
- Labview user interface design examples
- Character user interface
- Task centered user interface design
- Java graphical user interface
- Advantages and disadvantages of menu driven interface
- Web based interface
- Characteristics of graphical user interface
- Characteristics of gui