From 9519c590114113c23e74c58f9a628d6b03ee6dff Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Wed, 22 Apr 2015 11:47:44 -0400 Subject: [PATCH] More documentation work. --- docs/uiButton.md | 6 ++--- docs/uiCheckbox.md | 55 ++++++++++++++++++++++++++++++++++++++++++++++ docs/uiEntry.md | 27 +++++++++++++++++++++++ docs/uiLabel.md | 27 +++++++++++++++++++++++ 4 files changed, 111 insertions(+), 4 deletions(-) create mode 100644 docs/uiCheckbox.md create mode 100644 docs/uiEntry.md create mode 100644 docs/uiLabel.md diff --git a/docs/uiButton.md b/docs/uiButton.md index dd8366b3..7a68dc23 100644 --- a/docs/uiButton.md +++ b/docs/uiButton.md @@ -9,11 +9,9 @@ Windows | Unix | OS X uiButton derives from [uiControl](uiControl.md). ## constructor NewButton() - ```c uiButton *uiNewButton(const char *text); ``` - Creates a new uiButton with the specifed text. ## func Text() @@ -32,9 +30,9 @@ Changes the text shown on the uiButton to the given text string. ```c void uiButtonOnClicked(uiButton *b, void (*handler)(void *sender, void *data), void *data); ``` -Sets the function that is called when the user clicks the uiButton. If a handler was previous assigned, this call replaces the old handler with the given one. +Sets the function that is called when the user clicks the uiButton. If a handler was previously assigned, this call replaces the old handler with the given one. -The `sender` argument to the callback is the `b` argument to `uiButtonOnClicked()`. It is of type `void *` to allow uiMenus to use the same callback functions. +The `sender` argument to the callback is the `b` argument to `uiButtonOnClicked()`. It is of type `void *` to allow uiMenuItems to use the same callback functions. The `data` argument to the callback is the `data` argument to `uiButtonOnClicked()`. diff --git a/docs/uiCheckbox.md b/docs/uiCheckbox.md new file mode 100644 index 00000000..b5f316c5 --- /dev/null +++ b/docs/uiCheckbox.md @@ -0,0 +1,55 @@ +# uiCheckbox + +uiCheckbox is a control which represents a box that can have a checkmark in it. + +Windows | Unix | OS X +-----|-----|----- +![Checkbox on Windows](images/uiCheckbox_windows.png)|![Checkbox on Unix](images/uiCheckbox_unix.png)|![Checkbox on OS X](images/uiChekbox_darwin.png) + +uiCheckbox derives from [uiControl](uiControl.md). + +## constructor NewCheckbox() +```c +uiCheckbox *uiNewCheckbox(const char *text); +``` +Creates a new uiCheckbox with the specifed text. + +## func Text() +```c +char *uiCheckboxText(uiCheckbox *c); +``` +Returns the text shown on the uiCheckbox. Free the returned string with `uiTextFree()`. + +## func SetText() +```c +void uiCheckboxSetText(uiCheckbox *c, const char *text); +``` +Changes the text shown on the uiCheckbox to the given text string. + +## func OnToggled() +```c +void uiCheckboxOnToggled(uiCheckbox *c, void (*handler)(void *sender, void *data), void *data); +``` +Sets the function that is called when the user changes the checked state of the uiCheckbox. If a handler was previously assigned, this call replaces the old handler with the given one. + +The `sender` argument to the callback is the `c` argument to `uiCheckboxOnToggled()`. It is of type `void *` to allow uiMenuItems to use the same callback functions. + +The `data` argument to the callback is the `data` argument to `uiCheckboxOnToggled()`. + +The default handler does nothing. + +TODO allow NULL to return to default? + +## func Checked() +```c +int uiCheckboxChecked(uiCheckbox *c); +``` +Returns nonzero if the given uiCheckbox is currently chcecked, and zero otherwise. + +## func SetChecked() +```c +void uiCheckboxSetChecked(uiCheckbox *c, int checked) +``` +Changes the checked state of the given uiCheckbox. If `checked` is nonzero, the checkbox is checked. If zero, the checkbox is unchecked. + +Calling `uiCheckboxSetChecked()` does NOT trigger the `OnToggled()` event. diff --git a/docs/uiEntry.md b/docs/uiEntry.md new file mode 100644 index 00000000..e70c1b35 --- /dev/null +++ b/docs/uiEntry.md @@ -0,0 +1,27 @@ +# uiEntry + +uiEntry is a control which represents an area where a user can enter a single line of text. + +Windows | Unix | OS X +-----|-----|----- +![Entry on Windows](images/uiEntry_windows.png)|![Entry on Unix](images/uiEntry_unix.png)|![Entry on OS X](images/uiEntry_darwin.png) + +uiEntry derives from [uiControl](uiControl.md). + +## constructor NewEntry() +```c +uiEntry *uiNewEntry(void); +``` +Creates a new uiEntry. + +## func Text() +```c +char *uiEntryText(uiEntry *e); +``` +Returns the text currently entered in the uiEntry. Free the returned string with `uiTextFree()`. + +## func SetText() +```c +void uiEntrySetText(uiEntry *e, const char *text); +``` +Changes the text currently entered in the uiEntry to the given text string. diff --git a/docs/uiLabel.md b/docs/uiLabel.md new file mode 100644 index 00000000..058f2ff5 --- /dev/null +++ b/docs/uiLabel.md @@ -0,0 +1,27 @@ +# uiLabel + +uiLabel is a control which represents a line of text that labels an element or area of a GUI. + +Windows | Unix | OS X +-----|-----|----- +![Label on Windows](images/uiLabel_windows.png)|![Label on Unix](images/uiLabel_unix.png)|![Label on OS X](images/uiLabel_darwin.png) + +uiLabel derives from [uiControl](uiControl.md). + +## constructor NewLabel() +```c +uiLabel *uiNewLabel(const char *text); +``` +Creates a new uiLabel with the specifed text. + +## func Text() +```c +char *uiLabelText(uiLabel *l); +``` +Returns the text shown on the uiLabel. Free the returned string with `uiTextFree()`. + +## func SetText() +```c +void uiLabelSetText(uiLabel *l, const char *text); +``` +Changes the text shown on the uiLabel to the given text string.