Hotspot behavior of fl_message() and other common dialogs is now

optional (STR #2561).


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8415 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Albrecht Schlosser 2011-02-12 11:31:40 +00:00
parent f028f2ec9d
commit f8c0dd0110
3 changed files with 42 additions and 8 deletions

View File

@ -52,6 +52,8 @@ CHANGES IN FLTK 1.3.0
- Added support for shortcuts for Fl_Input_, Fl_Value_Input, and
Fl_Text_Display derived widgets (STR #1770)
- Added Fl_Menu_ methods: insert(), find_index(), clear_submenu()
- Hotspot behavior of fl_message() and other common dialogs is now
optional (STR #2561).
IDE support and command line build options

View File

@ -64,6 +64,9 @@ extern FL_EXPORT Fl_Fontsize fl_message_size_;
inline void fl_message_font(Fl_Font f, Fl_Fontsize s) {
fl_message_font_ = f; fl_message_size_ = s;}
FL_EXPORT void fl_message_hotspot(int enable);
FL_EXPORT int fl_message_hotspot(void);
// pointers you can use to change FLTK to a foreign language:
extern FL_EXPORT const char* fl_no;
extern FL_EXPORT const char* fl_yes;

View File

@ -56,6 +56,7 @@ static int ret_val;
static const char *iconlabel = "?";
Fl_Font fl_message_font_ = FL_HELVETICA;
Fl_Fontsize fl_message_size_ = -1;
static int enableHotspot = 1;
#ifdef __APPLE__
extern "C" void NSBeep(void);
#endif
@ -78,7 +79,7 @@ static Fl_Window *makeform() {
message_form->size(410,103);
return message_form;
}
// make sure that the dialog does not become the child of some
// make sure that the dialog does not become the child of some
// current group
Fl_Group *previously_current_group = Fl_Group::current();
Fl_Group::current(0);
@ -226,9 +227,10 @@ static int innards(const char* fmt, va_list ap,
resizeform();
if (button[1]->visible() && !input->visible())
if (button[1]->visible() && !input->visible())
button[1]->take_focus();
message_form->hotspot(button[0]);
if (enableHotspot)
message_form->hotspot(button[0]);
if (b0 && Fl_Widget::label_shortcut(b0))
button[0]->shortcut(0);
else
@ -290,7 +292,7 @@ void fl_beep(int type) {
break;
default :
break;
}
}
#else
switch (type) {
case FL_BEEP_DEFAULT :
@ -408,11 +410,11 @@ 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()
/** 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()
\note \#include <FL/fl_ask.H>
*/
*/
Fl_Widget *fl_message_icon() {makeform(); return icon;}
static const char* input_innards(const char* fmt, va_list ap,
@ -479,6 +481,33 @@ const char *fl_password(const char *fmt, const char *defstr, ...) {
return r;
}
/** Sets whether or not to move the common message box used in
many common dialogs like fl_message(), fl_alert(),
fl_ask(), fl_choice(), fl_input(), fl_password() to follow
the mouse pointer.
The default is \e enabled, so that the default button is the
hotspot and appears at the mouse position.
\note \#include <FL/fl_ask.H>
\param[in] enable non-zero enables hotspot behavior,
0 disables hotspot
*/
void fl_message_hotspot(int enable) {
enableHotspot = enable ? 1 : 0;
}
/** Gets whether or not to move the common message box used in
many common dialogs like fl_message(), fl_alert(),
fl_ask(), fl_choice(), fl_input(), fl_password() to follow
the mouse pointer.
\note \#include <FL/fl_ask.H>
\return 0 if disable, non-zero otherwise
\see fl_message_hotspot(int)
*/
int fl_message_hotspot(void) {
return enableHotspot;
}
/** @} */
//