Debian Codegraph @

phoenix/gtk/application.cpp

raw
1 namespace phoenix {
2
3 XlibDisplay* pApplication::display = nullptr;
4
5 void pApplication::run() {
6 if(Application::main) {
7 while(applicationState.quit == false) {
8 processEvents();
9 Application::main();
10 }
11 } else {
12 gtk_main();
13 }
14 }
15
16 bool pApplication::pendingEvents() {
17 return gtk_events_pending();
18 }
19
20 void pApplication::processEvents() {
21 while(pendingEvents()) gtk_main_iteration_do(false);
22 }
23
24 void pApplication::quit() {
25 //if gtk_main() was invoked, call gtk_main_quit()
26 if(gtk_main_level()) gtk_main_quit();
27 }
28
29 void pApplication::initialize() {
30 display = XOpenDisplay(nullptr);
31
32 settings = new Settings;
33 settings->load();
34
35 int argc = 1;
36 char* argv[] = {new char[8], nullptr};
37 strcpy(argv[0], "phoenix");
38 char** argvp = argv;
39 gtk_init(&argc, &argvp);
40
41 GtkSettings* gtkSettings = gtk_settings_get_default();
42 //g_object_set(gtkSettings, "gtk-button-images", true, nullptr);
43
44 gtk_rc_parse_string(R"(
45 style "phoenix-gtk"
46 {
47 GtkWindow::resize-grip-width = 0
48 GtkWindow::resize-grip-height = 0
49 GtkTreeView::vertical-separator = 0
50 GtkComboBox::appears-as-list = 1
51 }
52 class "GtkWindow" style "phoenix-gtk"
53 class "GtkTreeView" style "phoenix-gtk"
54 # class "GtkComboBox" style "phoenix-gtk"
55 )");
56
57 pKeyboard::initialize();
58 }
59
60 }