]> Dogcows Code - chaz/openbox/blob - otk/application.cc
add OtkFocusLabel
[chaz/openbox] / otk / application.cc
1 #include "application.hh"
2 #include "eventhandler.hh"
3
4 extern "C" {
5 #ifdef HAVE_STDLIB_H
6 # include <stdlib.h>
7 #endif
8 }
9
10 #include <iostream>
11
12 namespace otk {
13
14 OtkApplication::OtkApplication(int argc, char **argv)
15 : OtkEventDispatcher(), _dockable(false)
16 {
17 argc = argc;
18 argv = argv;
19
20 OBDisplay::initialize(0);
21 const ScreenInfo *s_info = OBDisplay::screenInfo(DefaultScreen(OBDisplay::display));
22
23 _timer_manager = new OBTimerQueueManager();
24 _img_ctrl = new BImageControl(_timer_manager, s_info, True, 4, 5, 200);
25 _style_conf = new Configuration(False);
26 _style = new Style(_img_ctrl);
27
28 loadStyle();
29 }
30
31 OtkApplication::~OtkApplication()
32 {
33 delete _style_conf;
34 delete _img_ctrl;
35 delete _timer_manager;
36 delete _style;
37
38 OBDisplay::destroy();
39 }
40
41 void OtkApplication::loadStyle(void)
42 {
43 // find the style name as a property
44 std::string style = "/usr/local/share/openbox/styles/artwiz";
45 _style_conf->setFile(style);
46 if (!_style_conf->load()) {
47 std::cerr << "Unable to load style \"" << style << "\". Aborting.\n";
48 ::exit(1);
49 }
50 _style->load(*_style_conf);
51 }
52
53 void OtkApplication::exec(void)
54 {
55 while (1) {
56 dispatchEvents();
57 _timer_manager->fire(); // fire pending events
58 }
59 }
60
61 }
This page took 0.040472 seconds and 4 git commands to generate.