vdk 2.4.0
toolbar.h
1 /*
2  * ===========================
3  * VDK Visual Development Kit
4  * Version 0.4
5  * October 1998
6  * ===========================
7  *
8  * Copyright (C) 1998, Mario Motta
9  * Developed by Mario Motta <mmotta@guest.net>
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Library General Public
13  * License as published by the Free Software Foundation; either
14  * version 2 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * Library General Public License for more details.
20  *
21  * You should have received a copy of the GNU Library General Public
22  * License along with this library; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
24  * 02111-1307, USA.
25  */
26 
27 #ifndef TOOLBAR_H
28 #define TOOLBAR_H
29 
30 
31 #include <vdk/vdkprops.h>
32 #include <vdk/widcontain.h>
33 #include <gtk/gtkenums.h>
34 
35 class VDKForm;
36 class VDKBox;
37 
38 
52 {
53 
54  static void ButtonSignal(GtkWidget *wid, gpointer gp);
55  ToolWidgetList toolWidgets;
56  GtkWidgetList widgets;
57  VDKList<VDKObject> tool_buttons;
58 
59 public:
60  // properties
64  VDKReadOnlyValueProp<VDKToolbar, ToolWidgetList*> WidgetList;
68  VDKReadOnlyValueProp<VDKToolbar, GtkWidgetList*> ButtonList;
72  VDKReadOnlyValueProp<VDKToolbar, int> ButtonPressed;
79  VDKReadWriteValueProp<VDKToolbar, GtkOrientation> Orientation;
87  VDKReadWriteValueProp<VDKToolbar, GtkToolbarStyle> Style;
94  VDKReadWriteValueProp<VDKToolbar, GtkToolbarSpaceStyle> SpaceStyle;
98  VDKReadWriteValueProp<VDKToolbar, bool> Borderless;
106  VDKReadWriteValueProp<VDKToolbar, GtkReliefStyle> Relief;
110  VDKReadWriteValueProp<VDKToolbar, int> Spacing;
111  //
117  VDKToolbar(VDKForm* owner,
118  GtkOrientation orientation = GTK_ORIENTATION_HORIZONTAL);
122  virtual ~VDKToolbar() {}
128  virtual void Add(VDKObject* obj, int , int , int , int )
129  { AddWidget(obj); }
135  void AddWidget(VDKObject* widget, char* tip = NULL);
142  void AddButton(char** pixdata,
143  char* tip = NULL,
144  char* text = NULL);
151  void AddButton(char* pixfile,
152  char* tip = NULL,
153  char* text = NULL);
157  void AddSpace() {
158  gtk_toolbar_append_space(GTK_TOOLBAR(widget));
159  }
160 
161  void SetOrientation( GtkOrientation orientation) {
162  gtk_toolbar_set_orientation(GTK_TOOLBAR(widget),orientation);
163  }
164 
165  void SetStyle(GtkToolbarStyle style) {
166  gtk_toolbar_set_style(GTK_TOOLBAR(widget),style);
167  }
168  // DEPRECATED
169  void SetRelief(GtkReliefStyle style);
170  // DEPRECTAED
171  void SetBorderless(bool flag) {
172  if(!flag)
173  // gtk_toolbar_set_button_relief (GTK_TOOLBAR (widget), GTK_RELIEF_NORMAL);
174  SetRelief(GTK_RELIEF_NORMAL);
175  else
176  // gtk_toolbar_set_button_relief (GTK_TOOLBAR (widget), GTK_RELIEF_NONE);
177  SetRelief(GTK_RELIEF_NONE);
178  }
179  // DEPRECATED
180  void SetSpacing(int s) {
181  //gtk_toolbar_set_space_size(GTK_TOOLBAR(widget),s);
182  // gtk_object_set(GTK_OBJECT(widget), "space_size", s, NULL);
183  }
184 
185  // DEPRECATED
186  void SetSpaceStyle(GtkToolbarSpaceStyle style) {
187  // gtk_toolbar_set_space_style (GTK_TOOLBAR (widget), style);
188  // gtk_object_set(GTK_OBJECT(widget), "space_style", style, NULL);
189  }
190  // DEPRECATED
191  GtkToolbarSpaceStyle GetSpaceStyle() {
192  return (GtkToolbarSpaceStyle) 0; // return GTK_TOOLBAR(widget)->space_style;
193  }
194 
195  VDKObject* operator[](int ndx) {
196  if( (ndx >= 0) && (ndx < tool_buttons.size()) )
197  return tool_buttons[ndx];
198  else
199  return NULL;
200  }
201 };
202 
203 
204 #endif
205 
206 
207 
208 
209 
210 
211 
212 
213