00001
00002
00003 #ifdef HAVE_CONFIG_H
00004 # include "../config.h"
00005 #endif
00006
00007 #include "application.hh"
00008 #include "eventhandler.hh"
00009 #include "widget.hh"
00010 #include "timer.hh"
00011 #include "property.hh"
00012 #include "rendercolor.hh"
00013
00014 extern "C" {
00015 #ifdef HAVE_STDLIB_H
00016 # include <stdlib.h>
00017 #endif
00018 }
00019
00020 #include <iostream>
00021
00022 namespace otk {
00023
00024 Application::Application(int argc, char **argv)
00025 : EventDispatcher(),
00026 _display(),
00027 _dockable(false),
00028 _appwidget_count(0)
00029 {
00030 (void)argc;
00031 (void)argv;
00032
00033 Timer::initialize();
00034 RenderColor::initialize();
00035 Property::initialize();
00036 _style = new RenderStyle(DefaultScreen(*_display), "");
00037
00038 loadStyle();
00039 }
00040
00041 Application::~Application()
00042 {
00043 delete _style;
00044 RenderColor::destroy();
00045 Timer::destroy();
00046 }
00047
00048 void Application::loadStyle(void)
00049 {
00050
00051 std::string style = "/usr/local/share/openbox/styles/artwiz";
00052
00053 }
00054
00055 void Application::run(void)
00056 {
00057 if (_appwidget_count <= 0) {
00058 std::cerr << "ERROR: No main widgets exist. You must create and show() " <<
00059 "an AppWidget for the Application before calling " <<
00060 "Application::run().\n";
00061 ::exit(1);
00062 }
00063
00064 while (_appwidget_count > 0) {
00065 dispatchEvents();
00066 if (_appwidget_count <= 0)
00067 break;
00068 Timer::dispatchTimers();
00069 }
00070 }
00071
00072 }