]> Dogcows Code - chaz/openbox/blob - otk/application.cc
use the c++ std cheaders
[chaz/openbox] / otk / application.cc
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2
3 #include "config.h"
4
5 #include "application.hh"
6 #include "eventhandler.hh"
7 #include "timer.hh"
8 #include "property.hh"
9 #include "rendercolor.hh"
10 #include "renderstyle.hh"
11
12 extern "C" {
13 #ifdef HAVE_STDLIB_H
14 # include <stdlib.h>
15 #endif
16 }
17
18 #include <iostream>
19
20 namespace otk {
21
22 Application::Application(int argc, char **argv)
23 : EventDispatcher(),
24 _display(),
25 _dockable(false),
26 _appwidget_count(0)
27 {
28 (void)argc;
29 (void)argv;
30
31 _screen = DefaultScreen(*_display);
32
33 Timer::initialize();
34 RenderColor::initialize();
35 RenderStyle::initialize();
36 Property::initialize();
37
38 loadStyle();
39 }
40
41 Application::~Application()
42 {
43 RenderStyle::destroy();
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.037554 seconds and 5 git commands to generate.