]> git.lyx.org Git - lyx.git/blob - src/toolbar.h
Fix the line-delete-forward bug?
[lyx.git] / src / toolbar.h
1 // -*- C++ -*-
2 /* This file is part of
3  * ======================================================
4  * 
5  *           LyX, The Document Processor
6  *           Copyright 1995 Matthias Ettrich
7  *           Copyright 1995-2000 The LyX Team.
8  *
9  *           This file is Copyright 1996-2000
10  *           Lars Gullik Bjønnes
11  *
12  * ====================================================== */
13
14 #ifndef TOOLBAR_H
15 #define TOOLBAR_H
16
17 #ifdef __GNUG__
18 #pragma interface
19 #endif
20
21 #include FORMS_H_LOCATION
22 #include "lyxfunc.h"
23 #include "combox.h"
24
25 /** The LyX toolbar class
26   This class {\em is} the LyX toolbar, and is not likely to be enhanced
27   further until we begin the move to Qt. We will probably have to make our
28   own QToolBar, at least until Troll Tech makes theirs.
29   */
30 class Toolbar {
31 public:
32         ///
33         Toolbar(LyXView * o, int x, int y);
34
35         ///
36         ~Toolbar() {
37                 clean();
38         }
39         
40         ///
41         int get_toolbar_func(string const & func);
42         
43         /// The special toolbar actions
44         enum  TOOLBARITEMS {
45                 /// adds space between buttons in the toolbar
46                 TOOL_SEPARATOR = -1,
47                 /// a special combox insead of a button
48                 TOOL_LAYOUTS = -2,
49                 /// begin a new line of button (not working)
50                 TOOL_NEWLINE = -3
51         };
52
53         ///
54         Combox * combox;
55
56         /// (re)sets the toolbar
57         void set(bool doingmain = false);
58
59         /** this is to be the entry point to the toolbar
60           frame, where you can change the toolbar realtime. */
61         void edit();
62         /// add a new button to the toolbar.
63         void add(int , bool doclean = true);
64         /// name of func instead of kb_action
65         void add(string const & , bool doclean = true);
66         /// invokes the n'th icon in the toolbar
67         void push(int);
68         /// activates the toolbar
69         void activate();
70         /// deactivates the toolbar
71         void deactivate();
72
73         ///
74         static void ToolbarCB(FL_OBJECT *, long);
75
76 #if FL_REVISION < 89
77         ///
78         static void BubbleTimerCB(FL_OBJECT *, long);
79         ///
80         static int BubblePost(FL_OBJECT * ob, int event,
81                               FL_Coord mx, FL_Coord my, int key, void * xev);
82 #endif
83
84 private:
85         ///
86         struct toolbarItem
87         {
88                 ///
89                 toolbarItem * next;
90                 ///
91                 int action;
92                 ///
93                 string help;
94                 ///
95                 FL_OBJECT * icon;
96                 ///
97                 bool IsBitmap;
98                 ///
99                 char const ** pixmap;
100                 ///
101                 toolbarItem() {
102                         next = 0;
103                         action = LFUN_NOACTION;
104                         icon = 0;
105                         pixmap = 0;
106                         IsBitmap = false;
107                 }
108                 ///
109                 ~toolbarItem() {
110                         if (icon) {
111                                 fl_delete_object(icon);
112                                 fl_free_object(icon);
113                         }
114                 }
115                         
116         };
117
118         /// a list containing all the buttons
119         toolbarItem * toollist;
120         ///
121         LyXView * owner;
122 #if FL_REVISION < 89
123         ///
124         FL_OBJECT * bubble_timer;
125 #endif
126         /// Starting position
127         int sxpos, sypos;
128         ///
129         int xpos;
130         ///
131         int ypos;
132         ///
133         int buttonwidth;
134         ///
135         int height;
136         ///
137         int standardspacing;
138         ///
139         int sepspace;
140         ///
141         bool cleaned;
142
143         ///
144         char const ** getPixmap(kb_action, string const & arg = string());
145         /// removes all toolbar buttons from the toolbar.
146         void clean();
147
148         /** more...
149          */
150         void reset();// {
151 //              toollist = 0;
152 //              cleaned = false;
153 //              
154 //              lightReset();
155 //      }
156
157         /** more...
158          */
159         void lightReset() {
160                 standardspacing = 2; // the usual space between items
161                 sepspace = 6; // extra space
162                 xpos = sxpos - standardspacing;
163                 ypos = sypos;
164                 buttonwidth = 30; // the standard button width
165                 height = 30; // the height of all items in the toolbar
166         }
167 };
168 #endif