Fix "fl_message_icon() regression" (#395)

Some attributes of the default message icon had not been copied to
the new Fl_Message class when opening a new dialog.

Clarify documentation about supported icon attributes.
This commit is contained in:
Albrecht Schlosser 2022-02-16 14:48:23 +01:00
parent 390095392b
commit 1cdd669dc6
2 changed files with 25 additions and 3 deletions

View File

@ -163,11 +163,15 @@ Fl_Message::Fl_Message(const char *iconlabel)
icon_->labelsize(icon_template->labelsize());
icon_->color(icon_template->color());
icon_->labelcolor(icon_template->labelcolor());
icon_->image(icon_template->image());
icon_->align(icon_template->align());
if (message_icon_label_) { // fl_message_icon_label() has been called
if (message_icon_label_) { // fl_message_icon_label() has been called
icon_->copy_label(message_icon_label_);
message_icon_label_ = 0;
} else { // use default (static, per message default string)
} else if (icon_template->label()) { // sticky icon template label() has been set
icon_->copy_label(icon_template->label());
} else { // default string (c'tor argument)
icon_->label(iconlabel);
}

View File

@ -256,6 +256,24 @@ int fl_choice_n(const char *fmt, const char *b0, const char *b1, const char *b2,
The return value cannot be Null. The object pointed to is an Fl_Box widget.
The returned pointer (Fl_Widget *) can be safely cast to an Fl_Box* pointer.
\note You can set some attributes of this \b default icon box. These attributes
are sticky, i.e. they will be used in all subsequent common dialogs unless
overridden by specific "one shot" variables. Setting any attribute except
those mentioned below causes undefined behavior.
Supported icon attributes:
- box()
- labelfont()
- labelsize()
- color()
- labelcolor()
- image()
- align()
The icon size can not be changed. If you set an image() you should scale it
to the available size, i.e. \p w() and \p h() of the icon box.
\code #include <FL/fl_ask.H> \endcode
*/
Fl_Widget *fl_message_icon() {
@ -267,7 +285,7 @@ Fl_Widget *fl_message_icon() {
This version of fl_input() is deprecated. The return value points
to an internal allocated string that may be changed later. You must
copy the string immediately after return from this method - at least
before the next call of the event loop.
before the next execution of the event loop.
\deprecated Please use
fl_input_str(int maxchar, const char *fmt, const char *defstr, ...) instead.