]> Dogcows Code - chaz/openbox/blob - otk/application.cc
fix indenting
[chaz/openbox] / otk / application.cc
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2
3 #ifdef HAVE_CONFIG_H
4 # include "../config.h"
5 #endif
6
7 #include "application.hh"
8 #include "eventhandler.hh"
9 #include "widget.hh"
10
11 extern "C" {
12 #ifdef HAVE_STDLIB_H
13 # include <stdlib.h>
14 #endif
15 }
16
17 #include <iostream>
18
19 namespace otk {
20
21 Application::Application(int argc, char **argv)
22 : EventDispatcher(),
23 _display(),
24 _dockable(false),
25 _appwidget_count(0)
26 {
27 (void)argc;
28 (void)argv;
29
30 const ScreenInfo *s_info = _display.screenInfo(DefaultScreen(*_display));
31
32 _timer_manager = new TimerQueueManager();
33 _img_ctrl = new ImageControl(_timer_manager, s_info, True, 4, 5, 200);
34 _style_conf = new Configuration(False);
35 _style = new Style(_img_ctrl);
36
37 loadStyle();
38 }
39
40 Application::~Application()
41 {
42 delete _style_conf;
43 delete _img_ctrl;
44 delete _timer_manager;
45 delete _style;
46 }
47
48 void Application::loadStyle(void)
49 {
50 // find the style name as a property
51 std::string style = "/usr/local/share/openbox/styles/artwiz";
52 _style_conf->setFile(style);
53 if (!_style_conf->load()) {
54 std::cerr << "ERROR: Unable to load style \"" << style << "\".\n";
55 ::exit(1);
56 }
57 _style->load(*_style_conf);
58 }
59
60 void Application::run(void)
61 {
62 if (_appwidget_count <= 0) {
63 std::cerr << "ERROR: No main widgets exist. You must create and show() " <<
64 "an AppWidget for the Application before calling " <<
65 "Application::run().\n";
66 ::exit(1);
67 }
68
69 while (_appwidget_count > 0) {
70 dispatchEvents();
71 _timer_manager->fire(); // fire pending events
72 }
73 }
74
75 }
This page took 0.040117 seconds and 4 git commands to generate.