openbox/otk/application.cc

66 lines
1.2 KiB
C++
Raw Normal View History

// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2003-02-09 23:07:54 +00:00
#include "config.h"
2002-11-16 02:18:37 +00:00
#include "application.hh"
#include "eventhandler.hh"
#include "timer.hh"
#include "property.hh"
#include "rendercolor.hh"
#include "renderstyle.hh"
#include "display.hh"
2002-11-16 02:18:37 +00:00
#include <cstdlib>
#include <iostream>
2002-11-16 02:18:37 +00:00
namespace otk {
extern void initialize();
extern void destroy();
Application::Application(int argc, char **argv)
: EventDispatcher(),
_dockable(false),
_appwidget_count(0)
2002-11-16 02:18:37 +00:00
{
(void)argc;
(void)argv;
2002-11-16 02:18:37 +00:00
otk::initialize();
_screen = DefaultScreen(**display);
2002-11-16 02:18:37 +00:00
loadStyle();
}
Application::~Application()
2002-11-16 02:18:37 +00:00
{
otk::destroy();
2002-11-16 02:18:37 +00:00
}
void Application::loadStyle(void)
2002-11-16 02:18:37 +00:00
{
2003-01-22 22:46:16 +00:00
// XXX: find the style name as a property
std::string style = "/usr/local/share/openbox/styles/artwiz";
2003-01-22 22:46:16 +00:00
//_style->load(style);
2003-02-16 09:37:21 +00:00
otk::RenderStyle::setStyle(_screen, style);
2002-11-16 02:18:37 +00:00
}
void Application::run(void)
2002-11-16 02:18:37 +00:00
{
if (_appwidget_count <= 0) {
std::cerr << "ERROR: No main widgets exist. You must create and show() " <<
"an AppWidget for the Application before calling " <<
"Application::run().\n";
::exit(1);
}
while (_appwidget_count > 0) {
dispatchEvents();
2003-02-16 08:03:49 +00:00
if (_appwidget_count > 0)
Timer::dispatchTimers(); // fire pending events
}
2002-11-16 02:18:37 +00:00
}
}