mirror of
https://github.com/fltk/fltk.git
synced 2026-06-01 23:06:54 +08:00
Doxygen documentation. Completed Fl class, added a todo related to recent Fl API to document. Matt?. More cosmetics have been done, replaced *all* <pre> </pre> tags by \code \endcode sequences.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6260 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
@@ -115,7 +115,20 @@ public:
|
|||||||
// things called by initialization:
|
// things called by initialization:
|
||||||
static void display(const char*);
|
static void display(const char*);
|
||||||
static int visual(int);
|
static int visual(int);
|
||||||
static int gl_visual(int, int *alist=0);
|
/**
|
||||||
|
This does the same thing as
|
||||||
|
Fl::visual(int) but also
|
||||||
|
requires OpenGL drawing to work. This <I>must</I> be done if
|
||||||
|
you want to draw in normal windows with OpenGL with gl_start() and
|
||||||
|
gl_end(). It may be useful to call this so your X
|
||||||
|
windows use the same visual as an
|
||||||
|
Fl_Gl_Window, which on
|
||||||
|
some servers will reduce colormap flashing.
|
||||||
|
|
||||||
|
<P>See Fl_Gl_Window
|
||||||
|
for a list of additional values for the argument.
|
||||||
|
*/
|
||||||
|
static int gl_visual(int, int *alist=0); // platform dependent
|
||||||
static void own_colormap();
|
static void own_colormap();
|
||||||
static void get_system_colors();
|
static void get_system_colors();
|
||||||
static void foreground(uchar, uchar, uchar);
|
static void foreground(uchar, uchar, uchar);
|
||||||
@@ -142,8 +155,54 @@ public:
|
|||||||
static int ready();
|
static int ready();
|
||||||
static int run();
|
static int run();
|
||||||
static Fl_Widget* readqueue();
|
static Fl_Widget* readqueue();
|
||||||
static void add_timeout(double t, Fl_Timeout_Handler,void* = 0);
|
/**
|
||||||
static void repeat_timeout(double t, Fl_Timeout_Handler,void* = 0);
|
Adds a one-shot timeout callback. The function will be called by
|
||||||
|
Fl::wait() at <i>t</i> seconds after this function is called.
|
||||||
|
The optional void* argument is passed to the callback.
|
||||||
|
|
||||||
|
<P>You can have multiple timeout callbacks. To remove an timeout
|
||||||
|
callback use Fl::remove_timeout().
|
||||||
|
|
||||||
|
<p>If you need more accurate, repeated timeouts, use Fl::repeat_timeout() to
|
||||||
|
reschedule the subsequent timeouts.</p>
|
||||||
|
|
||||||
|
<p>The following code will print "TICK" each second on
|
||||||
|
stdout with a fair degree of accuracy:</p>
|
||||||
|
|
||||||
|
\code
|
||||||
|
void callback(void*) {
|
||||||
|
puts("TICK");
|
||||||
|
Fl::repeat_timeout(1.0, callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
Fl::add_timeout(1.0, callback);
|
||||||
|
return Fl::run();
|
||||||
|
}
|
||||||
|
\endcode
|
||||||
|
*/
|
||||||
|
static void add_timeout(double t, Fl_Timeout_Handler,void* = 0); // platform dependent
|
||||||
|
/**
|
||||||
|
This method repeats a timeout callback from the expiration of the
|
||||||
|
previous timeout, allowing for more accurate timing. You may only call
|
||||||
|
this method inside a timeout callback.
|
||||||
|
|
||||||
|
<p>The following code will print "TICK" each second on
|
||||||
|
stdout with a fair degree of accuracy:</p>
|
||||||
|
|
||||||
|
\code
|
||||||
|
void callback(void*) {
|
||||||
|
puts("TICK");
|
||||||
|
Fl::repeat_timeout(1.0, callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
Fl::add_timeout(1.0, callback);
|
||||||
|
return Fl::run();
|
||||||
|
}
|
||||||
|
\endcode
|
||||||
|
*/
|
||||||
|
static void repeat_timeout(double t, Fl_Timeout_Handler,void* = 0); // platform dependent
|
||||||
static int has_timeout(Fl_Timeout_Handler, void* = 0);
|
static int has_timeout(Fl_Timeout_Handler, void* = 0);
|
||||||
static void remove_timeout(Fl_Timeout_Handler, void* = 0);
|
static void remove_timeout(Fl_Timeout_Handler, void* = 0);
|
||||||
static void add_check(Fl_Timeout_Handler, void* = 0);
|
static void add_check(Fl_Timeout_Handler, void* = 0);
|
||||||
|
|||||||
+15
-15
@@ -47,11 +47,11 @@
|
|||||||
/**
|
/**
|
||||||
* This widget can be used to display a program-supplied time.
|
* This widget can be used to display a program-supplied time.
|
||||||
* The time shown on the clock is not updated.
|
* The time shown on the clock is not updated.
|
||||||
* To display the current time, use <TT>Fl_Clock</A></TT> instead.
|
* To display the current time, use Fl_Clock</A> instead.
|
||||||
*
|
*
|
||||||
* \image html clock.gif
|
* <table align=CENTER border=5 cellpadding=5 ><TR><TD> \image html clock.gif </TD>
|
||||||
*
|
*
|
||||||
* \image html round_clock.gif
|
* <TD> \image html round_clock.gif </TD> </TR> </table>
|
||||||
*/
|
*/
|
||||||
class FL_EXPORT Fl_Clock_Output : public Fl_Widget {
|
class FL_EXPORT Fl_Clock_Output : public Fl_Widget {
|
||||||
int hour_, minute_, second_;
|
int hour_, minute_, second_;
|
||||||
@@ -63,9 +63,9 @@ protected:
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new <tt>Fl_Clock_Output</tt> widget.
|
* Creates a new Fl_Clock_Output widget.
|
||||||
* Create an <tt>Fl_Clock_Output</tt> widget using the given position,
|
* Create an Fl_Clock_Output widget using the given position,
|
||||||
* size, and label string. The default boxtype is <tt>FL_NO_BOX</tt>.
|
* size, and label string. The default boxtype is FL_NO_BOX.
|
||||||
*
|
*
|
||||||
* \param[in] x, y, w, h position and size of the widget
|
* \param[in] x, y, w, h position and size of the widget
|
||||||
* \param[in] label widget label, default is no label
|
* \param[in] label widget label, default is no label
|
||||||
@@ -120,12 +120,12 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This widget provides a round analog clock display.
|
* This widget provides a round analog clock display.
|
||||||
* <tt>Fl_Clock</tt> is provided for Forms compatibility.
|
* Fl_Clock is provided for Forms compatibility.
|
||||||
* It installs a 1-second timeout callback using <tt>Fl::add_timeout()</tt>.
|
* It installs a 1-second timeout callback using Fl::add_timeout().
|
||||||
*
|
*
|
||||||
* \image html clock.gif
|
* <table align=CENTER border=5 cellpadding=5 ><TR><TD>\image html clock.gif </TD>
|
||||||
*
|
*
|
||||||
* \image html round_clock.gif
|
* <TD> \image html round_clock.gif </TD></TR></table>
|
||||||
*/
|
*/
|
||||||
class FL_EXPORT Fl_Clock : public Fl_Clock_Output {
|
class FL_EXPORT Fl_Clock : public Fl_Clock_Output {
|
||||||
public:
|
public:
|
||||||
@@ -133,9 +133,9 @@ public:
|
|||||||
void update();
|
void update();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new <tt>Fl_Clock</tt> widget.
|
* Creates a new Fl_Clock widget.
|
||||||
* Create an <tt>Fl_Clock</tt> widget using the given position,
|
* Create an Fl_Clock widget using the given position,
|
||||||
* size, and label string. The default boxtype is <tt>FL_NO_BOX</tt>.
|
* size, and label string. The default boxtype is FL_NO_BOX.
|
||||||
*
|
*
|
||||||
* \param[in] x, y, w, h position and size of the widget
|
* \param[in] x, y, w, h position and size of the widget
|
||||||
* \param[in] label widget label, default is no label
|
* \param[in] label widget label, default is no label
|
||||||
@@ -143,8 +143,8 @@ public:
|
|||||||
Fl_Clock(int x,int y,int w,int h, const char *l = 0);
|
Fl_Clock(int x,int y,int w,int h, const char *l = 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new <tt>Fl_Clock</tt> widget.
|
* Creates a new Fl_Clock widget.
|
||||||
* Create an <tt>Fl_Clock</tt> widget using the given position,
|
* Create an Fl_Clock widget using the given position,
|
||||||
* size, and label string.
|
* size, and label string.
|
||||||
*
|
*
|
||||||
* \param[in] t boxtype
|
* \param[in] t boxtype
|
||||||
|
|||||||
@@ -37,11 +37,9 @@
|
|||||||
copy it to the on-screen window.
|
copy it to the on-screen window.
|
||||||
<P>It is highly recommended that you put the following code before the
|
<P>It is highly recommended that you put the following code before the
|
||||||
first show() of <I>any</I> window in your program: </P>
|
first show() of <I>any</I> window in your program: </P>
|
||||||
<UL>
|
\code
|
||||||
<PRE>
|
|
||||||
Fl::visual(FL_DOUBLE|FL_INDEX)
|
Fl::visual(FL_DOUBLE|FL_INDEX)
|
||||||
</PRE>
|
\endcode
|
||||||
</UL>
|
|
||||||
This makes sure you can use Xdbe on servers where double buffering
|
This makes sure you can use Xdbe on servers where double buffering
|
||||||
does not exist for every visual.
|
does not exist for every visual.
|
||||||
*/
|
*/
|
||||||
|
|||||||
+2
-4
@@ -47,15 +47,13 @@ typedef int (*FL_HANDLEPTR)(Fl_Widget *, int , float, float, char);
|
|||||||
widgets.
|
widgets.
|
||||||
<P>There are five types of free, which determine when the handle
|
<P>There are five types of free, which determine when the handle
|
||||||
function is called: </P>
|
function is called: </P>
|
||||||
<UL>
|
\code
|
||||||
<PRE>
|
|
||||||
#define FL_NORMAL_FREE 1
|
#define FL_NORMAL_FREE 1
|
||||||
#define FL_SLEEPING_FREE 2
|
#define FL_SLEEPING_FREE 2
|
||||||
#define FL_INPUT_FREE 3
|
#define FL_INPUT_FREE 3
|
||||||
#define FL_CONTINUOUS_FREE 4
|
#define FL_CONTINUOUS_FREE 4
|
||||||
#define FL_ALL_FREE 5
|
#define FL_ALL_FREE 5
|
||||||
</PRE>
|
\endcode
|
||||||
</UL>
|
|
||||||
<P>An FL_INPUT_FREE accepts FL_FOCUS events. A FL_CONTINUOUS_FREE sets
|
<P>An FL_INPUT_FREE accepts FL_FOCUS events. A FL_CONTINUOUS_FREE sets
|
||||||
a timeout callback 100 times a second and provides a FL_STEP event,
|
a timeout callback 100 times a second and provides a FL_STEP event,
|
||||||
this has obvious detrimental effects on machine performance.
|
this has obvious detrimental effects on machine performance.
|
||||||
|
|||||||
+2
-2
@@ -85,7 +85,7 @@ public:
|
|||||||
after</I> draw() is called. You can use this inside your
|
after</I> draw() is called. You can use this inside your
|
||||||
draw() method to avoid unneccessarily initializing the OpenGL
|
draw() method to avoid unneccessarily initializing the OpenGL
|
||||||
context. Just do this:
|
context. Just do this:
|
||||||
<UL><PRE>
|
\code
|
||||||
void mywindow::draw() {
|
void mywindow::draw() {
|
||||||
if (!valid()) {
|
if (!valid()) {
|
||||||
glViewport(0,0,w(),h());
|
glViewport(0,0,w(),h());
|
||||||
@@ -97,7 +97,7 @@ public:
|
|||||||
}
|
}
|
||||||
... draw your geometry here ...
|
... draw your geometry here ...
|
||||||
}
|
}
|
||||||
</PRE></UL>
|
\endcode
|
||||||
|
|
||||||
You can turn valid() on by calling valid(1). You
|
You can turn valid() on by calling valid(1). You
|
||||||
should only do this after fixing the transformation inside a draw()
|
should only do this after fixing the transformation inside a draw()
|
||||||
|
|||||||
+4
-4
@@ -170,8 +170,8 @@ public:
|
|||||||
/**
|
/**
|
||||||
This is a dummy class that allows you to end a Fl_Group in a constructor list of a
|
This is a dummy class that allows you to end a Fl_Group in a constructor list of a
|
||||||
class:
|
class:
|
||||||
<UL>
|
\code
|
||||||
<PRE>class MyClass {
|
class MyClass {
|
||||||
Fl_Group group;
|
Fl_Group group;
|
||||||
Fl_Button button_in_group;
|
Fl_Button button_in_group;
|
||||||
Fl_End end;
|
Fl_End end;
|
||||||
@@ -183,8 +183,8 @@ public:
|
|||||||
button_in_group(20,20,60,30),
|
button_in_group(20,20,60,30),
|
||||||
end(),
|
end(),
|
||||||
button_outside_group(10,120,60,30)
|
button_outside_group(10,120,60,30)
|
||||||
{}</PRE>
|
{}
|
||||||
</UL>
|
\endcode
|
||||||
*/
|
*/
|
||||||
class FL_EXPORT Fl_End {
|
class FL_EXPORT Fl_End {
|
||||||
public:
|
public:
|
||||||
|
|||||||
+2
-2
@@ -204,9 +204,9 @@ public:
|
|||||||
for the file in question. It must return a pathname that can be
|
for the file in question. It must return a pathname that can be
|
||||||
opened as a local file or NULL:</P>
|
opened as a local file or NULL:</P>
|
||||||
|
|
||||||
<UL><PRE>
|
\code
|
||||||
const char *fn(Fl_Widget *w, const char *uri);
|
const char *fn(Fl_Widget *w, const char *uri);
|
||||||
</PRE></UL>
|
\endcode
|
||||||
|
|
||||||
<P>The link function can be used to retrieve remote or virtual
|
<P>The link function can be used to retrieve remote or virtual
|
||||||
documents, returning a temporary file that contains the actual
|
documents, returning a temporary file that contains the actual
|
||||||
|
|||||||
+4
-6
@@ -54,8 +54,7 @@ class Fl_Menu_;
|
|||||||
/**
|
/**
|
||||||
The Fl_Menu_Item structure defines a single menu item that
|
The Fl_Menu_Item structure defines a single menu item that
|
||||||
is used by the Fl_Menu_ class.
|
is used by the Fl_Menu_ class.
|
||||||
<UL>
|
\code
|
||||||
<PRE>
|
|
||||||
struct Fl_Menu_Item {
|
struct Fl_Menu_Item {
|
||||||
const char* text; // label()
|
const char* text; // label()
|
||||||
ulong shortcut_;
|
ulong shortcut_;
|
||||||
@@ -79,10 +78,9 @@ class Fl_Menu_;
|
|||||||
FL_MENU_DIVIDER = 0x80,
|
FL_MENU_DIVIDER = 0x80,
|
||||||
FL_MENU_HORIZONTAL = 0x100
|
FL_MENU_HORIZONTAL = 0x100
|
||||||
};
|
};
|
||||||
</PRE>
|
\endcode
|
||||||
</UL>
|
|
||||||
Typically menu items are statically defined; for example:
|
Typically menu items are statically defined; for example:
|
||||||
<UL><PRE>
|
\code
|
||||||
Fl_Menu_Item popup[] = {
|
Fl_Menu_Item popup[] = {
|
||||||
{"&alpha", FL_ALT+'a', the_cb, (void*)1},
|
{"&alpha", FL_ALT+'a', the_cb, (void*)1},
|
||||||
{"&beta", FL_ALT+'b', the_cb, (void*)2},
|
{"&beta", FL_ALT+'b', the_cb, (void*)2},
|
||||||
@@ -101,7 +99,7 @@ class Fl_Menu_;
|
|||||||
{"check", FL_ALT+'i', 0, 0, FL_MENU_TOGGLE|FL_MENU_VALUE},
|
{"check", FL_ALT+'i', 0, 0, FL_MENU_TOGGLE|FL_MENU_VALUE},
|
||||||
{"box", FL_ALT+'i', 0, 0, FL_MENU_TOGGLE},
|
{"box", FL_ALT+'i', 0, 0, FL_MENU_TOGGLE},
|
||||||
{0}};
|
{0}};
|
||||||
</PRE></UL>
|
\endcode
|
||||||
produces:
|
produces:
|
||||||
<P ALIGN=CENTER>\image html menu.gif </P>
|
<P ALIGN=CENTER>\image html menu.gif </P>
|
||||||
|
|
||||||
|
|||||||
+21
-21
@@ -41,12 +41,12 @@
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
<tt>Fl_Preferences </tt>provides methods to store user
|
Fl_Preferences provides methods to store user
|
||||||
settings between application starts. It is similar to the
|
settings between application starts. It is similar to the
|
||||||
Registry on WIN32 and Preferences on MacOS, and provides a
|
Registry on WIN32 and Preferences on MacOS, and provides a
|
||||||
simple configuration mechanism for UNIX.
|
simple configuration mechanism for UNIX.
|
||||||
|
|
||||||
<tt>Fl_Preferences </tt>uses a hierarchy to store data. It
|
Fl_Preferences uses a hierarchy to store data. It
|
||||||
bundles similar data into groups and manages entries into those
|
bundles similar data into groups and manages entries into those
|
||||||
groups as name/value pairs.
|
groups as name/value pairs.
|
||||||
|
|
||||||
@@ -82,18 +82,18 @@ public:
|
|||||||
/**
|
/**
|
||||||
The constructor creates a group that manages name/value pairs and
|
The constructor creates a group that manages name/value pairs and
|
||||||
child groups. Groups are ready for reading and writing at any time.
|
child groups. Groups are ready for reading and writing at any time.
|
||||||
The <tt>root</tt> argument is either <tt>Fl_Preferences::USER</tt>
|
The root argument is either Fl_Preferences::USER
|
||||||
or <tt>Fl_Preferences::SYSTEM</tt>.
|
or Fl_Preferences::SYSTEM.
|
||||||
|
|
||||||
This constructor creates the <i>base</i> instance for all
|
This constructor creates the <i>base</i> instance for all
|
||||||
following entries and reads existing databases into memory. The
|
following entries and reads existing databases into memory. The
|
||||||
<tt>vendor</tt> argument is a unique text string identifying the
|
vendor argument is a unique text string identifying the
|
||||||
development team or vendor of an application. A domain name or
|
development team or vendor of an application. A domain name or
|
||||||
an EMail address are great unique names, e.g.
|
an EMail address are great unique names, e.g.
|
||||||
"researchATmatthiasm.com" or "fltk.org". The
|
"researchATmatthiasm.com" or "fltk.org". The
|
||||||
<tt>application</tt> argument can be the working title or final
|
application argument can be the working title or final
|
||||||
name of your application. Both <tt>vendor</tt> and
|
name of your application. Both vendor and
|
||||||
<tt>application</tt> must be valid relative UNIX pathnames and
|
application must be valid relative UNIX pathnames and
|
||||||
may contain '/'s to create deeper file structures.
|
may contain '/'s to create deeper file structures.
|
||||||
|
|
||||||
\param[in] root can be USER or SYSTEM for user specific or system wide preferences
|
\param[in] root can be USER or SYSTEM for user specific or system wide preferences
|
||||||
@@ -105,7 +105,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
This constructor is used to create or read a preferences file at an
|
This constructor is used to create or read a preferences file at an
|
||||||
arbitrary position in the file system. The file name is generated
|
arbitrary position in the file system. The file name is generated
|
||||||
as <tt><i>path</i>/<i>application</i>.prefs</tt>. If <i>application</i>
|
as <i>path</i>/<i>application</i>.prefs. If <i>application</i>
|
||||||
is 0, <i>path</i> must contain the full file name.
|
is 0, <i>path</i> must contain the full file name.
|
||||||
|
|
||||||
\param[in] path path to the directory that contains the preferences file
|
\param[in] path path to the directory that contains the preferences file
|
||||||
@@ -116,7 +116,7 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
This constructor generates a new group of preference entries
|
This constructor generates a new group of preference entries
|
||||||
inside the group or file <i>parent</i>. The <tt>group</tt> argument
|
inside the group or file <i>parent</i>. The group argument
|
||||||
identifies a group of entries. It can contain '/'s to get quick
|
identifies a group of entries. It can contain '/'s to get quick
|
||||||
access to individual elements inside the hierarchy.
|
access to individual elements inside the hierarchy.
|
||||||
|
|
||||||
@@ -150,7 +150,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
Returns the name of the Nth group. There is no guaranteed
|
Returns the name of the Nth group. There is no guaranteed
|
||||||
order of group names. The index must be within the range given
|
order of group names. The index must be within the range given
|
||||||
by <tt>groups()</tt>.
|
by groups().
|
||||||
|
|
||||||
\param[in] index number indexing the requested group
|
\param[in] index number indexing the requested group
|
||||||
\return cstring pointer to the group name
|
\return cstring pointer to the group name
|
||||||
@@ -160,8 +160,8 @@ public:
|
|||||||
/**
|
/**
|
||||||
Returns non-zero if a group with this name exists.
|
Returns non-zero if a group with this name exists.
|
||||||
Groupnames are relative to the Preferences node and can contain a path.
|
Groupnames are relative to the Preferences node and can contain a path.
|
||||||
<tt>"."</tt> describes the current node, <tt>"./"</tt> describes the topmost node.
|
"." describes the current node, "./" describes the topmost node.
|
||||||
By preceding a groupname with a <tt>"./"</tt>, its path becomes relative to the topmost node.
|
By preceding a groupname with a "./", its path becomes relative to the topmost node.
|
||||||
|
|
||||||
\param[in] group name of group that is searched for
|
\param[in] group name of group that is searched for
|
||||||
\return 0 if group was not found
|
\return 0 if group was not found
|
||||||
@@ -187,7 +187,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
Returns the name of an entry. There is no guaranteed order of
|
Returns the name of an entry. There is no guaranteed order of
|
||||||
entry names. The index must be within the range given by
|
entry names. The index must be within the range given by
|
||||||
<tt>entries()</tt>.
|
entries().
|
||||||
|
|
||||||
\param[in] index number indexing the requested entry
|
\param[in] index number indexing the requested entry
|
||||||
\return pointer to value cstring
|
\return pointer to value cstring
|
||||||
@@ -339,7 +339,7 @@ public:
|
|||||||
supplied. The return value indicates if the value was available
|
supplied. The return value indicates if the value was available
|
||||||
(non-zero) or the default was used (0). get() allocates memory of
|
(non-zero) or the default was used (0). get() allocates memory of
|
||||||
sufficient size to hold the value. The buffer must be free'd by
|
sufficient size to hold the value. The buffer must be free'd by
|
||||||
the developer using '<tt>free(value)</tt>'.
|
the developer using 'free(value)'.
|
||||||
|
|
||||||
\param[in] entry name of entry
|
\param[in] entry name of entry
|
||||||
\param[out] value returned from preferences or default value if none was set
|
\param[out] value returned from preferences or default value if none was set
|
||||||
@@ -352,7 +352,7 @@ public:
|
|||||||
Reads an entry from the group. A default value must be
|
Reads an entry from the group. A default value must be
|
||||||
supplied. The return value indicates if the value was available
|
supplied. The return value indicates if the value was available
|
||||||
(non-zero) or the default was used (0).
|
(non-zero) or the default was used (0).
|
||||||
'<tt>maxSize</tt>' is the maximum length of text that will be read.
|
'maxSize' is the maximum length of text that will be read.
|
||||||
The text buffer must allow for one additional byte for a trailling zero.
|
The text buffer must allow for one additional byte for a trailling zero.
|
||||||
|
|
||||||
\param[in] entry name of entry
|
\param[in] entry name of entry
|
||||||
@@ -368,7 +368,7 @@ public:
|
|||||||
supplied. The return value indicates if the value was available
|
supplied. The return value indicates if the value was available
|
||||||
(non-zero) or the default was used (0). get() allocates memory of
|
(non-zero) or the default was used (0). get() allocates memory of
|
||||||
sufficient size to hold the value. The buffer must be free'd by
|
sufficient size to hold the value. The buffer must be free'd by
|
||||||
the developer using '<tt>free(value)</tt>'.
|
the developer using 'free(value)'.
|
||||||
|
|
||||||
\param[in] entry name of entry
|
\param[in] entry name of entry
|
||||||
\param[out] value returned from preferences or default value if none was set
|
\param[out] value returned from preferences or default value if none was set
|
||||||
@@ -382,7 +382,7 @@ public:
|
|||||||
Reads an entry from the group. A default value must be
|
Reads an entry from the group. A default value must be
|
||||||
supplied. The return value indicates if the value was available
|
supplied. The return value indicates if the value was available
|
||||||
(non-zero) or the default was used (0).
|
(non-zero) or the default was used (0).
|
||||||
'<tt>maxSize</tt>' is the maximum length of text that will be read.
|
'maxSize' is the maximum length of text that will be read.
|
||||||
|
|
||||||
\param[in] entry name of entry
|
\param[in] entry name of entry
|
||||||
\param[out] value returned from preferences or default value if none was set
|
\param[out] value returned from preferences or default value if none was set
|
||||||
@@ -429,11 +429,11 @@ public:
|
|||||||
'Name' provides a simple method to create numerical or more complex
|
'Name' provides a simple method to create numerical or more complex
|
||||||
procedural names for entries and groups on the fly.
|
procedural names for entries and groups on the fly.
|
||||||
|
|
||||||
Example: <tt>prefs.set(Fl_Preferences::Name("File%d",i),file[i]);</tt>.
|
Example: prefs.set(Fl_Preferences::Name("File%d",i),file[i]);.
|
||||||
|
|
||||||
See <tt>test/preferences.cxx</tt> as a sample for writing arrays into preferences.<p>
|
See test/preferences.cxx as a sample for writing arrays into preferences.<p>
|
||||||
'Name' is actually implemented as a class inside Fl_Preferences. It casts
|
'Name' is actually implemented as a class inside Fl_Preferences. It casts
|
||||||
into <tt>const char*</tt> and gets automatically destroyed after the enclosing call
|
into const char* and gets automatically destroyed after the enclosing call
|
||||||
ends.
|
ends.
|
||||||
*/
|
*/
|
||||||
class FL_EXPORT Name {
|
class FL_EXPORT Name {
|
||||||
|
|||||||
+19
-19
@@ -344,7 +344,7 @@ public:
|
|||||||
* The label is shown somewhere on or next to the widget. The passed pointer
|
* The label is shown somewhere on or next to the widget. The passed pointer
|
||||||
* is stored unchanged in the widget (the string is \em not copied), so if
|
* is stored unchanged in the widget (the string is \em not copied), so if
|
||||||
* you need to set the label to a formatted value, make sure the buffer is
|
* you need to set the label to a formatted value, make sure the buffer is
|
||||||
* <tt>static</tt>, global, or allocated. The copy_label() method can be used
|
* static, global, or allocated. The copy_label() method can be used
|
||||||
* to make a copy of the label string automatically.
|
* to make a copy of the label string automatically.
|
||||||
* \param[in] text pointer to new label text
|
* \param[in] text pointer to new label text
|
||||||
* \see copy_label()
|
* \see copy_label()
|
||||||
@@ -466,13 +466,13 @@ public:
|
|||||||
/** Sets the current tooltip text.
|
/** Sets the current tooltip text.
|
||||||
* Sets a string of text to display in a popup tooltip window when the user
|
* Sets a string of text to display in a popup tooltip window when the user
|
||||||
* hovers the mouse over the widget. The string is <I>not</I> copied, so
|
* hovers the mouse over the widget. The string is <I>not</I> copied, so
|
||||||
* make sure any formatted string is stored in a <TT>static</TT>, global,
|
* make sure any formatted string is stored in a static, global,
|
||||||
* or allocated buffer.
|
* or allocated buffer.
|
||||||
*
|
*
|
||||||
* If no tooltip is set, the tooltip of the parent is inherited. Setting a
|
* If no tooltip is set, the tooltip of the parent is inherited. Setting a
|
||||||
* tooltip for a group and setting no tooltip for a child will show the
|
* tooltip for a group and setting no tooltip for a child will show the
|
||||||
* group's tooltip instead. To avoid this behavior, you can set the child's
|
* group's tooltip instead. To avoid this behavior, you can set the child's
|
||||||
* tooltip to an empty string (<tt>""</tt>).
|
* tooltip to an empty string ("").
|
||||||
* \param[in] t new tooltip
|
* \param[in] t new tooltip
|
||||||
*/
|
*/
|
||||||
void tooltip(const char *t);
|
void tooltip(const char *t);
|
||||||
@@ -510,14 +510,14 @@ public:
|
|||||||
void callback(Fl_Callback1*cb, long p=0) {callback_=(Fl_Callback*)cb; user_data_=(void*)p;}
|
void callback(Fl_Callback1*cb, long p=0) {callback_=(Fl_Callback*)cb; user_data_=(void*)p;}
|
||||||
|
|
||||||
/** Gets the user data for this widget.
|
/** Gets the user data for this widget.
|
||||||
* Gets the current user data (<TT>void *</TT>) argument
|
* Gets the current user data (void *) argument
|
||||||
* that is passed to the callback function.
|
* that is passed to the callback function.
|
||||||
* \return user data as a pointer
|
* \return user data as a pointer
|
||||||
*/
|
*/
|
||||||
void* user_data() const {return user_data_;}
|
void* user_data() const {return user_data_;}
|
||||||
|
|
||||||
/** Sets the user data for this widget.
|
/** Sets the user data for this widget.
|
||||||
* Sets the new user data (<TT>void *</TT>) argument
|
* Sets the new user data (void *) argument
|
||||||
* that is passed to the callback function.
|
* that is passed to the callback function.
|
||||||
* \param[in] v new user data
|
* \param[in] v new user data
|
||||||
*/
|
*/
|
||||||
@@ -573,11 +573,11 @@ public:
|
|||||||
Fl_When when() const {return (Fl_When)when_;}
|
Fl_When when() const {return (Fl_When)when_;}
|
||||||
|
|
||||||
/** Flags used to decide when a callback is called.
|
/** Flags used to decide when a callback is called.
|
||||||
* <TT>Fl_Widget::when()</TT> is a set of bitflags used by subclasses of
|
* Fl_Widget::when() is a set of bitflags used by subclasses of
|
||||||
* <TT> Fl_Widget</TT> to decide when to do the callback. If the value
|
* Fl_Widget to decide when to do the callback. If the value
|
||||||
* is zero then the callback is never done. Other values are described
|
* is zero then the callback is never done. Other values are described
|
||||||
* in the individual widgets. This field is in the base class so that
|
* in the individual widgets. This field is in the base class so that
|
||||||
* you can scan a panel and <TT>do_callback()</TT> on all the ones that
|
* you can scan a panel and do_callback() on all the ones that
|
||||||
* don't do their own callbacks in response to an "OK" button.
|
* don't do their own callbacks in response to an "OK" button.
|
||||||
* \param[in] i set of flags
|
* \param[in] i set of flags
|
||||||
*/
|
*/
|
||||||
@@ -597,15 +597,15 @@ public:
|
|||||||
|
|
||||||
/** Makes a widget visible.
|
/** Makes a widget visible.
|
||||||
* An invisible widget never gets redrawn and does not get events.
|
* An invisible widget never gets redrawn and does not get events.
|
||||||
* The <TT>visible()</TT> method returns true if the widget is set to be
|
* The visible() method returns true if the widget is set to be
|
||||||
* visible. The <TT>visible_r()</TT> method returns true if the widget and
|
* visible. The visible_r() method returns true if the widget and
|
||||||
* all of its parents are visible. A widget is only visible if
|
* all of its parents are visible. A widget is only visible if
|
||||||
* <TT>visible()</TT> is true on it <I>and all of its parents</I>.
|
* visible() is true on it <I>and all of its parents</I>.
|
||||||
*
|
*
|
||||||
* Changing it will send <TT>FL_SHOW</TT> or <TT>FL_HIDE</TT> events to
|
* Changing it will send FL_SHOW or FL_HIDE events to
|
||||||
* the widget. <I>Do not change it if the parent is not visible, as this
|
* the widget. <I>Do not change it if the parent is not visible, as this
|
||||||
* will send false <TT>FL_SHOW</TT> or <TT>FL_HIDE</TT> events to the
|
* will send false FL_SHOW or FL_HIDE events to the
|
||||||
* widget</I>. <TT>redraw()</TT> is called if necessary on this or the parent.
|
* widget</I>. redraw() is called if necessary on this or the parent.
|
||||||
*
|
*
|
||||||
* \see hide(), visible(), visible_r()
|
* \see hide(), visible(), visible_r()
|
||||||
*/
|
*/
|
||||||
@@ -684,8 +684,8 @@ public:
|
|||||||
void clear_output() {flags_ &= ~OUTPUT;}
|
void clear_output() {flags_ &= ~OUTPUT;}
|
||||||
|
|
||||||
/** Returns if the widget is able to take events.
|
/** Returns if the widget is able to take events.
|
||||||
* This is the same as <TT>(active() && !output()
|
* This is the same as (active() && !output()
|
||||||
* && visible())</TT> but is faster.
|
* && visible()) but is faster.
|
||||||
* \retval 0 if the widget takes no events
|
* \retval 0 if the widget takes no events
|
||||||
*/
|
*/
|
||||||
int takesevents() const {return !(flags_&(INACTIVE|INVISIBLE|OUTPUT));}
|
int takesevents() const {return !(flags_&(INACTIVE|INVISIBLE|OUTPUT));}
|
||||||
@@ -716,8 +716,8 @@ public:
|
|||||||
|
|
||||||
/** Give the widget the keyboard focus.
|
/** Give the widget the keyboard focus.
|
||||||
* Tries to make this widget be the Fl::focus() widget, by first sending
|
* Tries to make this widget be the Fl::focus() widget, by first sending
|
||||||
* it an <TT>FL_FOCUS</TT> event, and if it returns non-zero, setting
|
* it an FL_FOCUS event, and if it returns non-zero, setting
|
||||||
* <TT>Fl::focus()</TT> to this widget. You should use this method to
|
* Fl::focus() to this widget. You should use this method to
|
||||||
* assign the focus to a widget.
|
* assign the focus to a widget.
|
||||||
* \return true if the widget accepted the focus.
|
* \return true if the widget accepted the focus.
|
||||||
*/
|
*/
|
||||||
@@ -851,7 +851,7 @@ public:
|
|||||||
|
|
||||||
/** Returns a pointer to the primary Fl_Window widget.
|
/** Returns a pointer to the primary Fl_Window widget.
|
||||||
* \retval NULL if no window is associated with this widget.
|
* \retval NULL if no window is associated with this widget.
|
||||||
* \note for an <TT>Fl_Window</TT> widget, this returns its <I>parent</I> window (if any), not <I>this</I> window.
|
* \note for an Fl_Window widget, this returns its <I>parent</I> window (if any), not <I>this</I> window.
|
||||||
*/
|
*/
|
||||||
Fl_Window* window() const ;
|
Fl_Window* window() const ;
|
||||||
|
|
||||||
|
|||||||
+16
-57
@@ -186,57 +186,11 @@ static void elapse_timeouts() {
|
|||||||
// time interval:
|
// time interval:
|
||||||
static double missed_timeout_by;
|
static double missed_timeout_by;
|
||||||
|
|
||||||
/**
|
|
||||||
Add a one-shot timeout callback. The function will be called by
|
|
||||||
Fl::wait() at <i>t</i> seconds after this function is called.
|
|
||||||
The optional void* argument is passed to the callback.
|
|
||||||
|
|
||||||
<P>You can have multiple timeout callbacks. To remove an timeout
|
|
||||||
callback use Fl::remove_timeout().
|
|
||||||
|
|
||||||
<p>If you need more accurate, repeated timeouts, use Fl::repeat_timeout() to
|
|
||||||
reschedule the subsequent timeouts.</p>
|
|
||||||
|
|
||||||
<p>The following code will print "TICK" each second on
|
|
||||||
stdout with a fair degree of accuracy:</p>
|
|
||||||
|
|
||||||
<PRE>
|
|
||||||
void callback(void*) {
|
|
||||||
puts("TICK");
|
|
||||||
Fl::repeat_timeout(1.0, callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
int main() {
|
|
||||||
Fl::add_timeout(1.0, callback);
|
|
||||||
return Fl::run();
|
|
||||||
}
|
|
||||||
</PRE>
|
|
||||||
*/
|
|
||||||
void Fl::add_timeout(double time, Fl_Timeout_Handler cb, void *argp) {
|
void Fl::add_timeout(double time, Fl_Timeout_Handler cb, void *argp) {
|
||||||
elapse_timeouts();
|
elapse_timeouts();
|
||||||
repeat_timeout(time, cb, argp);
|
repeat_timeout(time, cb, argp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
This method repeats a timeout callback from the expiration of the
|
|
||||||
previous timeout, allowing for more accurate timing. You may only call
|
|
||||||
this method inside a timeout callback.
|
|
||||||
|
|
||||||
<p>The following code will print "TICK" each second on
|
|
||||||
stdout with a fair degree of accuracy:</p>
|
|
||||||
|
|
||||||
<PRE>
|
|
||||||
void callback(void*) {
|
|
||||||
puts("TICK");
|
|
||||||
Fl::repeat_timeout(1.0, callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
int main() {
|
|
||||||
Fl::add_timeout(1.0, callback);
|
|
||||||
return Fl::run();
|
|
||||||
}
|
|
||||||
</PRE>
|
|
||||||
*/
|
|
||||||
void Fl::repeat_timeout(double time, Fl_Timeout_Handler cb, void *argp) {
|
void Fl::repeat_timeout(double time, Fl_Timeout_Handler cb, void *argp) {
|
||||||
time += missed_timeout_by; if (time < -.05) time = 0;
|
time += missed_timeout_by; if (time < -.05) time = 0;
|
||||||
Timeout* t = free_timeout;
|
Timeout* t = free_timeout;
|
||||||
@@ -316,7 +270,7 @@ static Check *first_check, *next_check, *free_check;
|
|||||||
|
|
||||||
<p>Sample code:
|
<p>Sample code:
|
||||||
|
|
||||||
<UL><PRE>
|
\code
|
||||||
bool state_changed; // anything that changes the display turns this on
|
bool state_changed; // anything that changes the display turns this on
|
||||||
|
|
||||||
void callback(void*) {
|
void callback(void*) {
|
||||||
@@ -330,7 +284,7 @@ static Check *first_check, *next_check, *free_check;
|
|||||||
Fl::add_check(callback);
|
Fl::add_check(callback);
|
||||||
return Fl::run();
|
return Fl::run();
|
||||||
}
|
}
|
||||||
</PRE></UL>
|
\endcode
|
||||||
*/
|
*/
|
||||||
void Fl::add_check(Fl_Timeout_Handler cb, void *argp) {
|
void Fl::add_check(Fl_Timeout_Handler cb, void *argp) {
|
||||||
Check* t = free_check;
|
Check* t = free_check;
|
||||||
@@ -543,13 +497,13 @@ int Fl::wait() {
|
|||||||
Same as Fl::wait(0). Calling this during a big calculation
|
Same as Fl::wait(0). Calling this during a big calculation
|
||||||
will keep the screen up to date and the interface responsive:
|
will keep the screen up to date and the interface responsive:
|
||||||
|
|
||||||
<UL><PRE>
|
\code
|
||||||
while (!calculation_done()) {
|
while (!calculation_done()) {
|
||||||
calculate();
|
calculate();
|
||||||
Fl::check();
|
Fl::check();
|
||||||
if (user_hit_abort_button()) break;
|
if (user_hit_abort_button()) break;
|
||||||
}
|
}
|
||||||
</PRE></UL>
|
\endcode
|
||||||
|
|
||||||
<P>The returns non-zero if any windows are displayed, and 0 if no
|
<P>The returns non-zero if any windows are displayed, and 0 if no
|
||||||
windows are displayed (this is likely to change in future versions of
|
windows are displayed (this is likely to change in future versions of
|
||||||
@@ -567,7 +521,7 @@ int Fl::check() {
|
|||||||
true if Fl::check() would do anything (it will continue to
|
true if Fl::check() would do anything (it will continue to
|
||||||
return true until you call Fl::check() or Fl::wait()).
|
return true until you call Fl::check() or Fl::wait()).
|
||||||
|
|
||||||
<UL><PRE>
|
\code
|
||||||
while (!calculation_done()) {
|
while (!calculation_done()) {
|
||||||
calculate();
|
calculate();
|
||||||
if (Fl::ready()) {
|
if (Fl::ready()) {
|
||||||
@@ -576,7 +530,7 @@ int Fl::check() {
|
|||||||
if (user_hit_abort_button()) break;
|
if (user_hit_abort_button()) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</PRE></UL>
|
\endcode
|
||||||
*/
|
*/
|
||||||
int Fl::ready() {
|
int Fl::ready() {
|
||||||
#if ! defined( WIN32 ) && ! defined(__APPLE__)
|
#if ! defined( WIN32 ) && ! defined(__APPLE__)
|
||||||
@@ -1537,9 +1491,11 @@ void Fl::delete_widget(Fl_Widget *wi) {
|
|||||||
num_dwidgets ++;
|
num_dwidgets ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
void
|
Deletes widgets previously scheduled for deletion.
|
||||||
Fl::do_widget_deletion() {
|
See void Fl::delete_widget(Fl_Widget *wi)
|
||||||
|
*/
|
||||||
|
void Fl::do_widget_deletion() {
|
||||||
if (!num_dwidgets) return;
|
if (!num_dwidgets) return;
|
||||||
|
|
||||||
for (int i = 0; i < num_dwidgets; i ++)
|
for (int i = 0; i < num_dwidgets; i ++)
|
||||||
@@ -1551,7 +1507,9 @@ Fl::do_widget_deletion() {
|
|||||||
static Fl_Widget ***widget_watch = 0;
|
static Fl_Widget ***widget_watch = 0;
|
||||||
static int num_widget_watch = 0;
|
static int num_widget_watch = 0;
|
||||||
static int max_widget_watch = 0;
|
static int max_widget_watch = 0;
|
||||||
|
/** Adds a widget pointer to the watch list.
|
||||||
|
\todo explain the role of the watch list,
|
||||||
|
it may be related to invalid widget deletion crash fixes... */
|
||||||
void Fl::watch_widget_pointer(Fl_Widget *&w)
|
void Fl::watch_widget_pointer(Fl_Widget *&w)
|
||||||
{
|
{
|
||||||
Fl_Widget **wp = &w;
|
Fl_Widget **wp = &w;
|
||||||
@@ -1572,6 +1530,7 @@ void Fl::watch_widget_pointer(Fl_Widget *&w)
|
|||||||
widget_watch[num_widget_watch++] = wp;
|
widget_watch[num_widget_watch++] = wp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Releases a widget pointer to the watch list */
|
||||||
void Fl::release_widget_pointer(Fl_Widget *&w)
|
void Fl::release_widget_pointer(Fl_Widget *&w)
|
||||||
{
|
{
|
||||||
Fl_Widget **wp = &w;
|
Fl_Widget **wp = &w;
|
||||||
@@ -1583,7 +1542,7 @@ void Fl::release_widget_pointer(Fl_Widget *&w)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/** Clears a widget pointer in the watch list */
|
||||||
void Fl::clear_widget_pointer(Fl_Widget const *w)
|
void Fl::clear_widget_pointer(Fl_Widget const *w)
|
||||||
{
|
{
|
||||||
if (w==0L) return;
|
if (w==0L) return;
|
||||||
|
|||||||
@@ -118,9 +118,9 @@
|
|||||||
"Description text (patterns)" or just "patterns". A file chooser
|
"Description text (patterns)" or just "patterns". A file chooser
|
||||||
that provides filters for HTML and image files might look like:
|
that provides filters for HTML and image files might look like:
|
||||||
|
|
||||||
<UL><PRE>
|
\code
|
||||||
"HTML Files (*.html)\tImage Files (*.{bmp,gif,jpg,png})"
|
"HTML Files (*.html)\tImage Files (*.{bmp,gif,jpg,png})"
|
||||||
</PRE></UL>
|
\endcode
|
||||||
|
|
||||||
<P>The file chooser will automatically add the "All Files (*)"
|
<P>The file chooser will automatically add the "All Files (*)"
|
||||||
pattern to the end of the string you pass if you do not provide
|
pattern to the end of the string you pass if you do not provide
|
||||||
@@ -253,13 +253,13 @@
|
|||||||
Fl_File_Chooser::count().
|
Fl_File_Chooser::count().
|
||||||
|
|
||||||
<P>This sample code loops through all selected files:
|
<P>This sample code loops through all selected files:
|
||||||
<PRE>
|
\code
|
||||||
// Get list of filenames user selected from a MULTI chooser
|
// Get list of filenames user selected from a MULTI chooser
|
||||||
for ( int t=1; t<=chooser->count(); t++ ) {
|
for ( int t=1; t<=chooser->count(); t++ ) {
|
||||||
const char *filename = chooser->value(t);
|
const char *filename = chooser->value(t);
|
||||||
..
|
..
|
||||||
}
|
}
|
||||||
</PRE>
|
\endcode
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** \fn const char *Fl_File_Chooser::value(int file)
|
/** \fn const char *Fl_File_Chooser::value(int file)
|
||||||
|
|||||||
@@ -581,9 +581,9 @@ int Fl_File_Icon::load_image(const char *ifile) // I - File to read from
|
|||||||
FileChooser widget and should be used when the application
|
FileChooser widget and should be used when the application
|
||||||
starts:
|
starts:
|
||||||
|
|
||||||
<UL><PRE>
|
\code
|
||||||
Fl_File_Icon::load_system_icons();
|
Fl_File_Icon::load_system_icons();
|
||||||
</PRE></UL>
|
\endcode
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Fl_File_Icon::load_system_icons(void) {
|
Fl_File_Icon::load_system_icons(void) {
|
||||||
|
|||||||
+4
-4
@@ -207,19 +207,19 @@ int Fl_Menu_Item::add(
|
|||||||
<P>Shortcut can be 0L, or either a modifier/key combination (for example
|
<P>Shortcut can be 0L, or either a modifier/key combination (for example
|
||||||
FL_CTRL+'A') or a string describing the shortcut in one of two ways:</p>
|
FL_CTRL+'A') or a string describing the shortcut in one of two ways:</p>
|
||||||
|
|
||||||
<pre>
|
\code
|
||||||
[#+^]<ascii_value> eg. "97", "^97", "+97", "#97"
|
[#+^]<ascii_value> eg. "97", "^97", "+97", "#97"
|
||||||
[#+^]<ascii_char> eg. "a", "^a", "+a", "#a"
|
[#+^]<ascii_char> eg. "a", "^a", "+a", "#a"
|
||||||
</pre>
|
\endcode
|
||||||
..where <ascii_value> is a decimal value representing an
|
..where <ascii_value> is a decimal value representing an
|
||||||
ascii character (eg. 97 is the ascii for 'a'), and the optional
|
ascii character (eg. 97 is the ascii for 'a'), and the optional
|
||||||
prefixes enhance the value that follows. Multiple prefixes must
|
prefixes enhance the value that follows. Multiple prefixes must
|
||||||
appear in the above order.
|
appear in the above order.
|
||||||
<pre>
|
\code
|
||||||
# - Alt
|
# - Alt
|
||||||
+ - Shift
|
+ - Shift
|
||||||
^ - Control
|
^ - Control
|
||||||
</pre>
|
\endcode
|
||||||
Text shortcuts are converted to integer shortcut by calling
|
Text shortcuts are converted to integer shortcut by calling
|
||||||
int fl_old_shortcut(const char*).
|
int fl_old_shortcut(const char*).
|
||||||
|
|
||||||
|
|||||||
+4
-3
@@ -51,7 +51,8 @@ static uchar inactive_ramp[24] = {
|
|||||||
49, 49, 50, 50,
|
49, 49, 50, 50,
|
||||||
51, 51, 52, 52};
|
51, 51, 52, 52};
|
||||||
static int draw_it_active = 1;
|
static int draw_it_active = 1;
|
||||||
|
/** Determines if the current draw box is active or inactive.
|
||||||
|
If inactive, the box color is changed by the inactive color. */
|
||||||
int Fl::draw_box_active() { return draw_it_active; }
|
int Fl::draw_box_active() { return draw_it_active; }
|
||||||
|
|
||||||
uchar *fl_gray_ramp() {return (draw_it_active?active_ramp:inactive_ramp)-'A';}
|
uchar *fl_gray_ramp() {return (draw_it_active?active_ramp:inactive_ramp)-'A';}
|
||||||
@@ -275,12 +276,12 @@ int Fl::box_dx(Fl_Boxtype t) {return fl_box_table[t].dx;}
|
|||||||
respectively.
|
respectively.
|
||||||
|
|
||||||
<P>An example to compute the area inside a widget's box():
|
<P>An example to compute the area inside a widget's box():
|
||||||
<pre>
|
\code
|
||||||
int X = yourwidget->x() + Fl::box_dx(yourwidget->box());
|
int X = yourwidget->x() + Fl::box_dx(yourwidget->box());
|
||||||
int Y = yourwidget->y() + Fl::box_dy(yourwidget->box());
|
int Y = yourwidget->y() + Fl::box_dy(yourwidget->box());
|
||||||
int W = yourwidget->w() - Fl::box_dw(yourwidget->box());
|
int W = yourwidget->w() - Fl::box_dw(yourwidget->box());
|
||||||
int H = yourwidget->h() - Fl::box_dh(yourwidget->box());
|
int H = yourwidget->h() - Fl::box_dh(yourwidget->box());
|
||||||
</pre>
|
\endcode
|
||||||
<P>These functions are mainly useful in the draw() code
|
<P>These functions are mainly useful in the draw() code
|
||||||
for deriving custom widgets, where one wants to avoid drawing
|
for deriving custom widgets, where one wants to avoid drawing
|
||||||
over the widget's own border box().
|
over the widget's own border box().
|
||||||
|
|||||||
+4
-8
@@ -44,21 +44,18 @@ void Fl_Free::step(void *v) {
|
|||||||
/**
|
/**
|
||||||
The constructor takes both the type and the handle
|
The constructor takes both the type and the handle
|
||||||
function. The handle function should be declared as follows:
|
function. The handle function should be declared as follows:
|
||||||
<UL>
|
\code
|
||||||
<PRE>
|
|
||||||
int
|
int
|
||||||
handle_function(Fl_Widget *w,
|
handle_function(Fl_Widget *w,
|
||||||
int event,
|
int event,
|
||||||
float event_x,
|
float event_x,
|
||||||
float event_y,
|
float event_y,
|
||||||
char key)
|
char key)
|
||||||
</PRE>
|
\endcode
|
||||||
</UL>
|
|
||||||
This function is called from the the handle() method in
|
This function is called from the the handle() method in
|
||||||
response to most events, and is called by the draw() method.
|
response to most events, and is called by the draw() method.
|
||||||
The event argument contains the event type:
|
The event argument contains the event type:
|
||||||
<UL>
|
\code
|
||||||
<PRE>
|
|
||||||
// old event names for compatibility:
|
// old event names for compatibility:
|
||||||
#define FL_MOUSE FL_DRAG
|
#define FL_MOUSE FL_DRAG
|
||||||
#define FL_DRAW 0
|
#define FL_DRAW 0
|
||||||
@@ -66,8 +63,7 @@ void Fl_Free::step(void *v) {
|
|||||||
#define FL_FREEMEM 12
|
#define FL_FREEMEM 12
|
||||||
#define FL_FREEZE FL_UNMAP
|
#define FL_FREEZE FL_UNMAP
|
||||||
#define FL_THAW FL_MAP
|
#define FL_THAW FL_MAP
|
||||||
</PRE>
|
\endcode
|
||||||
</UL>
|
|
||||||
*/
|
*/
|
||||||
Fl_Free::Fl_Free(uchar t,int X, int Y, int W, int H,const char *l,
|
Fl_Free::Fl_Free(uchar t,int X, int Y, int W, int H,const char *l,
|
||||||
FL_HANDLEPTR hdl) :
|
FL_HANDLEPTR hdl) :
|
||||||
|
|||||||
@@ -109,19 +109,6 @@ void gl_finish() {
|
|||||||
glXWaitGL();
|
glXWaitGL();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
This does the same thing as
|
|
||||||
Fl::visual(int) but also
|
|
||||||
requires OpenGL drawing to work. This <I>must</I> be done if
|
|
||||||
you want to draw in normal windows with OpenGL with gl_start() and
|
|
||||||
gl_end(). It may be useful to call this so your X
|
|
||||||
windows use the same visual as an
|
|
||||||
Fl_Gl_Window, which on
|
|
||||||
some servers will reduce colormap flashing.
|
|
||||||
|
|
||||||
<P>See Fl_Gl_Window
|
|
||||||
for a list of additional values for the argument.
|
|
||||||
*/
|
|
||||||
int Fl::gl_visual(int mode, int *alist) {
|
int Fl::gl_visual(int mode, int *alist) {
|
||||||
Fl_Gl_Choice *c = Fl_Gl_Choice::find(mode,alist);
|
Fl_Gl_Choice *c = Fl_Gl_Choice::find(mode,alist);
|
||||||
if (!c) return 0;
|
if (!c) return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user