]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/XFormsToolbar.h
Visual feedback of inactive toolbar buttons.
[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                 void generateInactivePixmaps();
80
81                 /// deallocate icon
82                 void kill_icon();
83
84                 /// lyx action
85                 FuncRequest func;
86                 /// icon for this item
87                 FL_OBJECT * icon;
88                 ///
89                 Pixmap unused_pixmap;
90                 Pixmap active_pixmap;
91                 Pixmap active_mask;
92                 Pixmap inactive_pixmap;
93                 Pixmap inactive_mask;
94         };
95
96         ///
97         XFormsView::Position position_;
98         ///
99         lyx::frontend::Box * toolbar_;
100         ///
101         lyx::frontend::BoxList * toolbar_buttons_;
102         ///
103         lyx::frontend::WidgetMap widgets_;
104
105         typedef std::vector<FuncRequest> Funcs;
106
107         Funcs funcs;
108
109         typedef std::vector<toolbarItem> ToolbarList;
110
111         /// The list containing all the buttons
112         ToolbarList toollist_;
113         /// owning view
114         XFormsView & owner_;
115         /// tooltips manager
116         boost::scoped_ptr<Tooltips> tooltip_;
117         /// layout combo
118         boost::scoped_ptr<XLayoutBox> layout_;
119 };
120
121 #endif