FLTK 1.4.4
Toggle main menu visibility
Loading...
Searching...
No Matches
Fl_Message.h
1
//
2
// Common dialog header file for the Fast Light Tool Kit (FLTK).
3
//
4
// Copyright 1998-2022 by Bill Spitzak and others.
5
//
6
// This library is free software. Distribution and use rights are outlined in
7
// the file "COPYING" which should have been included with this file. If this
8
// file is missing or damaged, see the license at:
9
//
10
// https://www.fltk.org/COPYING.php
11
//
12
// Please see the following page on how to report bugs and issues:
13
//
14
// https://www.fltk.org/bugs.php
15
//
16
17
#ifndef _src_Fl_Message_h_
18
#define _src_Fl_Message_h_
19
20
#include <
FL/Fl_Window.H
>
21
#include <
FL/Fl_Box.H
>
22
#include <
FL/fl_ask.H
>
23
24
class
Fl_Button
;
25
class
Fl_Input
;
26
34
41
42
/* Note: Do not FL_EXPORT this class, it's for internal use only */
43
44
class
Fl_Message_Box :
public
Fl_Box
{
45
public
:
46
Fl_Message_Box(
int
X,
int
Y,
int
W,
int
H)
47
: Fl_Box(X, Y, W, H) {}
48
int
handle
(
int
e)
FL_OVERRIDE
;
49
};
// class Fl_Message_Box
50
71
72
/* Note: Do not FL_EXPORT this class, it's for internal use only */
73
74
class
Fl_Message {
75
76
// static variables and methods
77
78
private
:
79
static
Fl_Box *message_icon_;
// returned by Fl_Message::message_icon()
80
81
static
const
char
*message_title_;
82
static
const
char
*message_title_default_;
83
84
// icon label for next dialog (STR #2762)
85
static
const
char
*message_icon_label_;
86
87
// Note: since Fl_Message objects are destroyed before fl_input()
88
// and fl_password() return their input text, we *need* to store
89
// the text in an internal (static) buffer. :-(
90
91
static
char
*input_buffer_;
// points to the allocated text buffer
92
static
int
input_size_;
// size of allocated text buffer
93
94
// the callback for all buttons:
95
static
void
button_cb_(Fl_Widget *w,
void
*d);
96
97
// the window callback:
98
static
void
window_cb_(Fl_Widget *w,
void
*d);
99
100
// resize to make text and buttons fit
101
void
resizeform();
102
103
public
:
104
static
Fl_Box *message_icon();
105
static
void
message_title(
const
char
*title);
106
static
void
message_title_default(
const
char
*title);
107
static
void
icon_label(
const
char
*str);
108
110
static
void
message_position(
const
int
x,
const
int
y,
const
int
center) {
111
form_x_ = x;
112
form_y_ = y;
113
form_position_ = center ? 2 : 1;
114
}
115
117
static
void
message_position(Fl_Widget *widget) {
118
int
xo, yo;
119
Fl_Window *win = widget->
top_window_offset
(xo, yo);
120
form_x_ = xo + widget->
w
() / 2;
121
form_y_ = yo + widget->
h
() / 2;
122
if
(win) {
123
form_x_ += win->
x
();
124
form_y_ += win->
y
();
125
}
126
form_position_ = 2;
127
}
128
130
static
int
message_position(
int
*x,
int
*y) {
131
if
(x)
132
*x = form_position_ ? form_x_ : -1;
133
if
(y)
134
*y = form_position_ ? form_y_ : -1;
135
return
form_position_;
136
}
137
139
static
void
message_hotspot(
int
enable) { enable_hotspot_ = enable ? 1 : 0; }
140
142
static
int
message_hotspot() {
return
enable_hotspot_; }
143
144
int
window_closed()
const
{
145
return
window_closed_;
146
}
147
148
// member variables and methods
149
150
private
:
151
Fl_Window *window_;
152
Fl_Message_Box *message_;
153
Fl_Box *icon_;
154
Fl_Button *button_[3];
155
Fl_Input *input_;
156
int
retval_;
157
int
window_closed_;
158
159
// static (private) variables
160
161
static
int
enable_hotspot_;
162
static
int
form_x_;
163
static
int
form_y_;
164
static
int
form_position_;
165
166
public
:
167
// Constructor
168
Fl_Message(
const
char
*iconlabel);
170
~Fl_Message() {
delete
window_; }
171
172
int
innards(
const
char
*fmt, va_list ap,
const
char
*b0,
const
char
*b1,
const
char
*b2);
173
174
const
char
*input_innards(
const
char
*fmt, va_list ap,
const
char
*defstr,
uchar
type,
int
maxchar = -1,
bool
str =
false
);
175
};
176
181
182
#endif
// _src_Fl_Message_h_
Fl_Box.H
Fl_Box widget.
Fl_Window.H
Fl_Window widget .
Fl_Box
This widget simply draws its box, and possibly its label.
Definition
Fl_Box.H:34
Fl_Box::handle
int handle(int) FL_OVERRIDE
Handles the specified event.
Definition
Fl_Box.cxx:37
Fl_Button
Buttons generate callbacks when they are clicked by the user.
Definition
Fl_Button.H:76
Fl_Input
This is the FLTK text input widget.
Definition
Fl_Input.H:220
Fl_Widget::x
void x(int v)
Internal use only.
Definition
Fl_Widget.H:150
Fl_Widget::w
void w(int v)
Internal use only.
Definition
Fl_Widget.H:154
Fl_Widget::y
void y(int v)
Internal use only.
Definition
Fl_Widget.H:152
Fl_Widget::h
void h(int v)
Internal use only.
Definition
Fl_Widget.H:156
Fl_Widget::top_window_offset
Fl_Window * top_window_offset(int &xoff, int &yoff) const
Finds the x/y offset of the current widget relative to the top-level window.
Definition
Fl_Window.cxx:130
fl_ask.H
API for common dialogs.
FL_OVERRIDE
#define FL_OVERRIDE
This macro makes it safe to use the C++11 keyword override with older compilers.
Definition
fl_attr.h:46
uchar
unsigned char uchar
unsigned char
Definition
fl_types.h:30
src
Fl_Message.h
Generated by
1.17.0