Create » History » Version 8
iri, 02/22/2011 03:31 PM
1 | 1 | iri | h1. Create a button |
---|---|---|---|
2 | |||
3 | 7 | iri | h2. _gtkButtonNew : |
4 | 8 | iri | Create a button. |
5 | One function to create these buttons : |
||
6 | |||
7 | 1 | iri | |
8 | > * Classic (flag = SCOL_GTK_BUTTON_LABEL) |
||
9 | !http://library.gnome.org/devel/gtk/unstable/button.png! |
||
10 | > * With Mnemonic (like a keybord shortcut) (flag = SCOL_GTK_BUTTON_MNEMONIC) |
||
11 | !http://library.gnome.org/devel/gtk/unstable/button.png! |
||
12 | > * With a stock item (standard icon like "open", "exit", "copy", ...) (flag = SCOL_GTK_BUTTON_STOCKITEM) |
||
13 | |||
14 | > * With a link (uri) (flag = SCOL_GTK_BUTTON_LINK) |
||
15 | !http://library.gnome.org/devel/gtk/unstable/link-button.png! |
||
16 | > * A check box (with a short label) (flag = SCOL_GTK_BUTTON_CHECK) |
||
17 | !http://library.gnome.org/devel/gtk/unstable/check-button.png! |
||
18 | > * With a toggle state (flag = SCOL_GTK_BUTTON_TOGGLE) |
||
19 | !http://library.gnome.org/devel/gtk/unstable/toggle-button.png! |
||
20 | > * With a switch (flag = SCOL_GTK_BUTTON_SWITCH) |
||
21 | !http://library.gnome.org/devel/gtk/unstable/switch.png! |
||
22 | 7 | iri | > * A radio button with label (flag = SCOL_GTK_BUTTON_RADIO) |
23 | !http://library.gnome.org/devel/gtk/unstable/radio-group.png! |
||
24 | 1 | iri | > * An empty button (flag = SCOL_GTK_BUTTON_EMPTY) : can add a valid widget, like an image widget, etc ... |
25 | |||
26 | > h3. Prototype : |
||
27 | >> fun [Chn S I u0] ObjGtkWidget |
||
28 | |||
29 | >> * Channel : Chn |
||
30 | >>> any channel |
||
31 | |||
32 | >> * Label : S |
||
33 | 2 | iri | >>> Can be any label (with SCOL_GTK_BUTTON_LABEL, SCOL_GTK_BUTTON_TOGGLE, SCOL_GTK_BUTTON_SWITCH) |
34 | |||
35 | 1 | iri | >>> a mnemonic label (with SCOL_GTK_BUTTON_MNEMONIC) |
36 | 2 | iri | |
37 | 1 | iri | >>> or a stock item name (with SCOL_GTK_BUTTON_STOCKITEM). |
38 | 2 | iri | |
39 | 1 | iri | >>> Should be nil with SCOL_GTK_BUTTON_EMPTY. |
40 | |||
41 | >> * flag : I |
||
42 | >>> SCOL_GTK_BUTTON_EMPTY : empty button. Cf 'param'. |
||
43 | 2 | iri | |
44 | 1 | iri | >>> SCOL_GTK_BUTTON_LABEL : classical button with the label 'label'. |
45 | 2 | iri | |
46 | 1 | iri | >>> SCOL_GTK_BUTTON_MNEMONIC : a button with a mnemonic (can be activate with ALT + key). |
47 | 2 | iri | |
48 | 1 | iri | >>> SCOL_GTK_BUTTON_STOCKITEM : a button with a standard stock item. |
49 | 2 | iri | |
50 | 1 | iri | >>> SCOL_GTK_BUTTON_LINK : button with a link (uri). |
51 | 2 | iri | |
52 | 1 | iri | >>> SCOL_GTK_BUTTON_CHECK : check button (with mnemonic) with a short label |
53 | 2 | iri | |
54 | 1 | iri | >>> SCOL_GTK_BUTTON_TOGGLE : toggle button |
55 | 2 | iri | |
56 | 6 | iri | >>> SCOL_GTK_BUTTON_SWITCH : switch button. GTK+ 3.0 or + is needed. Otherwise, a toggled button will be created. |
57 | 1 | iri | |
58 | 7 | iri | >>> SCOL_GTK_BUTTON_RADIO : a radio button. You can see [[Examples]] section for more details to include it |
59 | |||
60 | 1 | iri | >> * param : u0 |
61 | >>> A supplemental parameter if flag need |
||
62 | 2 | iri | |
63 | 1 | iri | >>> ObjGtkWidget : child. If Type is SCOL_GTK_BUTTON_EMPTY only , child will be displayed into the new button. |
64 | 2 | iri | |
65 | 1 | iri | >>> S : url if type set to SCOL_GTK_BUTTON_LINK only |
66 | 2 | iri | |
67 | 1 | iri | >>> I : active (1), inactive (0) if flag is SCOL_GTK_BUTTON_CHECK, SCOL_GTK_BUTTON_TOGGLE or SCOL_GTK_BUTTON_SWITCH |
68 | 7 | iri | |
69 | >>> [ObjGtkWidget I] : if the flag is SCOL_GTK_BUTTON_RADIO : object is the first button group (so, nil if it's the first !), the integer is the initial state (1 or 0). |
||
70 | 2 | iri | |
71 | 3 | iri | >>> *WARNING* : the type of the last argument is _u0_. Be careful : your type should be the good type (S if flag is SCOL_GTK_BUTTON_LINK by example). Otherwise, your application will compile but it will risk to crash to the running. |
72 | 2 | iri | |
73 | 4 | iri | >> +Return+ : ObjGtkWidget |
74 | |||
75 | 5 | iri | >>> The new Scol button object or nil if error |
76 | 4 | iri | |
77 | 2 | iri | Return [[Buttons]] |