Create » History » Version 6
  iri, 02/22/2011 12:33 PM 
  
| 1 | 1 | iri | h1. Create a button | 
|---|---|---|---|
| 2 | |||
| 3 | * _gtkButtonNew : | ||
| 4 | > Create a button. | ||
| 5 | > Differents styles are available : | ||
| 6 | |||
| 7 | > * Classic (flag = SCOL_GTK_BUTTON_LABEL) | ||
| 8 | !http://library.gnome.org/devel/gtk/unstable/button.png! | ||
| 9 | > * With Mnemonic (like a keybord shortcut) (flag = SCOL_GTK_BUTTON_MNEMONIC) | ||
| 10 | !http://library.gnome.org/devel/gtk/unstable/button.png! | ||
| 11 | > * With a stock item (standard icon like "open", "exit", "copy", ...) (flag = SCOL_GTK_BUTTON_STOCKITEM) | ||
| 12 | |||
| 13 | > * With a link (uri) (flag = SCOL_GTK_BUTTON_LINK) | ||
| 14 | !http://library.gnome.org/devel/gtk/unstable/link-button.png! | ||
| 15 | > * A check box (with a short label) (flag = SCOL_GTK_BUTTON_CHECK) | ||
| 16 | !http://library.gnome.org/devel/gtk/unstable/check-button.png! | ||
| 17 | > * With a toggle state (flag = SCOL_GTK_BUTTON_TOGGLE) | ||
| 18 | !http://library.gnome.org/devel/gtk/unstable/toggle-button.png! | ||
| 19 | > * With a switch (flag = SCOL_GTK_BUTTON_SWITCH) | ||
| 20 | !http://library.gnome.org/devel/gtk/unstable/switch.png! | ||
| 21 | > * An empty button (flag = SCOL_GTK_BUTTON_EMPTY) : can add a valid widget, like an image widget, etc ... | ||
| 22 | |||
| 23 | > h3. Prototype : | ||
| 24 | >> fun [Chn S I u0] ObjGtkWidget | ||
| 25 | |||
| 26 | >> * Channel : Chn | ||
| 27 | >>> any channel | ||
| 28 | |||
| 29 | >> * Label : S | ||
| 30 | 2 | iri | >>> Can be any label (with SCOL_GTK_BUTTON_LABEL, SCOL_GTK_BUTTON_TOGGLE, SCOL_GTK_BUTTON_SWITCH) | 
| 31 | |||
| 32 | 1 | iri | >>> a mnemonic label (with SCOL_GTK_BUTTON_MNEMONIC) | 
| 33 | 2 | iri | |
| 34 | 1 | iri | >>> or a stock item name (with SCOL_GTK_BUTTON_STOCKITEM). | 
| 35 | 2 | iri | |
| 36 | 1 | iri | >>> Should be nil with SCOL_GTK_BUTTON_EMPTY. | 
| 37 | |||
| 38 | >> * flag : I | ||
| 39 | >>> SCOL_GTK_BUTTON_EMPTY : empty button. Cf 'param'. | ||
| 40 | 2 | iri | |
| 41 | 1 | iri | >>> SCOL_GTK_BUTTON_LABEL : classical button with the label 'label'. | 
| 42 | 2 | iri | |
| 43 | 1 | iri | >>> SCOL_GTK_BUTTON_MNEMONIC : a button with a mnemonic (can be activate with ALT + key). | 
| 44 | 2 | iri | |
| 45 | 1 | iri | >>> SCOL_GTK_BUTTON_STOCKITEM : a button with a standard stock item. | 
| 46 | 2 | iri | |
| 47 | 1 | iri | >>> SCOL_GTK_BUTTON_LINK : button with a link (uri). | 
| 48 | 2 | iri | |
| 49 | 1 | iri | >>> SCOL_GTK_BUTTON_CHECK : check button (with mnemonic) with a short label | 
| 50 | 2 | iri | |
| 51 | 1 | iri | >>> SCOL_GTK_BUTTON_TOGGLE : toggle button | 
| 52 | 2 | iri | |
| 53 | 6 | iri | >>> SCOL_GTK_BUTTON_SWITCH : switch button. GTK+ 3.0 or + is needed. Otherwise, a toggled button will be created. | 
| 54 | 1 | iri | |
| 55 | >> * param : u0 | ||
| 56 | >>> A supplemental parameter if flag need | ||
| 57 | 2 | iri | |
| 58 | 1 | iri | >>> ObjGtkWidget : child. If Type is SCOL_GTK_BUTTON_EMPTY only , child will be displayed into the new button. | 
| 59 | 2 | iri | |
| 60 | 1 | iri | >>> S : url if type set to SCOL_GTK_BUTTON_LINK only | 
| 61 | 2 | iri | |
| 62 | 1 | iri | >>> I : active (1), inactive (0) if flag is SCOL_GTK_BUTTON_CHECK, SCOL_GTK_BUTTON_TOGGLE or SCOL_GTK_BUTTON_SWITCH | 
| 63 | 2 | iri | |
| 64 | 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. | 
| 65 | 2 | iri | |
| 66 | 4 | iri | >> +Return+ : ObjGtkWidget | 
| 67 | |||
| 68 | 5 | iri | >>> The new Scol button object or nil if error | 
| 69 | 4 | iri | |
| 70 | 2 | iri | Return [[Buttons]] |