]> git.lyx.org Git - lyx.git/blob - src/lyx_gui_misc.h
e2052595f00d456fa79fd3bdc8b24c0dd6cfc1c7
[lyx.git] / src / lyx_gui_misc.h
1 // -*- C++ -*-
2 /* This file is part of
3  * ======================================================
4  * 
5  *           LyX, The Document Processor
6  *        
7  *           Copyright 1995 1996 Matthias Ettrich
8  *           Copyright 1995-2000 The LyX Team
9  *
10  * ====================================================== */
11
12 // Misc. GUI specific routines
13
14 #ifndef LYX_GUI_MISC_H
15 #define LYX_GUI_MISC_H
16
17 #include FORMS_H_LOCATION
18 #include "LString.h"
19 #include <utility>  /* needed for pair<> definition */
20
21 using std::pair;
22
23 /// Prevents LyX from being killed when the close box is pressed in a popup.
24 extern "C" int CancelCloseBoxCB(FL_FORM *, void *);
25 /// Prevents LyX from being killed when the close box is pressed in a popup.
26 extern "C" int IgnoreCloseBoxCB(FL_FORM *, void *);
27
28 /// Prevents LyX from crashing when no buffers available
29 void CloseAllBufferRelatedPopups();
30
31 /// Ensures info in visible popups are always correct.
32 void updateAllVisibleBufferRelatedPopups();
33
34 /// Extract shortcut from <ident>|<shortcut> string
35 char const * flyx_shortcut_extract(char const * sc);
36 /// Make a shortnamed version of the above func
37 #define scex flyx_shortcut_extract
38
39 /// Extract shortcut from <ident>|<shortcut> string
40 char const * flyx_ident_extract(char const * sc);
41 /// Make a shortnamed versjon of the above func
42 #define idex flyx_ident_extract
43
44 /// Show message
45 void WriteAlert(string const & s1, string const & s2 = string(), 
46                 string const & s3 = string());
47
48 /// Alarms user of something related to files
49 void WriteFSAlert(string const & s1, string const & s2 = string());
50
51 /// Asks "Yes" or "No". Returns true for yes, false for no
52 bool AskQuestion(string const & s1, string const & s2 = string(),
53                  string const & s3 = string());
54
55 /// Asks "Yes", "No" or "Cancel". Returns 1 for yes, 2 for no, 3 for cancel
56 int AskConfirmation(string const & s1, string const & s2 = string(), 
57                     string const & s3 = string());
58
59 /// returns a bool: false=cancelled, true=okay. string contains returned text
60 pair<bool, string> askForText(string const & msg,
61                               string const & dflt = string());
62
63 /// Informs the user that changes in the coming form will be ignored
64 void WarnReadonly(string const & file);
65
66 // inlined functions
67 /// rings the audio bell.
68 inline
69 void LyXBell() {
70         // if (audio()) ON/OFF switch yet to be implemented
71         fl_ringbell(20);
72 }
73
74 #endif