]> Dogcows Code - chaz/openbox/blob - otk/application.cc
rm a XXX.. comment it out :)
[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 #include "timer.hh"
11 #include "property.hh"
12 #include "rendercolor.hh"
13
14 extern "C" {
15 #ifdef HAVE_STDLIB_H
16 # include <stdlib.h>
17 #endif
18 }
19
20 #include <iostream>
21
22 namespace otk {
23
24 Application::Application(int argc, char **argv)
25 : EventDispatcher(),
26 _display(),
27 _dockable(false),
28 _appwidget_count(0)
29 {
30 (void)argc;
31 (void)argv;
32
33 Timer::initialize();
34 RenderColor::initialize();
35 Property::initialize();
36 _style = new RenderStyle(DefaultScreen(*_display), ""); // XXX: get a path!
37
38 loadStyle();
39 }
40
41 Application::~Application()
42 {
43 delete _style;
44 RenderColor::destroy();
45 Timer::destroy();
46 }
47
48 void Application::loadStyle(void)
49 {
50 // XXX: find the style name as a property
51 std::string style = "/usr/local/share/openbox/styles/artwiz";
52 //_style->load(style);
53 }
54
55 void Application::run(void)
56 {
57 if (_appwidget_count <= 0) {
58 std::cerr << "ERROR: No main widgets exist. You must create and show() " <<
59 "an AppWidget for the Application before calling " <<
60 "Application::run().\n";
61 ::exit(1);
62 }
63
64 while (_appwidget_count > 0) {
65 dispatchEvents();
66 if (_appwidget_count <= 0)
67 break;
68 Timer::dispatchTimers(); // fire pending events
69 }
70 }
71
72 }
This page took 0.04056 seconds and 4 git commands to generate.