]> git.lyx.org Git - lyx.git/blob - src/frontends/lyx_gui.h
cleanup after svn hang-up, #undef CursorShape. Should be compilable ganin now.
[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 class LyXView;
31 namespace lyx {
32 struct RGBColor;
33 }
34
35 /// GUI interaction
36 namespace lyx_gui {
37
38 /// are we using the GUI at all
39 extern bool use_gui;
40
41 /// return a suitable serif font name (called from non-gui context too !)
42 std::string const roman_font_name();
43
44 /// return a suitable sans serif font name (called from non-gui context too !)
45 std::string const sans_font_name();
46
47 /// return a suitable monospaced font name (called from non-gui context too !)
48 std::string const typewriter_font_name();
49
50 /**
51  * set up GUI parameters. At this point lyxrc may
52  * be used.
53  */
54 void parse_lyxrc();
55
56 /**
57  * Create the main window with given geometry settings
58  */
59 LyXView * create_view(unsigned int width, unsigned int height, int posx, int posy,
60               bool maximize);
61
62 /**
63  * Start the main event loop, after executing the given
64  * batch commands
65  */
66 int start(LyXView* view, std::string const & batch);
67
68 /**
69  * Enter the main event loop (\sa LyX::exec2)
70  */
71 int exec(int & argc, char * argv[]);
72
73 /**
74  * Synchronise all pending events.
75  */
76 void sync_events();
77
78 /**
79  * Quit running LyX. This may either quit directly or record the exit status
80  * and only stop the event loop.
81  */
82 void exit(int);
83
84 /**
85  * return the status flag for a given action. This can be used to tell
86  * that a given lfun is not implemented by a frontend
87  */
88 FuncStatus getStatus(FuncRequest const & ev);
89
90 /**
91  * Given col, fills r, g, b in the range 0-255.
92  * The function returns true if successful.
93  * It returns false on failure and sets r, g, b to 0.
94  */
95 bool getRGBColor(LColor_color col, lyx::RGBColor & rgbcol);
96
97 /** Eg, passing LColor::black returns "000000",
98  *      passing LColor::white returns "ffffff".
99  */
100 std::string const hexname(LColor_color col);
101
102 /**
103  * update an altered GUI color
104  */
105 void update_color(LColor_color col);
106
107 /**
108  * update the font cache
109  */
110 void update_fonts();
111
112 /**
113  * is the given font available ?
114  */
115 bool font_available(LyXFont const & font);
116
117 /**
118  * add a callback for socket read notification
119  * @param fd socket descriptor (file/socket/etc)
120  */
121 void register_socket_callback(int fd, boost::function<void()> func);
122
123 /**
124  * remove a I/O read callback
125  * @param fd socket descriptor (file/socket/etc)
126  */
127 void unregister_socket_callback(int fd);
128
129 } // namespace lyx_gui
130
131 #endif // LYX_GUI_H