]> git.lyx.org Git - lyx.git/blob - src/frontends/lyx_gui.h
* src/frontends/*/lyx_gui.C:
[lyx.git] / src / frontends / lyx_gui.h
1 // -*- C++ -*-
2 /**
3  * \file lyx_gui.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author John Levon
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef LYX_GUI_H
13 #define LYX_GUI_H
14
15
16 #include "FuncStatus.h"
17
18 #include <boost/function.hpp>
19
20 #include <string>
21 #include <vector>
22
23 class Dialogs;
24 class LColor_color;
25 class LyXFont;
26 class LyXComm;
27 class LyXDataSocket;
28 class LyXServerSocket;
29 class FuncRequest;
30 namespace lyx {
31 struct RGBColor;
32 }
33
34 /// GUI interaction
35 namespace lyx_gui {
36
37 /// are we using the GUI at all
38 extern bool use_gui;
39
40 /// return a suitable serif font name (called from non-gui context too !)
41 std::string const roman_font_name();
42
43 /// return a suitable sans serif font name (called from non-gui context too !)
44 std::string const sans_font_name();
45
46 /// return a suitable monospaced font name (called from non-gui context too !)
47 std::string const typewriter_font_name();
48
49 /// parse command line and do basic initialisation
50 void parse_init(int & argc, char * argv[]);
51
52 /**
53  * set up GUI parameters. At this point lyxrc may
54  * be used.
55  */
56 void parse_lyxrc();
57
58 /**
59  * Start the main event loop, after executing the given
60  * batch commands, and loading the given documents
61  */
62 void start(std::string const & batch, std::vector<std::string> const & files,
63                 unsigned int width, unsigned int height, int posx, int posy);
64
65 /**
66  * Synchronise all pending events.
67  */
68 void sync_events();
69
70 /**
71  * quit running LyX
72  */
73 void exit();
74
75 /**
76  * return the status flag for a given action. This can be used to tell
77  * that a given lfun is not implemented by a frontend
78  */
79 FuncStatus getStatus(FuncRequest const & ev);
80
81 /**
82  * Given col, fills r, g, b in the range 0-255.
83  * The function returns true if successful.
84  * It returns false on failure and sets r, g, b to 0.
85  */
86 bool getRGBColor(LColor_color col, lyx::RGBColor & rgbcol);
87
88 /** Eg, passing LColor::black returns "000000",
89  *      passing LColor::white returns "ffffff".
90  */
91 std::string const hexname(LColor_color col);
92
93 /**
94  * update an altered GUI color
95  */
96 void update_color(LColor_color col);
97
98 /**
99  * update the font cache
100  */
101 void update_fonts();
102
103 /**
104  * is the given font available ?
105  */
106 bool font_available(LyXFont const & font);
107
108 /**
109  * add a callback for socket read notification
110  * @param fd socket descriptor (file/socket/etc)
111  */
112 void register_socket_callback(int fd, boost::function<void()> func);
113
114 /**
115  * remove a I/O read callback
116  * @param fd socket descriptor (file/socket/etc)
117  */
118 void unregister_socket_callback(int fd);
119
120 } // namespace lyx_gui
121
122 #endif // LYX_GUI_H