]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/combox.h
* Fix compilation with C89 compilers.
[lyx.git] / src / frontends / xforms / combox.h
1 /**
2  * \file combox.h
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Angus Leeming
7  *
8  * Full author contact details are available in file CREDITS
9  *
10  * A combination of two objects (a button and a browser) is encapsulated to
11  * get a combobox-like object.
12  */
13
14 #ifndef FL_COMBOX_H
15 #define FL_COMBOX_H
16
17 #if defined(__cplusplus)
18 extern "C"
19 {
20 #endif
21
22 /** This will eventually be moved into the enum of in-built widgets
23     in forms.h. */
24 enum {
25     FL_COMBOX = 200
26 };
27
28 /** The various types of combox. */
29 typedef enum {
30     FL_NORMAL_COMBOX,
31     FL_DROPLIST_COMBOX
32 } FL_COMBOX_TYPE;
33
34 /** How the browser should be displayed relative to the buttons. */
35 typedef enum {
36     FL_COMBOX_BELOW,
37     FL_COMBOX_ABOVE
38 } FL_COMBOX_POSITION;
39
40 /** A function to create a combox widget.
41  *  \param type is, as yet, unused. there is only one type of combox.
42  *  \param x, \param y: the x,y coordinates of the upper left hand corner
43  *  of the widget, relative to the parent form'd origin.
44  *  \param w, \param h: the widget's dimensions.
45  *  \param label: the widget's label as it appears on the GUI.
46  */
47 FL_EXPORT FL_OBJECT *
48 fl_create_combox(FL_COMBOX_TYPE type,
49                  FL_Coord x, FL_Coord y, FL_Coord w, FL_Coord h,
50                  char const * label);
51
52 /** A function to create a combox widget and add it to the parent form.
53  *  \see fl_create_combox() for an explanation of the argument list.
54  */
55 FL_EXPORT FL_OBJECT *
56 fl_add_combox(FL_COMBOX_TYPE type,
57               FL_Coord x, FL_Coord y, FL_Coord w, FL_Coord h,
58               char const * label);
59
60 /** The combox browser has a default height of 100 pixels. Adjust to suit. */
61 FL_EXPORT void fl_set_combox_browser_height(FL_OBJECT * ob, int bh);
62
63 /** The browser will be displayed either below or above the button,
64  *  dependent upon \param position.
65  */
66 FL_EXPORT void fl_set_combox_position(FL_OBJECT * ob, 
67                                       FL_COMBOX_POSITION position);
68
69 /** Empty the browser and the combox, \param ob. */
70 FL_EXPORT void fl_clear_combox(FL_OBJECT * ob);
71
72 /** Add a line to the combox browser.*/
73 FL_EXPORT void fl_addto_combox(FL_OBJECT * ob, char const * text);
74
75 /** Set the combox to return line \param choice of the combox browser. */
76 FL_EXPORT void fl_set_combox(FL_OBJECT * ob, int choice);
77
78 /** \return the currently selected line of the combox browser. */
79 FL_EXPORT int fl_get_combox(FL_OBJECT * ob);
80
81 /** \return the contents of the combox.
82  *  (Also the contents of currently selected line of the combox browser.)
83  */
84 FL_EXPORT char const * fl_get_combox_text(FL_OBJECT * ob);
85
86 /** \return the contents of \param line of the combox browser. */
87 FL_EXPORT char const * fl_get_combox_line(FL_OBJECT * ob, int line);
88
89 /** \return the number of items in the combox browser. */
90 FL_EXPORT int fl_get_combox_maxitems(FL_OBJECT * ob);
91
92 /** Show the browser */
93 void fl_show_combox_browser(FL_OBJECT * ob);
94
95 /** Hide the browser */
96 void fl_hide_combox_browser(FL_OBJECT * ob);
97
98 #if defined(__cplusplus)
99 }
100 #endif
101
102 #endif