00001 /* 00002 libwt - Vassilis Virvilis Toolkit - a widget library 00003 Copyright (C) 2006 Vassilis Virvilis <vasvir2@fastmail.fm> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Lesser General Public 00007 License as published by the Free Software Foundation; either 00008 version 2.1 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Lesser General Public License for more details. 00014 00015 You should have received a copy of the GNU Lesser General Public 00016 License along with this library; if not, write to the 00017 Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00018 Boston, MA 02111-1307, SA. 00019 */ 00020 00021 #ifndef WT_PUSHBUTTON_H 00022 #define WT_PUSHBUTTON_H 00023 00024 #include <wt/button.h> 00025 00026 namespace Wt { 00027 00028 /** PushButton Class. 00029 In contrast to Button, this widget changes its appereance 00030 when being pressed. 00031 */ 00032 class PushButton : public Button { 00033 public: 00034 PushButton(Widget *parent = 0, const std::string &name = "PushButton::anon"); 00035 00036 using Button::setPixmap; 00037 void setPixmap(const Pixmap& pixmap_up, const Pixmap& pixmap_down); 00038 WVar<bool> down; 00039 00040 protected: 00041 virtual void drawButton(Painter *p); 00042 virtual void drawButtonLabel(Painter *p); 00043 00044 virtual void buttonPressEvent(); 00045 virtual void buttonCancelEvent(); 00046 virtual void buttonReleaseEvent(); 00047 virtual void buttonClickEvent(); 00048 00049 virtual void setButtonSize(); 00050 00051 private: 00052 void init(); 00053 void onButtonStatusChange(); 00054 00055 Pixmap pixmap_up_; 00056 Pixmap pixmap_down_; 00057 }; 00058 00059 } // namespace Wt 00060 00061 #endif // WT_PUSHBUTTON_H
This document is licensed under the terms of the GNU Free Documentation License and may be freely distributed under the conditions given by this license.