summaryrefslogtreecommitdiff
path: root/src/Fl_Message.cxx
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2021-12-04 20:36:11 +0100
committerAlbrecht Schlosser <albrechts.fltk@online.de>2021-12-04 20:36:11 +0100
commita0724ab7c4fedbd037d5b72332ae47fde8584dff (patch)
tree2c2c37ac226d7b26d2c050fc62af12aa0f9efe68 /src/Fl_Message.cxx
parent130f864d1d3f02f854a5f4085a49318a03a8eea0 (diff)
Add fl_message_icon_label() function (STR #2762)
This message icon label (usually one character) will be used in the next call of one of the common dialogs. test/ask.cxx: use fl_message_icon_label()
Diffstat (limited to 'src/Fl_Message.cxx')
-rw-r--r--src/Fl_Message.cxx17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/Fl_Message.cxx b/src/Fl_Message.cxx
index 1b93ecad3..0aa7ed587 100644
--- a/src/Fl_Message.cxx
+++ b/src/Fl_Message.cxx
@@ -65,6 +65,8 @@
const char *Fl_Message::message_title_default_;
const char *Fl_Message::message_title_;
+const char *Fl_Message::message_icon_label_;
+
Fl_Box *Fl_Message::message_icon_;
char *Fl_Message::input_buffer_;
@@ -123,6 +125,9 @@ void Fl_Message::window_cb_(Fl_Widget *w, void *d) {
The constructor creates a default message window and sets the icon type
to the given \p iconlabel which can be any character (or string).
+ If fl_message_icon_label() has been called before this label is used
+ instead and reset to NULL after the message window has been created.
+
Message text box (Fl_Box), icon (Fl_Box), and an input (Fl_Input) widgets
are created and initialized. Three buttons are created and arranged right to
left in the message window. The second (middle) button is an Fl_Return_Button.
@@ -157,7 +162,13 @@ Fl_Message::Fl_Message(const char *iconlabel)
icon_->labelsize(icon_template->labelsize());
icon_->color(icon_template->color());
icon_->labelcolor(icon_template->labelcolor());
- icon_->label(iconlabel);
+
+ 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)
+ icon_->label(iconlabel);
+ }
window_->end(); // don't add the buttons automatically
@@ -526,6 +537,10 @@ void Fl_Message::message_title_default(const char *title) {
message_title_default_ = strdup(title);
}
+void Fl_Message::icon_label(const char *str) {
+ message_icon_label_ = str;
+}
+
/**
\}
\endcond