From d7044d310387d3752774831c1a8a768c0ca1ed67 Mon Sep 17 00:00:00 2001 From: deva Date: Tue, 29 Mar 2011 10:04:47 +0000 Subject: Examples in docs. --- client/widgets/altcombobox.h | 4 ++-- client/widgets/combobox.h | 2 +- client/widgets/lineedit.h | 23 +++++++++++++++++++++-- client/widgets/metawidget.h | 7 +++++++ client/widgets/widget.h | 5 +++-- 5 files changed, 34 insertions(+), 7 deletions(-) (limited to 'client/widgets') diff --git a/client/widgets/altcombobox.h b/client/widgets/altcombobox.h index 93ae124..ccc81cd 100644 --- a/client/widgets/altcombobox.h +++ b/client/widgets/altcombobox.h @@ -42,8 +42,8 @@ * @screenshot * The AltComboBox is used to make a normal selection with a ComboBox but with * a special list item that shows an alternate widget and uses this widget for - * input. The AltComboBox contains >item< tags in the same - * way as the ComboBox, but may also contain an >altitem< tag + * input. The AltComboBox contains <item> tags in the same + * way as the ComboBox, but may also contain an <altitem> tag * which can again contain widgets. * @att value [altitem] The value of the item. This will be the value of the * AltComboBox if this item is selected. diff --git a/client/widgets/combobox.h b/client/widgets/combobox.h index 8a8fbd3..92a0e39 100644 --- a/client/widgets/combobox.h +++ b/client/widgets/combobox.h @@ -38,7 +38,7 @@ * @extends widget * @screenshot * The ComboBox is used to make a selection from a list of items. - * The ComboBox contains >item< tags each describing + * The ComboBox contains <item> tags each describing * an entry in the selection list. * @att type The selection method of the ComboBox. Can be one 'select', where * the user can select items using either the mouse or the arrow keys, 'edit', diff --git a/client/widgets/lineedit.h b/client/widgets/lineedit.h index 650924c..e76fe74 100644 --- a/client/widgets/lineedit.h +++ b/client/widgets/lineedit.h @@ -37,6 +37,11 @@ * @extends widget * @screenshot * The lineedit is a single line textual input field. + * @example Simple example of usage: + * + * @example A more advanced example: + * * @att readonly Make the lineedit readonly (not changeable by the user), but * still able to select and copy text. */ @@ -77,18 +82,31 @@ private: /*** * @method nil clearSuggestions() * This method clears the suggestion list. + * For an example see @see showSuggestions(). */ int lin_clear_suggestions(lua_State *L); /*** * @method nil showSuggestions() * This method forces showing of the suggestion list. + * @example Example of suggestion usage: + * function myOnChange() + * if(isSuggested(this:value()) == false) + * then + * this:clearSuggestions() + * this:addSuggestion(this:value() .. 'abc') + * this:addSuggestion(this:value() .. 'abd') + * this:addSuggestion(this:value() .. 'acd') + * this:showSuggestions() + * end + * end */ int lin_show_suggestions(lua_State *L); /*** - * @method boolean isSuggested(string value, boolean joker) + * @method boolean isSuggested(string value) * This method makes a lookup in the suggestion list, searching for value. + * For an example see @see showSuggestions(). * @param value A string containing the text to look for in the suggestion list. * @return a boolean with the value true if the string was found, false * if not. @@ -99,7 +117,8 @@ int lin_is_suggested(lua_State *L); * @method nil addSuggestion(string suggestion) * Adds a suggestion to the suggestion list. The list is popped up each time * a character is entered into the lineedit by the user, or it is explicitly - * opened by calling @ref showSuggestions(). + * opened by calling @see showSuggestions(). + * For an example see @see showSuggestions(). * @param suggestion A string containing the value to be added to the * suggestion list. */ diff --git a/client/widgets/metawidget.h b/client/widgets/metawidget.h index ef3f198..ac18b91 100644 --- a/client/widgets/metawidget.h +++ b/client/widgets/metawidget.h @@ -42,6 +42,13 @@ * This widget is simply a caotainer compositing its value from the widgets * within it. The value of the widget cannot be set and its value attribute is * therefore ignored. + * @example An example of how to use metawidget with two inner widgets: + * + * + * + * * @att layout the layout of the widget. Can be one of 'vbox' or 'hbox'. * @att storechildren This attribute indicates wether the child widgets should * be stored on macro commit. It can be either 'true' or 'false'. diff --git a/client/widgets/widget.h b/client/widgets/widget.h index ef23294..bb37c51 100644 --- a/client/widgets/widget.h +++ b/client/widgets/widget.h @@ -215,7 +215,8 @@ int wdg_set_visible(lua_State *L); /*** * @method boolean valid() - * This method is used to get the current validity state of the widget. + * This method is used to get the current validity state of the widget. See + * also @see setValid(). * @return a boolean value. If the widget is valid the method returns true * otherwise it returns false. */ @@ -225,7 +226,7 @@ int wdg_valid(lua_State *L); * @method nil setValid(boolean valid) * This method is used to set the widgets validity state. Most widgets have a * visual indication of their validity state (a red background colour for - * example) and this will also be set using this method. + * example) and this will also be set using this method. See also @see valid(). * NOTE: An invalid widget that are not an inner widget will block a * server commit. * @param valid A boolean value. If true the widgets validity state is set to -- cgit v1.2.3