summaryrefslogtreecommitdiff
path: root/src/Fl_Menu_add.cxx
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2020-07-01 18:03:10 +0200
committerAlbrecht Schlosser <albrechts.fltk@online.de>2020-07-06 20:28:20 +0200
commitf09e17c3c564e8310125a10c03397cbf473ff643 (patch)
tree8d0fd4a28e3686c33aaa140d07ddba26ab28bdc2 /src/Fl_Menu_add.cxx
parentb0e0c355edaa2e23148cb0260ada907aec930f05 (diff)
Remove $Id$ tags, update URL's, and more
- remove obsolete svn '$Id$' tags from all source files - update .fl files and generated files accordingly - replace 'http://www.fltk.org' URL's with 'https://...' - replace bug report URL 'str.php' with 'bugs.php' - remove trailing whitespace - fix other whitespace errors flagged by Git - add and/or fix missing or wrong standard headers - convert tabs to spaces in all source files The only relevant code changes are in the fluid/ folder where some .fl files and other source files were used to generate the '$Id' headers and footers.
Diffstat (limited to 'src/Fl_Menu_add.cxx')
-rw-r--r--src/Fl_Menu_add.cxx126
1 files changed, 60 insertions, 66 deletions
diff --git a/src/Fl_Menu_add.cxx b/src/Fl_Menu_add.cxx
index b8954c9f0..9e0ba77e5 100644
--- a/src/Fl_Menu_add.cxx
+++ b/src/Fl_Menu_add.cxx
@@ -1,6 +1,4 @@
//
-// "$Id$"
-//
// Menu utilities for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2019 by Bill Spitzak and others.
@@ -9,11 +7,11 @@
// the file "COPYING" which should have been included with this file. If this
// file is missing or damaged, see the license at:
//
-// http://www.fltk.org/COPYING.php
+// https://www.fltk.org/COPYING.php
//
-// Please report all bugs and problems on the following page:
+// Please see the following page on how to report bugs and issues:
//
-// http://www.fltk.org/str.php
+// https://www.fltk.org/bugs.php
//
// Methods to alter the menu in an Fl_Menu_ widget.
@@ -70,7 +68,7 @@ static Fl_Menu_Item* array_insert(
m->user_data_ = 0;
m->flags = flags;
m->labeltype_ = m->labelsize_ = m->labelcolor_ = 0;
- m->labelfont_ = FL_HELVETICA;
+ m->labelfont_ = FL_HELVETICA;
return array;
}
@@ -105,31 +103,31 @@ static int compare(const char* a, const char* b) {
int Fl_Menu_Item::add(
const char *mytext,
int sc,
- Fl_Callback *cb,
+ Fl_Callback *cb,
void *data,
int myflags
) {
- return(insert(-1,mytext,sc,cb,data,myflags)); // -1: append
+ return(insert(-1,mytext,sc,cb,data,myflags)); // -1: append
}
-/**
+/**
Inserts an item at position \p index.
-
+
If \p index is -1, the item is added the same way as Fl_Menu_Item::add().
- If 'mytext' contains any un-escaped front slashes (/), it's assumed
- a menu pathname is being specified, and the value of \p index
+ If 'mytext' contains any un-escaped front slashes (/), it's assumed
+ a menu pathname is being specified, and the value of \p index
will be ignored.
In all other aspects, the behavior of insert() is the same as add().
-
- \param[in] index insert new items here
- \param[in] mytext new label string, details see above
- \param[in] sc keyboard shortcut for new item
- \param[in] cb callback function for new item
- \param[in] data user data for new item
- \param[in] myflags menu flags as described in FL_Menu_Item
+
+ \param[in] index insert new items here
+ \param[in] mytext new label string, details see above
+ \param[in] sc keyboard shortcut for new item
+ \param[in] cb callback function for new item
+ \param[in] data user data for new item
+ \param[in] myflags menu flags as described in FL_Menu_Item
\returns the index into the menu() array, where the entry was added
*/
@@ -137,7 +135,7 @@ int Fl_Menu_Item::insert(
int index,
const char *mytext,
int sc,
- Fl_Callback *cb,
+ Fl_Callback *cb,
void *data,
int myflags
) {
@@ -182,7 +180,7 @@ int Fl_Menu_Item::insert(
msize++;
m = array+n;
}
- m++; /* go into the submenu */
+ m++; /* go into the submenu */
flags1 = 0;
}
@@ -190,7 +188,7 @@ int Fl_Menu_Item::insert(
for (; m->text; m = m->next())
if (!(m->flags&FL_SUBMENU) && !compare(m->text,item)) break;
- if (!m->text) { /* add a new menu item */
+ if (!m->text) { /* add a new menu item */
int n = (index==-1) ? (int) (m-array) : index;
array = array_insert(array, msize, n, item, myflags|flags1);
msize++;
@@ -215,21 +213,21 @@ int Fl_Menu_Item::insert(
/**
Adds a new menu item.
- \param[in] label The text label for the menu item.
- \param[in] shortcut Optional keyboard shortcut that can be an int or string:
- (FL_CTRL+'a') or "^a". Default 0 if none.
- \param[in] callback Optional callback invoked when user clicks the item.
- Default 0 if none.
- \param[in] userdata Optional user data passed as an argument to the callback.
- Default 0 if none.
- \param[in] flags Optional flags that control the type of menu item;
- see below. Default is 0 for none.
- \returns The index into the menu() array, where the entry was added.
+ \param[in] label The text label for the menu item.
+ \param[in] shortcut Optional keyboard shortcut that can be an int or string:
+ (FL_CTRL+'a') or "^a". Default 0 if none.
+ \param[in] callback Optional callback invoked when user clicks the item.
+ Default 0 if none.
+ \param[in] userdata Optional user data passed as an argument to the callback.
+ Default 0 if none.
+ \param[in] flags Optional flags that control the type of menu item;
+ see below. Default is 0 for none.
+ \returns The index into the menu() array, where the entry was added.
\par Description
- If the menu array was directly set with menu(x), then copy() is done
+ If the menu array was directly set with menu(x), then copy() is done
to make a private array.
- \par
+ \par
Since this method can change the internal menu array, any menu item
pointers or indices the application may have cached can become stale,
and should be recalculated/refreshed.
@@ -240,27 +238,27 @@ int Fl_Menu_Item::insert(
\par label
The menu item's label. This argument is required and must not be NULL.
\par
- The characters "&", "/", "\", and "_" are treated as special characters in the label string.
+ The characters "&", "/", "\", and "_" are treated as special characters in the label string.
The "&" character specifies that the following character is an accelerator and will be underlined.
- The "\" character is used to escape the next character in the string.
+ The "\" character is used to escape the next character in the string.
Labels starting with the "_" character cause a divider to be placed after that menu item.
- \par
+ \par
A label of the form "File/Quit" will create the submenu "File"
with a menu item called "Quit". The "/" character is ignored if it appears
as the first character of the label string, e.g. "/File/Quit".
- \par
+ \par
The label string is copied to new memory and can be freed.
The other arguments (including the shortcut) are copied into the
menu item unchanged.
- \par
+ \par
If an item exists already with that name then it is replaced with
this new one. Otherwise this new one is added to the end of the
correct menu or submenu. The return value is the offset into the array
that the new entry was placed at.
-
+
\par shortcut
- The keyboard shortcut for this menu item.
- \par
+ The keyboard shortcut for this menu item.
+ \par
This parameter is optional, and defaults to 0 to indicate no shortcut.
\par
The shortcut can either be a raw integer value (eg. FL_CTRL+'A')
@@ -293,20 +291,20 @@ int Fl_Menu_Item::insert(
fl_old_shortcut(const char*).
\par callback
- The callback to invoke when this menu item is selected.
- \par
+ The callback to invoke when this menu item is selected.
+ \par
This parameter is optional, and defaults to 0 for no callback.
\par userdata
- The callback's 'user data' that is passed to the callback.
- \par
+ The callback's 'user data' that is passed to the callback.
+ \par
This parameter is optional, and defaults to 0.
\par flags
- These are bit flags to define what kind of menu item this is.
+ These are bit flags to define what kind of menu item this is.
\par
This parameter is optional, and defaults to 0 to define a 'regular' menu item.
- \par
+ \par
These flags can be 'OR'ed together:
\code
FL_MENU_INACTIVE // Deactivate menu item (gray out)
@@ -325,11 +323,11 @@ int Fl_Menu_Item::insert(
set to 0. If you add submenus with the 'path' technique, then the
corresponding submenu terminators (maybe more than one) are added as well.
- \todo Raw integer shortcut needs examples.
+ \todo Raw integer shortcut needs examples.
Dependent on responses to http://fltk.org/newsgroups.php?gfltk.development+v:10086 and results of STR#2344
*/
int Fl_Menu_::add(const char *label,int shortcut,Fl_Callback *callback,void *userdata,int flags) {
- return(insert(-1,label,shortcut,callback,userdata,flags)); // -1: append
+ return(insert(-1,label,shortcut,callback,userdata,flags)); // -1: append
}
@@ -339,25 +337,25 @@ int Fl_Menu_::add(const char *label,int shortcut,Fl_Callback *callback,void *use
If \p index is -1, the menu item is appended; same behavior as add().
To properly insert a menu item, \p label must be the name of the item (eg. "Quit"),
- and not a 'menu pathname' (eg. "File/Quit"). If a menu pathname is specified,
+ and not a 'menu pathname' (eg. "File/Quit"). If a menu pathname is specified,
the value of \p index is \em ignored, the new item's position defined by the pathname.
-
+
For more details, see add(). Except for the \p index parameter, add()
has more detailed information on parameters and behavior, and is
functionally equivalent.
\param[in] index The menu array's index position where the new item
is inserted. If -1, behavior is the same as add().
- \param[in] label The text label for the menu item. If the label
+ \param[in] label The text label for the menu item. If the label
is a menu pathname, \p index is ignored, and the pathname
- indicates the position of the new item.
+ indicates the position of the new item.
\param[in] shortcut Optional keyboard shortcut. Can be an int (FL_CTRL+'a')
or a string ("^a"). Default is 0.
\param[in] callback Optional callback invoked when user clicks the item.
Default 0 if none.
\param[in] userdata Optional user data passed as an argument to the callback.
Default 0 if none.
- \param[in] flags Optional flags that control the type of menu item;
+ \param[in] flags Optional flags that control the type of menu item;
see add() for more info. Default is 0 for none.
\returns The index into the menu() array, where the entry was added.
@@ -388,10 +386,10 @@ int Fl_Menu_::insert(
// start with a blank array:
alloc = 2; // indicates that the strings can be freed
if (local_array) {
- menu_ = local_array;
+ menu_ = local_array;
} else {
- local_array_alloc = 15;
- local_array = menu_ = new Fl_Menu_Item[local_array_alloc];
+ local_array_alloc = 15;
+ local_array = menu_ = new Fl_Menu_Item[local_array_alloc];
memset(local_array, 0, sizeof(Fl_Menu_Item) * local_array_alloc);
}
memset(menu_, 0, sizeof(Fl_Menu_Item));
@@ -421,7 +419,7 @@ int Fl_Menu_::insert(
same special characters as described for the long version of add().
No items must be added to a menu during a callback to the same menu.
-
+
\param str string containing multiple menu labels as described above
\returns the index into the menu() array, where the entry was added
*/
@@ -448,7 +446,7 @@ int Fl_Menu_::add(const char *str) {
Changes the text of item \p i. This is the only way to get
slash into an add()'ed menu item. If the menu array was directly set
with menu(x) then copy() is done to make a private array.
-
+
\param i index into menu array
\param str new label for menu item at index i
*/
@@ -467,9 +465,9 @@ void Fl_Menu_::replace(int i, const char *str) {
/**
Deletes item \p i from the menu. If the menu array was directly
set with menu(x) then copy() is done to make a private array.
-
+
No items must be removed from a menu during a callback to the same menu.
-
+
\param i index into menu array
*/
void Fl_Menu_::remove(int i) {
@@ -526,7 +524,3 @@ const Fl_Menu_Item *Fl_Menu_::menu_end() {
}
return menu_;
}
-
-//
-// End of "$Id$".
-//