]> git.lyx.org Git - lyx.git/blob - src/lyx_gui_misc.h
Dekel's lyxrc.example; Angus's FormDocument; John's build-listerrors; POTFILES.in...
[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 class MiniBuffer;
26
27 /// Prevents LyX from being killed when the close box is pressed in a popup.
28 extern "C" int CancelCloseBoxCB(FL_FORM *, void *);
29 /// Prevents LyX from being killed when the close box is pressed in a popup.
30 extern "C" int IgnoreCloseBoxCB(FL_FORM *, void *);
31
32 /// Prevents LyX from crashing when no buffers available
33 void CloseAllBufferRelatedDialogs();
34
35 /// Ensures info in visible popups are always correct.
36 void updateAllVisibleBufferRelatedDialogs();
37
38 /* These shortcut extractors should be shifted to frontends/xforms/ eventually */
39
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
44
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
49
50 /// Show status message
51 void WriteStatus(MiniBuffer * minib, string const & s);
52
53 /// Show message
54 void WriteAlert(string const & s1, string const & s2 = string(), 
55                 string const & s3 = string());
56
57 /// Alarms user of something related to files
58 void WriteFSAlert(string const & s1, string const & s2 = string());
59
60 /// Asks "Yes" or "No". Returns true for yes, false for no
61 bool AskQuestion(string const & s1, string const & s2 = string(),
62                  string const & s3 = string(), bool default_value = true);
63
64 /// Asks "Yes", "No" or "Cancel". Returns 1 for yes, 2 for no, 3 for cancel
65 int AskConfirmation(string const & s1, string const & s2 = string(), 
66                     string const & s3 = string(), int default_value = 1);
67
68 /// returns a bool: false=cancelled, true=okay. string contains returned text
69 std::pair<bool, string> const
70 askForText(string const & msg,
71            string const & dflt = string());
72
73 /// Informs the user that changes in the coming form will be ignored
74 void WarnReadonly(string const & file);
75
76 /// Get the dpi setting of the current screen
77 float getScreenDPI();
78
79 /// rings the audio bell.
80 inline
81 void LyXBell() {
82         // if (audio()) ON/OFF switch yet to be implemented
83         fl_ringbell(20);
84 }
85
86 #endif