Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

/otk/appwidget.cc

Go to the documentation of this file.
00001 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
00002 
00003 #ifdef HAVE_CONFIG_H
00004 # include "../config.h"
00005 #endif
00006 
00007 #include "appwidget.hh"
00008 #include "application.hh"
00009 #include "property.hh"
00010 
00011 extern "C" {
00012 #include <X11/Xlib.h>
00013 }
00014 
00015 namespace otk {
00016 
00017 AppWidget::AppWidget(Application *app, Direction direction,
00018                      Cursor cursor, int bevel_width)
00019   : Widget(app, app->getStyle(), direction, cursor, bevel_width),
00020     _application(app)
00021 {
00022   assert(app);
00023 
00024   // set WM Protocols on the window
00025   Atom protocols[2];
00026   protocols[0] = Property::atoms.wm_protocols;
00027   protocols[1] = Property::atoms.wm_delete_window;
00028   XSetWMProtocols(**display, window(), protocols, 2);
00029 
00030   setStyle(_style);
00031 }
00032 
00033 AppWidget::~AppWidget()
00034 {
00035 }
00036 
00037 void AppWidget::setStyle(RenderStyle *style)
00038 {
00039   Widget::setStyle(style);
00040 
00041   setTexture(style->titlebarUnfocusBackground());
00042 }
00043 
00044 void AppWidget::show(void)
00045 {
00046   Widget::show(true);
00047 
00048   _application->_appwidget_count++;
00049 }
00050 
00051 void AppWidget::hide(void)
00052 {
00053   Widget::hide();
00054 
00055   _application->_appwidget_count--;
00056 }
00057 
00058 void AppWidget::clientMessageHandler(const XClientMessageEvent &e)
00059 {
00060   EventHandler::clientMessageHandler(e);
00061   if (e.message_type == Property::atoms.wm_protocols &&
00062       static_cast<Atom>(e.data.l[0]) == Property::atoms.wm_delete_window)
00063     hide();
00064 }
00065 
00066 }

Generated on Tue Feb 4 22:58:55 2003 for Openbox by doxygen1.3-rc2