]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/XFormsToolbar.h
Change glob() API to accept a dir parameter.
[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 namespace lyx {
25 namespace frontend {
26
27 class Tooltips;
28 class XFormsToolbar;
29 class XFormsView;
30
31
32 class XLayoutBox: public LayoutBox {
33 public:
34         XLayoutBox(LyXView & owner, XFormsToolbar & toolbar);
35
36         /// select the right layout in the combox.
37         void set(std::string const & layout);
38         /// Populate the layout combox.
39         void update();
40         /// Erase the layout list.
41         void clear();
42         /// Display the layout list.
43         void open();
44         ///
45         void setEnabled(bool);
46         ///
47         void selected();
48
49 private:
50
51         FL_OBJECT * combox_;
52         LyXView & owner_;
53 };
54
55
56
57 /** The LyX xforms toolbar class
58  */
59 class XFormsToolbar : public Toolbar {
60         friend class XLayoutBox;
61
62 public:
63         XFormsToolbar(ToolbarBackend::Toolbar const & tbb, LyXView & o);
64         ~XFormsToolbar();
65
66         void add(FuncRequest const & func, std::string const & tooltip);
67         void hide(bool);
68         void show(bool);
69         void update();
70         LayoutBox * layout() const { return layout_.get(); }
71
72         /// an item on the toolbar
73         struct toolbarItem
74         {
75                 toolbarItem();
76
77                 ~toolbarItem();
78
79                 toolbarItem & operator=(toolbarItem const & ti);
80
81                 void generateInactivePixmaps();
82
83                 /// deallocate icon
84                 void kill_icon();
85
86                 /// lyx action
87                 FuncRequest func;
88                 /// icon for this item
89                 FL_OBJECT * icon;
90                 ///
91                 Pixmap unused_pixmap;
92                 Pixmap active_pixmap;
93                 Pixmap inactive_pixmap;
94                 Pixmap mask;
95         };
96
97         ///
98         XFormsView::Position position_;
99         ///
100         boost::shared_ptr<Box> toolbar_;
101         ///
102         BoxList * toolbar_buttons_;
103         ///
104         WidgetMap widgets_;
105
106         typedef std::vector<FuncRequest> Funcs;
107
108         Funcs funcs;
109
110         typedef std::vector<toolbarItem> ToolbarList;
111
112         /// The list containing all the buttons
113         ToolbarList toollist_;
114         /// owning view
115         XFormsView & owner_;
116         /// tooltips manager
117         boost::scoped_ptr<Tooltips> tooltip_;
118         /// layout combo
119         boost::scoped_ptr<XLayoutBox> layout_;
120 };
121
122 } // namespace frontend
123 } // namespace lyx
124
125 #endif