00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include <string>
00026
00027 #include "WOSGButtonLabel.h"
00028
00029 #include "WOSGButton.h"
00030
00031 WOSGButton::WOSGButton( std::string name, osgWidget::Box::BoxType type, bool resize_hint, bool pushable ) :
00032 osgWidget::Box( name, type, resize_hint ),
00033 m_id( 0 )
00034 {
00035 getBackground()->setColor( 0.8f, 0.8f, 0.8f, 0.8f );
00036
00037 m_label = new WOSGButtonLabel( pushable );
00038 m_label->setLabel( name );
00039 m_label->setName( std::string( "Button_" ) + name );
00040 addWidget( m_label );
00041 }
00042
00043 WOSGButton::~WOSGButton()
00044 {
00045 }
00046
00047 void WOSGButton::setLabel( std::string label )
00048 {
00049 m_label->setLabel( label );
00050 }
00051
00052 void WOSGButton::setId( size_t id )
00053 {
00054 m_id = id;
00055 }
00056
00057 void WOSGButton::setBackgroundColor( const WColor& color )
00058 {
00059 m_label->setColor( color[0], color[1], color[2], 1.0f );
00060 }