]> git.lyx.org Git - lyx.git/blob - src/lyx_gui_misc.h
8b959bd0895064a7b6dc1ef60a37f56f8ad3479e
[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 #ifdef __GNUG__
18 #pragma interface
19 #endif
20
21 #include FORMS_H_LOCATION
22 #include "LString.h"
23 #include <utility>  /* needed for pair<> definition */
24
25 /// Prevents LyX from being killed when the close box is pressed in a popup.
26 extern "C" int CancelCloseBoxCB(FL_FORM *, void *);
27 /// Prevents LyX from being killed when the close box is pressed in a popup.
28 extern "C" int IgnoreCloseBoxCB(FL_FORM *, void *);
29
30 /// Prevents LyX from crashing when no buffers available
31 void CloseAllBufferRelatedDialogs();
32
33 /// Ensures info in visible popups are always correct.
34 void updateAllVisibleBufferRelatedDialogs();
35
36 /// Extract shortcut from <ident>|<shortcut> string
37 char const * flyx_shortcut_extract(char const * sc);
38 /// Make a shortnamed version of the above func
39 #define scex flyx_shortcut_extract
40
41 /// Extract shortcut from <ident>|<shortcut> string
42 char const * flyx_ident_extract(char const * sc);
43 /// Make a shortnamed versjon of the above func
44 #define idex flyx_ident_extract
45
46 /// Show message
47 void WriteAlert(string const & s1, string const & s2 = string(), 
48                 string const & s3 = string());
49
50 /// Alarms user of something related to files
51 void WriteFSAlert(string const & s1, string const & s2 = string());
52
53 /// Asks "Yes" or "No". Returns true for yes, false for no
54 bool AskQuestion(string const & s1, string const & s2 = string(),
55                  string const & s3 = string());
56
57 /// Asks "Yes", "No" or "Cancel". Returns 1 for yes, 2 for no, 3 for cancel
58 int AskConfirmation(string const & s1, string const & s2 = string(), 
59                     string const & s3 = string());
60
61 /// returns a bool: false=cancelled, true=okay. string contains returned text
62 std::pair<bool, string> askForText(string const & msg,
63                                    string const & dflt = string());
64
65 /// Informs the user that changes in the coming form will be ignored
66 void WarnReadonly(string const & file);
67
68 /// Get the dpi setting of the current screen
69 float getScreenDPI();
70
71 // inlined functions
72 // rings the audio bell.
73 inline
74 void LyXBell() {
75         // if (audio()) ON/OFF switch yet to be implemented
76         fl_ringbell(20);
77 }
78
79 #endif