diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_File_Input.cxx | 45 | ||||
| -rw-r--r-- | src/Fl_Input.cxx | 4 | ||||
| -rw-r--r-- | src/Fl_Input_.cxx | 79 | ||||
| -rw-r--r-- | src/Fl_Menu_add.cxx | 20 |
4 files changed, 105 insertions, 43 deletions
diff --git a/src/Fl_File_Input.cxx b/src/Fl_File_Input.cxx index 45625b5ee..b49974c0f 100644 --- a/src/Fl_File_Input.cxx +++ b/src/Fl_File_Input.cxx @@ -48,10 +48,10 @@ #define FL_DAMAGE_BAR 0x10 -// -// 'Fl_File_Input::Fl_File_Input()' - Create a Fl_File_Input widget. -// - +/** + Creates a new Fl_File_Input widget using the given position, + size, and label string. The default boxtype is FL_DOWN_BOX. +*/ Fl_File_Input::Fl_File_Input(int X, int Y, int W, int H, const char *l) : Fl_Input(X, Y, W, H, l) { buttons_[0] = 0; @@ -62,12 +62,8 @@ Fl_File_Input::Fl_File_Input(int X, int Y, int W, int H, const char *l) down_box(FL_UP_BOX); } -// -// 'Fl_File_Input::draw_buttons()' - Draw directory buttons. -// - -void -Fl_File_Input::draw_buttons() { +/** Draw directory buttons. */ +void Fl_File_Input::draw_buttons() { int i, // Looping var X; // Current X position @@ -101,12 +97,8 @@ Fl_File_Input::draw_buttons() { } } -// -// 'Fl_File_Input::update_buttons()' - Update the sizes of the directory buttons. -// - -void -Fl_File_Input::update_buttons() { +/** Update the sizes of the directory buttons.*/ +void Fl_File_Input::update_buttons() { int i; // Looping var const char *start, // Start of path component *end; // End of path component @@ -141,9 +133,7 @@ Fl_File_Input::update_buttons() { // -// 'Fl_File_Input::value()' - Set the value of the widget... -// - +/** Sets the value of the widget given a new string value and its length, Returns non 0 on success */ int // O - TRUE on success Fl_File_Input::value(const char *str, // I - New string value int len) { // I - Length of value @@ -152,6 +142,7 @@ Fl_File_Input::value(const char *str, // I - New string value } +/** Sets the value of the widget given a new string value, Returns non 0 on success */ int // O - TRUE on success Fl_File_Input::value(const char *str) { // I - New string value damage(FL_DAMAGE_BAR); @@ -159,12 +150,8 @@ Fl_File_Input::value(const char *str) { // I - New string value } -// -// 'Fl_File_Input::draw()' - Draw the file input widget... -// - -void -Fl_File_Input::draw() { +/** Draws the file input widget */ +void Fl_File_Input::draw() { Fl_Boxtype b = box(); if (damage() & (FL_DAMAGE_BAR | FL_DAMAGE_ALL)) draw_buttons(); // this flag keeps Fl_Input_::drawtext from drawing a bogus box! @@ -178,10 +165,8 @@ Fl_File_Input::draw() { } -// -// 'Fl_File_Input::handle()' - Handle events in the widget... -// +/** Handle events in the widget, return non zero if event is handled */ int // O - TRUE if we handled event Fl_File_Input::handle(int event) // I - Event { @@ -215,10 +200,8 @@ Fl_File_Input::handle(int event) // I - Event } -// -// 'Fl_File_Input::handle_button()' - Handle button events in the widget... -// +/** Handles button events in the widget , return non zero if event is handled */ int // O - TRUE if we handled event Fl_File_Input::handle_button(int event) // I - Event { diff --git a/src/Fl_Input.cxx b/src/Fl_Input.cxx index ba10c0694..15eee0d14 100644 --- a/src/Fl_Input.cxx +++ b/src/Fl_Input.cxx @@ -465,6 +465,10 @@ int Fl_Input::handle(int event) { w()-Fl::box_dw(b), h()-Fl::box_dh(b)); } +/** + Creates a new Fl_Input widget using the given position, size, + and label string. The default boxtype is FL_DOWN_BOX. +*/ Fl_Input::Fl_Input(int X, int Y, int W, int H, const char *l) : Fl_Input_(X, Y, W, H, l) { } diff --git a/src/Fl_Input_.cxx b/src/Fl_Input_.cxx index ae4799e45..bebd08712 100644 --- a/src/Fl_Input_.cxx +++ b/src/Fl_Input_.cxx @@ -25,6 +25,14 @@ // http://www.fltk.org/str.php // +/** FIXME DOX: APIs not found + fn int Fl_Input_::wordboundary(int i) const + Returns true if position i is at the start or end of a word. + + fn int Fl_Input_::lineboundary(int i) const + Returns true if position i is at the start or end of a line. + +*/ // This is the base class for Fl_Input. You can use it directly // if you are one of those people who like to define their own // set of editing keys. It may also be useful for adding scrollbars @@ -165,6 +173,12 @@ void Fl_Input_::setfont() const { fl_font(textfont(), textsize()); } +/** + Draw the text in the passed bounding box. If damage() + & FL_DAMAGE_ALL is true, this assumes the area has + already been erased to color(). Otherwise it does + minimal update and erases the area itself. +*/ void Fl_Input_::drawtext(int X, int Y, int W, int H) { int do_mu = !(damage()&FL_DAMAGE_ALL); @@ -472,6 +486,7 @@ void Fl_Input_::handle_mouse(int X, int Y, int /*W*/, int /*H*/, int drag) { position(newpos, newmark); } +/** See int Fl_Input_::position() const */ int Fl_Input_::position(int p, int m) { int is_same = 0; was_up_down = 0; @@ -520,6 +535,12 @@ int Fl_Input_::position(int p, int m) { return 1; } +/** + Do the correct thing for arrow keys. Sets the position (and + mark if <I>keepmark</I> is zero) to somewhere in the same line + as <I>i</I>, such that pressing the arrows repeatedly will cause + the point to move up and down. +*/ int Fl_Input_::up_down_position(int i, int keepmark) { // unlike before, i must be at the start of the line already! @@ -539,6 +560,13 @@ int Fl_Input_::up_down_position(int i, int keepmark) { return j; } +/** + Put the current selection between mark() and + position() into the specified clipboard. Does not + replace the old clipboard contents if position() and + mark() are equal. Clipboard 0 maps to the current text + selection and clipboard 1 maps to the cut/paste clipboard. +*/ int Fl_Input_::copy(int clipboard) { int b = position(); int e = mark(); @@ -574,6 +602,29 @@ static void undobuffersize(int n) { } // all changes go through here, delete characters b-e and insert text: +/** + This call does all editing of the text. It deletes the region + between a and b (either one may be less or + equal to the other), and then inserts the string insert + at that point and leaves the mark() and + position() after the insertion. Does the callback if + when() & FL_WHEN_CHANGED and there is a change. + + <P>Set start and end equal to not delete + anything. Set insert to NULL to not insert + anything.</P> + + <P>length must be zero or strlen(insert), this + saves a tiny bit of time if you happen to already know the + length of the insertion, or can be used to insert a portion of a + string or a string containing nul's.</P> + + <P>a and b are clamped to the + 0..size() range, so it is safe to pass any values.</P> + + <P>cut() and insert() are just inline + functions that call replace(). +*/ int Fl_Input_::replace(int b, int e, const char* text, int ilen) { int ul, om, op; was_up_down = 0; @@ -669,6 +720,10 @@ int Fl_Input_::replace(int b, int e, const char* text, int ilen) { return 1; } +/** + Does undo of several previous calls to replace(). + Returns non-zero if any change was made. +*/ int Fl_Input_::undo() { was_up_down = 0; if (undowidget != this || !undocut && !undoinsert) return 0; @@ -709,6 +764,10 @@ int Fl_Input_::undo() { return 1; } +/** + Copy all the previous contiguous cuts from the undo + information to the clipboard. This is used to make ^K work. +*/ int Fl_Input_::copy_cuts() { // put the yank buffer into the X clipboard if (!yankcut || input_type()==FL_SECRET_INPUT) return 0; @@ -839,6 +898,11 @@ int Fl_Input_::handletext(int event, int X, int Y, int W, int H) { /*------------------------------*/ +/** + Creates a new Fl_Input_ widget using the given + position, size, and label string. The default boxtype is + FL_DOWN_BOX. +*/ Fl_Input_::Fl_Input_(int X, int Y, int W, int H, const char* l) : Fl_Widget(X, Y, W, H, l) { box(FL_DOWN_BOX); @@ -892,7 +956,7 @@ void Fl_Input_::put_in_buffer(int len) { memmove(buffer, value_, size_); buffer[size_] = 0; value_ = buffer; } - +/** See int Fl_Input::static_value(const char*) */ int Fl_Input_::static_value(const char* str, int len) { clear_changed(); if (undowidget == this) undowidget = 0; @@ -923,16 +987,27 @@ int Fl_Input_::static_value(const char* str, int len) { return 1; } +/** + Change the text and set the mark and the point to the end of + it. The string is <I>not</I> copied. If the user edits the + string it is copied to the internal buffer then. This can save a + great deal of time and memory if your program is rapidly + changing the values of text fields, but this will only work if + the passed string remains unchanged until either the + Fl_Input is destroyed or value() is called + again. +*/ int Fl_Input_::static_value(const char* str) { return static_value(str, str ? strlen(str) : 0); } - +/** See const char *Fl_Input_::value() const */ int Fl_Input_::value(const char* str, int len) { int r = static_value(str, len); if (len) put_in_buffer(len); return r; } +/** See const char *Fl_Input_::value() const */ int Fl_Input_::value(const char* str) { return value(str, str ? strlen(str) : 0); } diff --git a/src/Fl_Menu_add.cxx b/src/Fl_Menu_add.cxx index 7bc766948..1edb61394 100644 --- a/src/Fl_Menu_add.cxx +++ b/src/Fl_Menu_add.cxx @@ -175,6 +175,7 @@ int Fl_Menu_Item::add( if (array == local_array) local_array_size = msize; return m-array; } + /** Adds a new menu item, with a title string, shortcut int (or string), callback, argument to the callback, and flags. @@ -227,16 +228,7 @@ int Fl_Menu_Item::add( <P>No items must be added to a menu during a callback to the same menu.</P> - <h4>int Fl_Menu_::add(const char *)</H4> - - <P>The passed string is split at any '|' characters and then - add(s,0,0,0,0) is done with each section. This is - often useful if you are just using the value, and is compatible - with Forms and other GL programs. The section strings use the - same special characters as described for the long version of add()</p> - - <P>No items must be added to a menu during a callback to the same menu. -*/ + */ int Fl_Menu_::add(const char *t, int s, Fl_Callback *c,void *v,int f) { // make this widget own the local array: if (this != fl_menu_array_owner) { @@ -283,6 +275,14 @@ int Fl_Menu_::add(const char *t, int s, Fl_Callback *c,void *v,int f) { This is a Forms (and SGI GL library) compatible add function, it adds many menu items, with '|' seperating the menu items, and tab separating the menu item names from an optional shortcut string. + + The passed string is split at any '|' characters and then + add(s,0,0,0,0) is done with each section. This is + often useful if you are just using the value, and is compatible + with Forms and other GL programs. The section strings use the + same special characters as described for the long version of add()</p> + + <P>No items must be added to a menu during a callback to the same menu. */ int Fl_Menu_::add(const char *str) { char buf[1024]; |
