FLTK 1.4.5: fl_ask.H Source File

FLTK 1.4.5

Loading...
Searching...
No Matches
fl_ask.H
Go to the documentation of this file.
1//
2// Standard 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
20
21#ifndef _FL_fl_ask_H_
22#define _FL_fl_ask_H_
23
24#include <FL/Enumerations.H>
25#include <FL/fl_attr.h>
26
27#if (FLTK_USE_STD)
28#include <string>
29#endif
30
31class Fl_Widget;
32
40 enum Fl_Beep {
41 FL_BEEP_DEFAULT = 0,
42 FL_BEEP_MESSAGE,
43 FL_BEEP_ERROR,
44 FL_BEEP_QUESTION,
45 FL_BEEP_PASSWORD,
46 FL_BEEP_NOTIFICATION
47};
48
49FL_EXPORT void fl_beep(int type = FL_BEEP_DEFAULT);
50FL_EXPORT void fl_message(const char *, ...) __fl_attr((__format__(__printf__, 1, 2)));
51FL_EXPORT void fl_alert(const char *, ...) __fl_attr((__format__(__printf__, 1, 2)));
52
53// fl_ask() is deprecated since it uses "Yes" and "No" for the buttons,
54// which does not conform to the current FLTK Human Interface Guidelines.
55// Use fl_choice() or fl_choice_n() with the appropriate verbs instead.
56
57FL_EXPORT int fl_ask(const char *, ...) __fl_attr((__format__(__printf__, 1, 2), __deprecated__));
58
59FL_EXPORT int fl_choice(const char *q, const char *b0, const char *b1, const char *b2, ...)
60 __fl_attr((__format__(__printf__, 1, 5)));
61FL_EXPORT const char *fl_input(const char *label, const char *deflt = 0, ...) __fl_attr((__format__(__printf__, 1, 3)));
62FL_EXPORT const char *fl_password(const char *label, const char *deflt = 0, ...)
63 __fl_attr((__format__(__printf__, 1, 3)));
64
65// since FLTK 1.3.8:
66// - fl_choice_n() with extended return value (-2, -1, 0, 1, 2)
67
68FL_EXPORT int fl_choice_n(const char *q, const char *b0, const char *b1, const char *b2, ...)
69 __fl_attr((__format__(__printf__, 1, 5)));
70
71// since FLTK 1.4.0: with 'maxchar' to limit input size
72
73FL_EXPORT const char *fl_input(int maxchar, const char *label, const char *deflt = 0, ...)
74 __fl_attr((__format__(__printf__, 2, 4)));
75
76FL_EXPORT const char *fl_password(int maxchar, const char *label, const char *deflt = 0, ...)
77 __fl_attr((__format__(__printf__, 2, 4)));
78
79// since FLTK 1.4.0 -- only with option FLTK_USE_STD
80
81// - fl_input_str() with limited input size, returns std::string
82// - fl_password_str() with limited input size, returns std::string
83
84#if (FLTK_USE_STD)
85
86FL_EXPORT std::string fl_input_str(int maxchar, const char *label, const char *deflt = 0, ...)
87 __fl_attr((__format__(__printf__, 2, 4)));
88
89FL_EXPORT std::string fl_input_str(int &ret, int maxchar, const char *label, const char *deflt = 0, ...)
90 __fl_attr((__format__(__printf__, 3, 5)));
91
92FL_EXPORT std::string fl_password_str(int maxchar, const char *label, const char *deflt = 0, ...)
93 __fl_attr((__format__(__printf__, 2, 4)));
94
95FL_EXPORT std::string fl_password_str(int &ret, int maxchar, const char *label, const char *deflt = 0, ...)
96 __fl_attr((__format__(__printf__, 3, 5)));
97
98#endif
99
100FL_EXPORT Fl_Widget *fl_message_icon();
101extern FL_EXPORT Fl_Font fl_message_font_;
102extern FL_EXPORT Fl_Fontsize fl_message_size_;
103inline void fl_message_font(Fl_Font f, Fl_Fontsize s) {
104 fl_message_font_ = f;
105 fl_message_size_ = s;
106}
107
108FL_EXPORT void fl_message_hotspot(int enable);
109FL_EXPORT int fl_message_hotspot(void);
110
111// since FLTK 1.4.0: fl_message_position()
112
113FL_EXPORT void fl_message_position(const int x, const int y, const int center = 0);
114FL_EXPORT void fl_message_position(Fl_Widget *widget);
115FL_EXPORT int fl_message_position(int *x = 0, int *y = 0);
116
118 inline void fl_message_position(Fl_Widget &widget) {
119 fl_message_position(&widget);
120}
121
122FL_EXPORT void fl_message_title(const char *title);
123FL_EXPORT void fl_message_title_default(const char *title);
124
125FL_EXPORT void fl_message_icon_label(const char *str);
126
127// pointers you can use to change FLTK to another language:
128extern FL_EXPORT const char *fl_no;
129extern FL_EXPORT const char *fl_yes;
130extern FL_EXPORT const char *fl_ok;
131extern FL_EXPORT const char *fl_cancel;
132extern FL_EXPORT const char *fl_close;
133
134#endif // !_FL_fl_ask_H_
Enumerations.H
This file contains type definitions and general enumerations.
Fl_Font
int Fl_Font
A font number is an index into the internal font table.
Definition Enumerations.H:1063
Fl_Fontsize
int Fl_Fontsize
Size of a font in pixels.
Definition Enumerations.H:1092
Fl_Widget
Fl_Widget is the base class for all widgets in FLTK.
Definition Fl_Widget.H:112
Fl_Widget::label
const char * label() const
Gets the current label text.
Definition Fl_Widget.H:498
Fl_Widget::type
uchar type() const
Gets the widget type.
Definition Fl_Widget.H:351
Fl_Beep
Fl_Beep
Defines the different system beeps available.
Definition fl_ask.H:40
FL_BEEP_MESSAGE
@ FL_BEEP_MESSAGE
Message beep.
Definition fl_ask.H:42
FL_BEEP_NOTIFICATION
@ FL_BEEP_NOTIFICATION
Notification beep.
Definition fl_ask.H:46
FL_BEEP_QUESTION
@ FL_BEEP_QUESTION
Question beep.
Definition fl_ask.H:44
FL_BEEP_ERROR
@ FL_BEEP_ERROR
Error beep.
Definition fl_ask.H:43
FL_BEEP_PASSWORD
@ FL_BEEP_PASSWORD
Password beep.
Definition fl_ask.H:45
FL_BEEP_DEFAULT
@ FL_BEEP_DEFAULT
Default beep.
Definition fl_ask.H:41
fl_attr.h
This file defines compiler-specific macros.
__fl_attr
#define __fl_attr(x)
This section lists macros for Doxygen documentation only.
Definition fl_attr.h:40
fl_yes
const char * fl_yes
string pointer used in common dialogs, you can change it to another language
Definition fl_ask.cxx:64
fl_close
const char * fl_close
string pointer used in common dialogs, you can change it to another language
Definition fl_ask.cxx:67
fl_message_position
void fl_message_position(const int x, const int y, const int center=0)
Sets the preferred position for the message box used in many common dialogs like fl_message(),...
Definition fl_ask.cxx:540
fl_ok
const char * fl_ok
string pointer used in common dialogs, you can change it to another language
Definition fl_ask.cxx:65
fl_message_icon
int const char const char int const char const char Fl_Widget * fl_message_icon()
Gets the Fl_Box icon container of the current default dialog used in many common dialogs like fl_mess...
Definition fl_ask.cxx:289
fl_message_title_default
void fl_message_title_default(const char *title)
Sets the default title of the dialog window used in many common dialogs.
Definition fl_ask.cxx:671
fl_beep
void fl_beep(int type=FL_BEEP_DEFAULT)
Emits a system beep.
Definition fl_ask.cxx:96
fl_message_title
void fl_message_title(const char *title)
Sets the title of the dialog window used in many common dialogs.
Definition fl_ask.cxx:650
fl_cancel
const char * fl_cancel
string pointer used in common dialogs, you can change it to another language
Definition fl_ask.cxx:66
fl_message_icon_label
void fl_message_icon_label(const char *str)
Sets the icon label of the dialog window used in many common dialogs.
Definition fl_ask.cxx:695
fl_no
const char * fl_no
string pointer used in common dialogs, you can change it to another language
Definition fl_ask.cxx:63
fl_message_hotspot
int fl_message_hotspot(void)
Gets whether or not to move the message box used in many common dialogs like fl_message(),...
Definition fl_ask.cxx:631