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