]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/XFormsToolbar.h
* Positionable and dynamically visible toolbars for the XForms frontend.
[lyx.git] / src / frontends / xforms / XFormsToolbar.h
1 // -*- C++ -*-
2 /**
3  * \file XFormsToolbar.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Lars Gullik Bjønnes
8  * \author Jean-Marc Lasgouttes
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef XFORMSTOOLBAR_H
14 #define XFROMSTOOLBAR_H
15
16 #include "LayoutEngine.h"
17 #include "XFormsView.h"
18
19 #include "frontends/Toolbars.h"
20
21 #include <boost/scoped_ptr.hpp>
22 #include <vector>
23
24
25 class XFormsToolbar;
26 class XFormsView;
27 class Tooltips;
28
29
30 class XLayoutBox: public LayoutBox {
31 public:
32         XLayoutBox(LyXView & owner, XFormsToolbar & toolbar);
33
34         /// select the right layout in the combox.
35         void set(std::string const & layout);
36         /// Populate the layout combox.
37         void update();
38         /// Erase the layout list.
39         void clear();
40         /// Display the layout list.
41         void open();
42         ///
43         void setEnabled(bool);
44         ///
45         void selected();
46
47 private:
48
49         FL_OBJECT * combox_;
50         LyXView & owner_;
51 };
52
53
54
55 /** The LyX xforms toolbar class
56  */
57 class XFormsToolbar : public Toolbar {
58         friend class XLayoutBox;
59
60 public:
61         XFormsToolbar(ToolbarBackend::Toolbar const & tbb, LyXView & o);
62         ~XFormsToolbar();
63
64         void add(FuncRequest const & func, std::string const & tooltip);
65         void hide(bool);
66         void show(bool);
67         void update();
68         LayoutBox * layout() const { return layout_.get(); }
69
70         /// an item on the toolbar
71         struct toolbarItem
72         {
73                 toolbarItem();
74
75                 ~toolbarItem();
76
77                 toolbarItem & operator=(toolbarItem const & ti);
78
79                 /// deallocate icon
80                 void kill_icon();
81
82                 /// lyx action
83                 FuncRequest func;
84                 /// icon for this item
85                 FL_OBJECT * icon;
86         };
87
88         ///
89         XFormsView::Position position_;
90         ///
91         lyx::frontend::Box * toolbar_;
92         ///
93         lyx::frontend::BoxList * toolbar_buttons_;
94         ///
95         lyx::frontend::WidgetMap widgets_;
96
97         typedef std::vector<FuncRequest> Funcs;
98
99         Funcs funcs;
100
101         typedef std::vector<toolbarItem> ToolbarList;
102
103         /// The list containing all the buttons
104         ToolbarList toollist_;
105         /// owning view
106         XFormsView & owner_;
107         /// tooltips manager
108         boost::scoped_ptr<Tooltips> tooltip_;
109         /// layout combo
110         boost::scoped_ptr<XLayoutBox> layout_;
111 };
112
113 #endif