Install ardour as a binary, a script and a set of shared
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / combo.h
1 // -*- c++ -*-
2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _GTKMM_COMBO_H
4 #define _GTKMM_COMBO_H
5
6 #include <glibmm.h>
7
8 /* $Id$ */
9
10 /* combo.h
11  * 
12  * Copyright (C) 1998-2002 The gtkmm Development Team
13  *
14  * This library is free software; you can redistribute it and/or
15  * modify it under the terms of the GNU Library General Public
16  * License as published by the Free Software Foundation; either
17  * version 2 of the License, or (at your option) any later version.
18  *
19  * This library is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
22  * Library General Public License for more details.
23  *
24  * You should have received a copy of the GNU Library General Public
25  * License along with this library; if not, write to the Free
26  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27  */
28
29 #include <glibmm/listhandle.h>
30 #include <glibmm/helperlist.h>
31 #include <gtkmm/box.h>
32 #include <gtkmm/button.h>
33 #include <gtkmm/entry.h>
34 #include <gtkmm/item.h>
35
36
37 #ifndef DOXYGEN_SHOULD_SKIP_THIS
38 typedef struct _GtkListItem GtkListItem;
39 typedef struct _GtkListItemClass GtkListItemClass;
40 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
41
42
43 namespace Gtk
44 { class ComboDropDownItem_Class; } // namespace Gtk
45 #ifndef DOXYGEN_SHOULD_SKIP_THIS
46 typedef struct _GtkList GtkList;
47 typedef struct _GtkListClass GtkListClass;
48 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
49
50
51 namespace Gtk
52 { class ComboDropDown_Class; } // namespace Gtk
53 #ifndef DOXYGEN_SHOULD_SKIP_THIS
54 typedef struct _GtkCombo GtkCombo;
55 typedef struct _GtkComboClass GtkComboClass;
56 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
57
58
59 namespace Gtk
60 { class Combo_Class; } // namespace Gtk
61 namespace Gtk
62 {
63
64
65 /** An item in a ComboDropDownList.
66  * 
67  * Items in a ComboDropDownList inherit Item. Two signals are added.
68  *
69  * @deprecated Use the ComboBox widget instead. 
70  */
71
72 class ComboDropDownItem : public Gtk::Item
73 {
74   public:
75 #ifndef DOXYGEN_SHOULD_SKIP_THIS
76   typedef ComboDropDownItem CppObjectType;
77   typedef ComboDropDownItem_Class CppClassType;
78   typedef GtkListItem BaseObjectType;
79   typedef GtkListItemClass BaseClassType;
80 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
81
82   virtual ~ComboDropDownItem();
83
84 #ifndef DOXYGEN_SHOULD_SKIP_THIS
85
86 private:
87   friend class ComboDropDownItem_Class;
88   static CppClassType combodropdownitem_class_;
89
90   // noncopyable
91   ComboDropDownItem(const ComboDropDownItem&);
92   ComboDropDownItem& operator=(const ComboDropDownItem&);
93
94 protected:
95   explicit ComboDropDownItem(const Glib::ConstructParams& construct_params);
96   explicit ComboDropDownItem(GtkListItem* castitem);
97
98 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
99
100 public:
101 #ifndef DOXYGEN_SHOULD_SKIP_THIS
102   static GType get_type()      G_GNUC_CONST;
103   static GType get_base_type() G_GNUC_CONST;
104 #endif
105
106   ///Provides access to the underlying C GtkObject.
107   GtkListItem*       gobj()       { return reinterpret_cast<GtkListItem*>(gobject_); }
108
109   ///Provides access to the underlying C GtkObject.
110   const GtkListItem* gobj() const { return reinterpret_cast<GtkListItem*>(gobject_); }
111
112
113 public:
114   //C++ methods used to invoke GTK+ virtual functions:
115
116 protected:
117   //GTK+ Virtual Functions (override these to change behaviour):
118
119   //Default Signal Handlers::
120   virtual void on_scroll_horizontal(ScrollType scroll_type, float position);
121   virtual void on_scroll_vertical(ScrollType scroll_type, float position);
122
123
124 private:
125
126   
127 public:
128   ComboDropDownItem();
129
130   
131   Glib::SignalProxy2< void,ScrollType,float > signal_scroll_horizontal();
132
133   
134   Glib::SignalProxy2< void,ScrollType,float > signal_scroll_vertical();
135
136
137 };
138
139
140 namespace ComboDropDown_Helpers
141 {
142
143 typedef Gtk::ComboDropDownItem Element;
144
145  
146 class ComboDropDownList : public Glib::HelperList< ComboDropDownItem, const Element, Glib::List_Cpp_Iterator<GtkListItem,ComboDropDownItem> >
147 {
148 public:
149   ComboDropDownList();
150   explicit ComboDropDownList(GtkList* gparent);
151   ComboDropDownList(const ComboDropDownList& src);
152   virtual ~ComboDropDownList() {}
153
154   ComboDropDownList& operator=(const ComboDropDownList& src);
155
156   typedef Glib::HelperList< ComboDropDownItem, const Element,  Glib::List_Cpp_Iterator<GtkListItem,ComboDropDownItem> > type_base;
157
158   GtkList* gparent();
159   const GtkList* gparent() const;
160
161   virtual GList*& glist() const;      // front of list
162
163   virtual void erase(iterator start, iterator stop);
164   virtual iterator erase(iterator);  //Implented as custom or by LIST_CONTAINER_REMOVE
165   virtual void remove(const_reference); //Implented as custom or by LIST_CONTAINER_REMOVE
166
167   /// This is order n. (use at own risk)
168   reference operator[](size_type l) const;
169
170 public:
171   iterator insert(iterator position, element_type& e); //custom-implemented.
172
173   template <class InputIterator>
174   inline void insert(iterator position, InputIterator first, InputIterator last)
175   {
176     for(;first != last; ++first)
177       position = insert(position, *first);
178   }
179
180  inline void push_front(element_type& e)
181     { insert(begin(), e); }
182   inline void push_back(element_type& e)
183     { insert(end(), e); }
184
185
186   iterator find(const_reference c);
187   iterator find(Widget&);
188
189   };
190
191
192 } /* namespace ComboDropDown_Helpers */
193
194
195 class Combo;
196
197 /** The dropdown list of a Combo.
198  * 
199  * A combo is a compound widget which crosses a text entry area and a pull
200  * down list. The dropdown list is implemented with the deprecated GtkList
201  * widget on the gtk+ side. ComboDropDown is a thin wrapper around GtkList
202  * containing just the functionality necessary for a Combo's list. To add
203  * and remove items use the STL-style interface that is accessible through
204  * ComboDropDown::children().
205  *
206  * @deprecated Use the ComboBox widget instead.
207  */
208
209 class ComboDropDown : public Gtk::Container
210 {
211   public:
212 #ifndef DOXYGEN_SHOULD_SKIP_THIS
213   typedef ComboDropDown CppObjectType;
214   typedef ComboDropDown_Class CppClassType;
215   typedef GtkList BaseObjectType;
216   typedef GtkListClass BaseClassType;
217 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
218
219   virtual ~ComboDropDown();
220
221 #ifndef DOXYGEN_SHOULD_SKIP_THIS
222
223 private:
224   friend class ComboDropDown_Class;
225   static CppClassType combodropdown_class_;
226
227   // noncopyable
228   ComboDropDown(const ComboDropDown&);
229   ComboDropDown& operator=(const ComboDropDown&);
230
231 protected:
232   explicit ComboDropDown(const Glib::ConstructParams& construct_params);
233   explicit ComboDropDown(GtkList* castitem);
234
235 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
236
237 public:
238 #ifndef DOXYGEN_SHOULD_SKIP_THIS
239   static GType get_type()      G_GNUC_CONST;
240   static GType get_base_type() G_GNUC_CONST;
241 #endif
242
243   ///Provides access to the underlying C GtkObject.
244   GtkList*       gobj()       { return reinterpret_cast<GtkList*>(gobject_); }
245
246   ///Provides access to the underlying C GtkObject.
247   const GtkList* gobj() const { return reinterpret_cast<GtkList*>(gobject_); }
248
249
250 public:
251   //C++ methods used to invoke GTK+ virtual functions:
252
253 protected:
254   //GTK+ Virtual Functions (override these to change behaviour):
255
256   //Default Signal Handlers::
257   virtual void on_select_child(Widget& item);
258   virtual void on_selection_changed();
259   virtual void on_unselect_child(Widget& item);
260
261
262 private:
263
264   
265 public:
266   typedef ComboDropDown_Helpers::ComboDropDownList ComboDropDownList;
267
268 protected:
269   ComboDropDown();
270   friend class Combo;
271 public:
272
273   
274   void scroll_horizontal(ScrollType scroll_type, float position);
275   
276   void scroll_vertical(ScrollType scroll_type, float position);
277
278   ComboDropDownList& children();
279   const ComboDropDownList& children() const;
280
281   
282   Glib::SignalProxy1< void,Widget& > signal_select_child();
283
284   
285   Glib::SignalProxy0< void > signal_selection_changed();
286
287   
288   Glib::SignalProxy1< void,Widget& > signal_unselect_child();
289
290
291 protected:
292 #ifndef DOXYGEN_SHOULD_SKIP_THIS
293   mutable ComboDropDownList children_proxy_;
294 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
295
296
297 };
298
299
300 class ScrolledWindow;
301 class Window;
302
303 /** A text entry field with a dropdown list.
304  * 
305  * A combo is a compound widget which crosses a text entry area and a pull
306  * down list.  It may allow text entry or it may just allow list
307  * values depending on the settings.
308  *
309  * Access members allow altering of the widget components.
310  *
311  * @deprecated Use the ComboBox widget instead.
312  */
313
314 class Combo : public HBox
315 {
316   public:
317 #ifndef DOXYGEN_SHOULD_SKIP_THIS
318   typedef Combo CppObjectType;
319   typedef Combo_Class CppClassType;
320   typedef GtkCombo BaseObjectType;
321   typedef GtkComboClass BaseClassType;
322 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
323
324   virtual ~Combo();
325
326 #ifndef DOXYGEN_SHOULD_SKIP_THIS
327
328 private:
329   friend class Combo_Class;
330   static CppClassType combo_class_;
331
332   // noncopyable
333   Combo(const Combo&);
334   Combo& operator=(const Combo&);
335
336 protected:
337   explicit Combo(const Glib::ConstructParams& construct_params);
338   explicit Combo(GtkCombo* castitem);
339
340 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
341
342 public:
343 #ifndef DOXYGEN_SHOULD_SKIP_THIS
344   static GType get_type()      G_GNUC_CONST;
345   static GType get_base_type() G_GNUC_CONST;
346 #endif
347
348   ///Provides access to the underlying C GtkObject.
349   GtkCombo*       gobj()       { return reinterpret_cast<GtkCombo*>(gobject_); }
350
351   ///Provides access to the underlying C GtkObject.
352   const GtkCombo* gobj() const { return reinterpret_cast<GtkCombo*>(gobject_); }
353
354
355 public:
356   //C++ methods used to invoke GTK+ virtual functions:
357
358 protected:
359   //GTK+ Virtual Functions (override these to change behaviour):
360
361   //Default Signal Handlers::
362
363
364 private:
365
366 public:
367
368   Combo();
369   
370
371   /** Allow direct text entry
372    * Whether the text in the entry must be or not be in the list.
373    *
374    * @param value Set to true if the value must be in list.
375    * @param empty Set to true if the text area is allowed to be empty.
376    */
377   
378   void set_value_in_list(bool value = true, bool empty = false);
379
380   /** Set arrows keys to change value
381    * Up and down will scroll through the list items.
382    * Useful when there is a small list of value that the
383    * list must have.
384    *
385    * @param arrows_on true indicates the arrow keys scroll.
386    */
387   
388   void set_use_arrows(bool arrows_on = true);
389
390   /** Set arrows keys to change if value not in list
391    * Up and down will scroll through the list items but only
392    * change the current value if the text does not match a list item..
393    * Useful when there is a small list of value that the
394    * list must have.
395    *
396    * @param arrows_always true indicates the value will change.
397    */
398   
399   void set_use_arrows_always(bool arrows_always = true);
400
401   /** Sets list case sensitive
402    * Determines if the list items and text comparisons for
403    * set_use_arrows_always() should be case sensitive.
404    */
405   
406   void set_case_sensitive(bool val = true);
407
408   /** Set the current entry Glib::ustring
409    * Call this function on an item if it isn't a label or you
410    * want it to have a different value to be displayed in the entry
411    */
412   
413   void set_item_string(Gtk::Item& item, const Glib::ustring& item_value);
414    void remove_item_string(Gtk::Item& item);
415
416   /// Insert a list of items.
417   
418   void set_popdown_strings(const Glib::ListHandle<Glib::ustring>& strings);
419
420   Glib::ListHandle<Glib::ustring> get_popdown_strings() const;
421
422   
423   void disable_activate();
424
425   Entry* get_entry();
426   const Entry* get_entry() const;
427   ComboDropDown* get_list();
428   const ComboDropDown* get_list() const;
429
430   /** Whether the arrow keys move through the list of items.
431    *
432    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
433    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
434    * the value of the property changes.
435    */
436   Glib::PropertyProxy<bool> property_enable_arrow_keys() ;
437
438 /** Whether the arrow keys move through the list of items.
439    *
440    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
441    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
442    * the value of the property changes.
443    */
444   Glib::PropertyProxy_ReadOnly<bool> property_enable_arrow_keys() const;
445
446   /** Obsolete property
447    *
448    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
449    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
450    * the value of the property changes.
451    */
452   Glib::PropertyProxy<bool> property_enable_arrows_always() ;
453
454 /** Obsolete property
455    *
456    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
457    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
458    * the value of the property changes.
459    */
460   Glib::PropertyProxy_ReadOnly<bool> property_enable_arrows_always() const;
461
462   /** Whether list item matching is case sensitive.
463    *
464    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
465    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
466    * the value of the property changes.
467    */
468   Glib::PropertyProxy<bool> property_case_sensitive() ;
469
470 /** Whether list item matching is case sensitive.
471    *
472    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
473    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
474    * the value of the property changes.
475    */
476   Glib::PropertyProxy_ReadOnly<bool> property_case_sensitive() const;
477
478   /** Whether an empty value may be entered in this field.
479    *
480    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
481    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
482    * the value of the property changes.
483    */
484   Glib::PropertyProxy<bool> property_allow_empty() ;
485
486 /** Whether an empty value may be entered in this field.
487    *
488    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
489    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
490    * the value of the property changes.
491    */
492   Glib::PropertyProxy_ReadOnly<bool> property_allow_empty() const;
493
494   /** Whether entered values must already be present in the list.
495    *
496    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
497    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
498    * the value of the property changes.
499    */
500   Glib::PropertyProxy<bool> property_value_in_list() ;
501
502 /** Whether entered values must already be present in the list.
503    *
504    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
505    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
506    * the value of the property changes.
507    */
508   Glib::PropertyProxy_ReadOnly<bool> property_value_in_list() const;
509
510
511 };
512
513
514 } /* namespace Gtk */
515
516
517 namespace Glib
518 {
519   /** @relates Gtk::ComboDropDownItem
520    * @param object The C instance
521    * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
522    * @result A C++ instance that wraps this C instance.
523    */
524   Gtk::ComboDropDownItem* wrap(GtkListItem* object, bool take_copy = false);
525 }
526 namespace Glib
527 {
528   /** @relates Gtk::ComboDropDown
529    * @param object The C instance
530    * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
531    * @result A C++ instance that wraps this C instance.
532    */
533   Gtk::ComboDropDown* wrap(GtkList* object, bool take_copy = false);
534 }
535 namespace Glib
536 {
537   /** @relates Gtk::Combo
538    * @param object The C instance
539    * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
540    * @result A C++ instance that wraps this C instance.
541    */
542   Gtk::Combo* wrap(GtkCombo* object, bool take_copy = false);
543 }
544 #endif /* _GTKMM_COMBO_H */
545