]> icculus.org git repositories - mikachu/openbox.git/blob - src/backgroundwidget.cc
change what re-maprequest events do, just convert them to net_active_window messages...
[mikachu/openbox.git] / src / backgroundwidget.cc
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2
3 #ifdef HAVE_CONFIG_H
4 # include "../config.h"
5 #endif
6
7 #include "backgroundwidget.hh"
8
9 namespace ob {
10
11 OBBackgroundWidget::OBBackgroundWidget(otk::OtkWidget *parent,
12                                        OBWidget::WidgetType type)
13   : otk::OtkWidget(parent),
14     OBWidget(type)
15 {
16 }
17
18
19 OBBackgroundWidget::~OBBackgroundWidget()
20 {
21 }
22
23
24 void OBBackgroundWidget::setTextures()
25 {
26   switch (type()) {
27   case Type_Titlebar:
28     if (_focused)
29       setTexture(_style->getTitleFocus());
30     else
31       setTexture(_style->getTitleUnfocus());
32     break;
33   case Type_Handle:
34     if (_focused)
35       setTexture(_style->getHandleFocus());
36     else
37       setTexture(_style->getHandleUnfocus());
38     break;
39   case Type_Plate:
40     if (_focused)
41       setBorderColor(&_style->getFrameFocus()->color());
42     else
43       setBorderColor(&_style->getFrameUnfocus()->color());
44     break;
45   default:
46     assert(false); // there's no other background widgets!
47   }
48 }
49
50
51 void OBBackgroundWidget::setStyle(otk::Style *style)
52 {
53   OtkWidget::setStyle(style);
54   setTextures();
55   switch (type()) {
56   case Type_Titlebar:
57   case Type_Handle:
58     setBorderColor(_style->getBorderColor());
59     break;
60   case Type_Plate:
61     break;
62   default:
63     assert(false); // there's no other background widgets!
64   }
65 }
66
67
68 void OBBackgroundWidget::focus()
69 {
70   otk::OtkWidget::focus();
71   setTextures();
72 }
73
74
75 void OBBackgroundWidget::unfocus()
76 {
77   otk::OtkWidget::unfocus();
78   setTextures();
79 }
80
81
82 void OBBackgroundWidget::adjust()
83 {
84   // nothing to adjust here. its done in OBFrame::adjustSize
85 }
86
87 }