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

/otk/focuswidget.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 "focuswidget.hh"
00008 
00009 namespace otk {
00010 
00011 FocusWidget::FocusWidget(Widget *parent, Direction direction)
00012   : Widget(parent, direction), _unfocus_texture(0), _unfocus_bcolor(0)
00013 {
00014   _focused = true;
00015   _focus_texture = parent->texture();
00016   _focus_bcolor = parent->borderColor();
00017 }
00018 
00019 FocusWidget::~FocusWidget()
00020 {
00021 }
00022 
00023 
00024 void FocusWidget::focus(void)
00025 {
00026   if (_focused)
00027     return;
00028 
00029   Widget::focus();
00030 
00031   if (_focus_bcolor)
00032     Widget::setBorderColor(_focus_bcolor);
00033 
00034   Widget::setTexture(_focus_texture);
00035   update();
00036 }
00037 
00038 void FocusWidget::unfocus(void)
00039 {
00040   if (!_focused)
00041     return;
00042 
00043   Widget::unfocus();
00044 
00045   if (_unfocus_bcolor)
00046     Widget::setBorderColor(_unfocus_bcolor);
00047 
00048   Widget::setTexture(_unfocus_texture);
00049   update();
00050 }
00051 
00052 void FocusWidget::setTexture(RenderTexture *texture)
00053 {
00054   Widget::setTexture(texture);
00055   _focus_texture = texture;
00056 }
00057 
00058 void FocusWidget::setBorderColor(const RenderColor *color)
00059 {
00060   Widget::setBorderColor(color);
00061   _focus_bcolor = color;
00062 }
00063 
00064 }

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