1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
4 # include "../config.h"
7 #include "application.hh"
8 #include "eventhandler.hh"
21 OtkApplication::OtkApplication(int argc, char **argv)
22 : OtkEventDispatcher(),
29 OBDisplay::initialize(0);
30 const ScreenInfo *s_info =
31 OBDisplay::screenInfo(DefaultScreen(OBDisplay::display));
33 _timer_manager = new OBTimerQueueManager();
34 _img_ctrl = new BImageControl(_timer_manager, s_info, True, 4, 5, 200);
35 _style_conf = new Configuration(False);
36 _style = new Style(_img_ctrl);
41 OtkApplication::~OtkApplication()
45 delete _timer_manager;
51 void OtkApplication::loadStyle(void)
53 // find the style name as a property
54 std::string style = "/usr/local/share/openbox/styles/artwiz";
55 _style_conf->setFile(style);
56 if (!_style_conf->load()) {
57 std::cerr << "ERROR: Unable to load style \"" << style << "\".\n";
60 _style->load(*_style_conf);
63 void OtkApplication::run(void)
65 if (_appwidget_count <= 0) {
66 std::cerr << "ERROR: No main widgets exist. You must create and show() " <<
67 "an OtkAppWidget for the OtkApplication before calling " <<
68 "OtkApplication::run().\n";
72 while (_appwidget_count > 0) {
74 _timer_manager->fire(); // fire pending events