mirror of https://github.com/fltk/fltk
Fixed bad comments in fl_color_chooser, r g b param are in/out params and not in. Added param and return dox commands to these functions. Added a new Common Dialogs Module containing all fl_ask,fl,fl_color,fl_file dialogs. Fixed the fl_old_shortcut appearing in Fl_Button.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6367 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
b763b271a7
commit
fabf5fc181
19
FL/Fl.H
19
FL/Fl.H
|
@ -254,10 +254,9 @@ public:
|
|||
static int damage() {return damage_;}
|
||||
static void redraw();
|
||||
static void flush();
|
||||
/** \defgroup fl_windows Windows handling functions
|
||||
Windows and standard dialogs handling
|
||||
/** \addtogroup group_comdlg
|
||||
@{ */
|
||||
/** \fn void (*warning)(const char*, ...)
|
||||
/**
|
||||
FLTK calls this to print a warning message. You can
|
||||
override the behavior by setting the function pointer to your
|
||||
own routine.
|
||||
|
@ -272,7 +271,7 @@ public:
|
|||
own routine.
|
||||
<P>Fl::error means there is a recoverable error such as
|
||||
the inability to read an image file. The default implementation
|
||||
prints the error message to stderr and returns.
|
||||
shows an error dialog to stderr and returns.
|
||||
*/
|
||||
static void (*error)(const char*, ...);
|
||||
/**
|
||||
|
@ -282,13 +281,19 @@ public:
|
|||
<P>Fl::fatal must not return, as FLTK is in an unusable
|
||||
state, however your version may be able to use longjmp
|
||||
or an exception to continue, as long as it does not call FLTK
|
||||
again. The default implementation prints the error message to
|
||||
stderr and exits with status 1.
|
||||
again. The default implementation shows a fatal dialog box
|
||||
and exits with status 1.
|
||||
*/
|
||||
static void (*fatal)(const char*, ...);
|
||||
/** @} */
|
||||
|
||||
/** \defgroup fl_windows Windows handling functions
|
||||
Windows and standard dialogs handling
|
||||
@{ */
|
||||
static Fl_Window* first_window();
|
||||
static void first_window(Fl_Window*);
|
||||
static Fl_Window* next_window(const Fl_Window*);
|
||||
|
||||
/**
|
||||
Returns the top-most modal() window currently shown.
|
||||
This is the most recently
|
||||
|
@ -805,7 +810,7 @@ public:
|
|||
/** @} */
|
||||
|
||||
#ifdef HAVE_CAIRO
|
||||
/** \defgroup group_cairo Cairo functions support
|
||||
/** \defgroup group_cairo Cairo support functions and classes
|
||||
@{
|
||||
*/
|
||||
public:
|
||||
|
|
|
@ -43,7 +43,9 @@
|
|||
are set to zero.*/
|
||||
#define FL_HIDDEN_BUTTON 3 ///< for Forms compatibility
|
||||
|
||||
#ifndef FL_DOXYGEN
|
||||
extern FL_EXPORT int fl_old_shortcut(const char*);
|
||||
#endif
|
||||
|
||||
/**
|
||||
\class Fl_Button
|
||||
|
|
|
@ -76,6 +76,9 @@ public:
|
|||
|
||||
#endif // !FL_DOXYGEN
|
||||
|
||||
/** \addtogroup group_comdlg
|
||||
@{ */
|
||||
|
||||
/**
|
||||
\class Fl_Color_Chooser
|
||||
\brief The Fl_Color_Chooser widget provides a standard RGB color chooser.
|
||||
|
@ -108,6 +111,7 @@ public:
|
|||
user picks! You can however use fl_rectf() to fill a region with a simulated
|
||||
color using dithering.
|
||||
*/
|
||||
/** @} */
|
||||
class FL_EXPORT Fl_Color_Chooser : public Fl_Group {
|
||||
Flcc_HueBox huebox;
|
||||
Flcc_ValueBox valuebox;
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
# include "Enumerations.H"
|
||||
|
||||
class Fl_Widget;
|
||||
|
||||
/** Different system beeps available. \relatesalso fl_beep(int) */
|
||||
enum {
|
||||
FL_BEEP_DEFAULT = 0,
|
||||
FL_BEEP_MESSAGE,
|
||||
|
@ -73,7 +73,6 @@ extern FL_EXPORT const char* fl_yes;
|
|||
extern FL_EXPORT const char* fl_ok;
|
||||
extern FL_EXPORT const char* fl_cancel;
|
||||
extern FL_EXPORT const char* fl_close;
|
||||
|
||||
#endif // !fl_ask_H
|
||||
|
||||
//
|
||||
|
|
|
@ -526,12 +526,16 @@ static void chooser_cb(Fl_Object* o, void* vv) {
|
|||
extern const char* fl_ok;
|
||||
extern const char* fl_cancel;
|
||||
|
||||
/** \addtogroup group_comdlg
|
||||
@{ */
|
||||
/**
|
||||
\relatesalso Fl_Color_Chooser
|
||||
\fn int fl_color_chooser(const char* name, double& r, double& g, double& b)
|
||||
\brief Pops up a window to let the user pick an arbitrary RGB color.
|
||||
\param[in] name title label for the window
|
||||
\param[in] r, g, b color components in the range 0.0 to 1.0.
|
||||
\image html fl_color_chooser.jpg
|
||||
\param[in,out] name title label for the window
|
||||
\param[in,out] r, g, b color components in the range 0.0 to 1.0.
|
||||
\retval 1 if user confirms the selection
|
||||
\retval 0 if user cancels the dialog
|
||||
\relates Fl_Color_Chooser
|
||||
*/
|
||||
int fl_color_chooser(const char* name, double& r, double& g, double& b) {
|
||||
Fl_Window window(215,200,name);
|
||||
|
@ -568,11 +572,13 @@ int fl_color_chooser(const char* name, double& r, double& g, double& b) {
|
|||
}
|
||||
|
||||
/**
|
||||
\relatesalso Fl_Color_Chooser
|
||||
\fn int fl_color_chooser(const char* name, uchar& r, uchar& g, uchar& b)
|
||||
\brief Pops up a window to let the user pick an arbitrary RGB color.
|
||||
\param[in] name title label for the window
|
||||
\param[in] r, g, b color components in the range 0 to 255.
|
||||
\image html fl_color_chooser.jpg
|
||||
\param[in,out] name title label for the window
|
||||
\param[in,out] r, g, b color components in the range 0 to 255.
|
||||
\retval 1 if user confirms the selection
|
||||
\retval 0 if user cancels the dialog
|
||||
\relates Fl_Color_Chooser
|
||||
*/
|
||||
int fl_color_chooser(const char* name, uchar& r, uchar& g, uchar& b) {
|
||||
double dr = r/255.0;
|
||||
|
@ -586,7 +592,7 @@ int fl_color_chooser(const char* name, uchar& r, uchar& g, uchar& b) {
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** @} */
|
||||
//
|
||||
// End of "$Id$".
|
||||
//
|
||||
|
|
|
@ -26,7 +26,9 @@
|
|||
//
|
||||
|
||||
// fabien: ATTENTION: Only Out Of Source Gen. because cxx/H files are autogenerated by fluid.
|
||||
|
||||
/** \defgroup group_comdlg Common Dialogs classes and functions
|
||||
@{
|
||||
*/
|
||||
/** \class Fl_File_Chooser
|
||||
The Fl_File_Chooser widget displays a standard file selection
|
||||
dialog that supports various selection modes.
|
||||
|
@ -110,6 +112,7 @@
|
|||
can control their appearance and use. For more complex customization,
|
||||
consider copying the FLTK file chooser code and changing it accordingly.
|
||||
*/
|
||||
/** @} */
|
||||
|
||||
/** \fn Fl_File_Chooser::Fl_File_Chooser(const char *pathname, const char *pattern, int type, const char *title)
|
||||
The constructor creates the Fl_File_Chooser dialog shown.
|
||||
|
@ -284,9 +287,8 @@
|
|||
Returns pointer for previous extra widget or NULL if not set previously.
|
||||
If argument is NULL only remove previous extra widget.
|
||||
|
||||
<I>NOTE! Fl_File_Chooser doesn't delete extra widget in destructor!
|
||||
To prevent memory leakage don't forget delete unused extra widgets
|
||||
by yourself.</I>
|
||||
\note Fl_File_Chooser does \b not delete extra widget in destructor!
|
||||
To prevent memory leakage, don't forget to delete unused extra widgets
|
||||
*/
|
||||
/** \fn int Fl_File_Chooser::shown()
|
||||
Returns non-zero if the file chooser main window show() has been called (but not hide()
|
||||
|
@ -301,7 +303,6 @@
|
|||
|
||||
/** \fn void * Fl_File_Chooser::user_data() const
|
||||
Gets the file chooser user data d */
|
||||
|
||||
// *** END OF OUT OF SOURCE DOC ***
|
||||
|
||||
// Contents:
|
||||
|
@ -324,9 +325,9 @@
|
|||
// Fl_File_Chooser::add_extra() - add extra widget at the bottom, return pointer
|
||||
// to previous extra widget or NULL if none,
|
||||
// If argument is NULL extra widget removed.
|
||||
// NOTE! file chooser don't delete extra widget in
|
||||
// NOTE! file chooser does't delete extra widget in
|
||||
// destructor! To prevent memory leakage don't forget
|
||||
// delete unused extra widgets by yuorself.
|
||||
// delete unused extra widgets by yourself.
|
||||
//
|
||||
|
||||
//
|
||||
|
|
|
@ -228,14 +228,21 @@ static int innards(const char* fmt, va_list ap,
|
|||
return r;
|
||||
}
|
||||
|
||||
/** \addtogroup group_comdlg
|
||||
@{ */
|
||||
|
||||
// pointers you can use to change FLTK to a foreign language:
|
||||
const char* fl_no = "No";
|
||||
const char* fl_yes= "Yes";
|
||||
const char* fl_ok = "OK";
|
||||
const char* fl_cancel= "Cancel";
|
||||
const char* fl_close= "Close";
|
||||
const char* fl_no = "No"; ///< string pointer used in common dialogs, you can change it to a foreign language
|
||||
const char* fl_yes= "Yes"; ///< string pointer used in common dialogs, you can change it to a foreign language
|
||||
const char* fl_ok = "OK"; ///< string pointer used in common dialogs, you can change it to a foreign language
|
||||
const char* fl_cancel= "Cancel"; ///< string pointer used in common dialogs, you can change it to a foreign language
|
||||
const char* fl_close= "Close"; ///< string pointer used in common dialogs, you can change it to a foreign language
|
||||
|
||||
// fltk functions:
|
||||
|
||||
/**
|
||||
Emits a system beep message.
|
||||
*/
|
||||
void fl_beep(int type) {
|
||||
#ifdef WIN32
|
||||
switch (type) {
|
||||
|
@ -281,7 +288,9 @@ void fl_beep(int type) {
|
|||
}
|
||||
#endif // WIN32
|
||||
}
|
||||
|
||||
/** Shows an information message dialog box
|
||||
\param fmt can be used as an sprintf-like format and variables for the message text
|
||||
*/
|
||||
void fl_message(const char *fmt, ...) {
|
||||
va_list ap;
|
||||
|
||||
|
@ -294,6 +303,9 @@ void fl_message(const char *fmt, ...) {
|
|||
iconlabel = "?";
|
||||
}
|
||||
|
||||
/** Shows an alert message dialog box
|
||||
\param fmt can be used as an sprintf-like format and variables for the message text
|
||||
*/
|
||||
void fl_alert(const char *fmt, ...) {
|
||||
va_list ap;
|
||||
|
||||
|
@ -305,7 +317,12 @@ void fl_alert(const char *fmt, ...) {
|
|||
va_end(ap);
|
||||
iconlabel = "?";
|
||||
}
|
||||
|
||||
/** Shows a dialog displaying the \a fmt message,
|
||||
this dialog features 2 yes/no buttons
|
||||
\param fmt can be used as an sprintf-like format and variables for the message text
|
||||
\retval 0 if the no button is selected
|
||||
\retval 1 if yes is selected
|
||||
*/
|
||||
int fl_ask(const char *fmt, ...) {
|
||||
va_list ap;
|
||||
|
||||
|
@ -318,6 +335,13 @@ int fl_ask(const char *fmt, ...) {
|
|||
return r;
|
||||
}
|
||||
|
||||
/** Shows a dialog displaying the \a fmt message,
|
||||
this dialog features up to 3 customizable choice buttons
|
||||
\param fmt can be used as an sprintf-like format and variables for the message text
|
||||
\retval 0 if the first button with \a b0 text is selected
|
||||
\retval 1 if the second button with \a b1 text is selected
|
||||
\retval 2 if the third button with \a b2 text is selected
|
||||
*/
|
||||
int fl_choice(const char*fmt,const char *b0,const char *b1,const char *b2,...){
|
||||
va_list ap;
|
||||
|
||||
|
@ -328,7 +352,10 @@ int fl_choice(const char*fmt,const char *b0,const char *b1,const char *b2,...){
|
|||
va_end(ap);
|
||||
return r;
|
||||
}
|
||||
|
||||
/** Gets the Fl_Box icon container of the current default dialog used in
|
||||
many common dialogs like fl_message(), fl_alert(),
|
||||
fl_ask(), fl_choice(), fl_input(), fl_password()
|
||||
*/
|
||||
Fl_Widget *fl_message_icon() {makeform(); return icon;}
|
||||
|
||||
static const char* input_innards(const char* fmt, va_list ap,
|
||||
|
@ -346,6 +373,11 @@ static const char* input_innards(const char* fmt, va_list ap,
|
|||
return r ? input->value() : 0;
|
||||
}
|
||||
|
||||
/** Shows an input dialog displaying the \a fmt message
|
||||
\param fmt can be used as an sprintf-like format and variables for the message text
|
||||
\param defstr defines the default returned string if no text is entered
|
||||
\return the user string input
|
||||
*/
|
||||
const char* fl_input(const char *fmt, const char *defstr, ...) {
|
||||
fl_beep(FL_BEEP_QUESTION);
|
||||
|
||||
|
@ -356,6 +388,13 @@ const char* fl_input(const char *fmt, const char *defstr, ...) {
|
|||
return r;
|
||||
}
|
||||
|
||||
/** Shows an input dialog displaying the \a fmt message,
|
||||
like fl_input except the input text is not shown,
|
||||
'*' characters are displayed instead
|
||||
\param fmt can be used as an sprintf-like format and variables for the message text
|
||||
\param defstr defines the default returned string if no text is entered
|
||||
\return the user string input
|
||||
*/
|
||||
const char *fl_password(const char *fmt, const char *defstr, ...) {
|
||||
fl_beep(FL_BEEP_PASSWORD);
|
||||
|
||||
|
@ -366,6 +405,8 @@ const char *fl_password(const char *fmt, const char *defstr, ...) {
|
|||
return r;
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
//
|
||||
// End of "$Id$".
|
||||
//
|
||||
|
|
|
@ -42,6 +42,8 @@ static void callback(Fl_File_Chooser *, void*) {
|
|||
(*current_callback)(fc->value());
|
||||
}
|
||||
|
||||
/** \addtogroup group_comdlg
|
||||
@{ */
|
||||
|
||||
/** \relatesalso Fl_File_Chooser
|
||||
Set the file chooser callback
|
||||
|
@ -59,8 +61,15 @@ void fl_file_chooser_ok_label(const char *l) {
|
|||
else current_label = fl_ok;
|
||||
}
|
||||
|
||||
/** \relatesalso Fl_File_Chooser
|
||||
Show a file chooser dialog and get a filename.
|
||||
/** \relates Fl_File_Chooser
|
||||
Shows a file chooser dialog and get a filename.
|
||||
\image html Fl_File_Chooser.jpg
|
||||
\param message text in title bar
|
||||
\param pat filename pattern filter
|
||||
\param fname initial/default filename selection
|
||||
\param relative 0 for absolute path name, relative path name otherwise
|
||||
\return the user selected filename, in absolute or relative format
|
||||
or NULL if user cancels
|
||||
*/
|
||||
char * // O - Filename or NULL
|
||||
fl_file_chooser(const char *message, // I - Message in titlebar
|
||||
|
@ -136,8 +145,12 @@ fl_file_chooser(const char *message, // I - Message in titlebar
|
|||
else return 0;
|
||||
}
|
||||
|
||||
/** \relatesalso Fl_File_Chooser
|
||||
Show a file chooser dialog and get a directory.
|
||||
/** \relates Fl_File_Chooser
|
||||
Shows a file chooser dialog and get a directory.
|
||||
\param[in] message title bar text
|
||||
\param[in] fname initial/default directory name
|
||||
\param[in] relative 0 for absolute path return, relative otherwise
|
||||
\return the directory path string choosen by the user or NULL if user cancels
|
||||
*/
|
||||
|
||||
char * // O - Directory or NULL
|
||||
|
@ -172,6 +185,7 @@ fl_dir_chooser(const char *message, // I - Message for titlebar
|
|||
} else if (fc->value()) return (char *)fc->value();
|
||||
else return 0;
|
||||
}
|
||||
/** @} */
|
||||
|
||||
|
||||
//
|
||||
|
|
|
@ -204,7 +204,6 @@ const char * fl_shortcut_label(int shortcut) {
|
|||
#include <stdlib.h>
|
||||
/**
|
||||
Emulation of XForms named shortcuts.
|
||||
\todo Why does doxygen display fl_old_shortcut() on Fl_Button page?
|
||||
*/
|
||||
int fl_old_shortcut(const char* s) {
|
||||
if (!s || !*s) return 0;
|
||||
|
|
Loading…
Reference in New Issue