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 "backgroundwidget.hh" 00008 00009 namespace ob { 00010 00011 BackgroundWidget::BackgroundWidget(otk::Widget *parent, 00012 WidgetBase::WidgetType type) 00013 : otk::Widget(parent), 00014 WidgetBase(type) 00015 { 00016 } 00017 00018 00019 BackgroundWidget::~BackgroundWidget() 00020 { 00021 } 00022 00023 00024 void BackgroundWidget::setTextures() 00025 { 00026 switch (type()) { 00027 case Type_Titlebar: 00028 if (_focused) 00029 setTexture(_style->titlebarFocusBackground()); 00030 else 00031 setTexture(_style->titlebarUnfocusBackground()); 00032 break; 00033 case Type_Handle: 00034 if (_focused) 00035 setTexture(_style->handleFocusBackground()); 00036 else 00037 setTexture(_style->handleUnfocusBackground()); 00038 break; 00039 case Type_Plate: 00040 if (_focused) 00041 setBorderColor(_style->clientBorderFocusColor()); 00042 else 00043 setBorderColor(_style->clientBorderUnfocusColor()); 00044 break; 00045 default: 00046 assert(false); // there's no other background widgets! 00047 } 00048 } 00049 00050 00051 void BackgroundWidget::setStyle(otk::RenderStyle *style) 00052 { 00053 Widget::setStyle(style); 00054 setTextures(); 00055 switch (type()) { 00056 case Type_Titlebar: 00057 case Type_Handle: 00058 setBorderColor(_style->frameBorderColor()); 00059 break; 00060 case Type_Plate: 00061 break; 00062 default: 00063 assert(false); // there's no other background widgets! 00064 } 00065 } 00066 00067 00068 void BackgroundWidget::focus() 00069 { 00070 otk::Widget::focus(); 00071 setTextures(); 00072 } 00073 00074 00075 void BackgroundWidget::unfocus() 00076 { 00077 otk::Widget::unfocus(); 00078 setTextures(); 00079 } 00080 00081 00082 void BackgroundWidget::adjust() 00083 { 00084 // nothing to adjust here. its done in Frame::adjustSize 00085 } 00086 00087 }