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