2 /* This file is part of
3 * ======================================================
5 * LyX, The Document Processor
7 * Copyright 1995 1996 Matthias Ettrich
8 * Copyright 1995-2001 The LyX Team
10 * ====================================================== */
12 // Misc. GUI specific routines
14 #ifndef LYX_GUI_MISC_H
15 #define LYX_GUI_MISC_H
21 #include FORMS_H_LOCATION
23 #include <utility> /* needed for pair<> definition */
25 /// Prevents LyX from being killed when the close box is pressed in a popup.
26 extern "C" int CancelCloseBoxCB(FL_FORM *, void *);
28 /** Redraw the form (on receipt of a Signal indicating, for example,
29 that the xform colors have been re-mapped). */
30 void RedrawAllBufferRelatedDialogs();
32 /// Prevents LyX from crashing when no buffers available
33 void CloseAllBufferRelatedDialogs();
35 /// Ensures info in visible popups are always correct.
36 void updateAllVisibleBufferRelatedDialogs(bool switched = false);
38 /* These shortcut extractors should be shifted to frontends/xforms/ eventually */
40 /// Extract shortcut from <ident>|<shortcut> string
41 char const * flyx_shortcut_extract(char const * sc);
42 /// Shortcut for flyx_shortcut_extract
43 #define scex flyx_shortcut_extract
45 /// Extract shortcut from <ident>|<shortcut> string
46 char const * flyx_ident_extract(char const * sc);
47 /// Shortcut for flyx_ident_extract
48 #define idex flyx_ident_extract
51 void WriteAlert(string const & s1, string const & s2 = string(),
52 string const & s3 = string());
54 /// Alarms user of something related to files
55 void WriteFSAlert(string const & s1, string const & s2 = string());
57 /// Asks "Yes" or "No". Returns true for yes, false for no
58 bool AskQuestion(string const & s1, string const & s2 = string(),
59 string const & s3 = string(), bool default_value = true);
61 /// Asks "Yes", "No" or "Cancel". Returns 1 for yes, 2 for no, 3 for cancel
62 int AskConfirmation(string const & s1, string const & s2 = string(),
63 string const & s3 = string(), int default_value = 1);
65 /// returns a bool: false=cancelled, true=okay. string contains returned text
66 std::pair<bool, string> const
67 askForText(string const & msg,
68 string const & dflt = string());
70 /// Informs the user that changes in the coming form will be ignored
71 void WarnReadonly(string const & file);
73 /// Get the dpi setting of the current screen