Wt examples
3.2.2
|
00001 // This may look like C code, but it's really -*- C++ -*- 00002 /* 00003 * Copyright (C) 2008 Emweb bvba, Kessel-Lo, Belgium. 00004 * 00005 * See the LICENSE file for terms of use. 00006 */ 00007 #ifndef ICONPAIR_H_ 00008 #define ICONPAIR_H_ 00009 00010 #include <Wt/WCompositeWidget> 00011 00012 namespace Wt { 00013 class WImage; 00014 } 00015 00020 00034 class IconPair : public Wt::WCompositeWidget 00035 { 00036 public: 00042 IconPair(const std::string icon1URI, const std::string icon2URI, 00043 bool clickIsSwitch = true, Wt::WContainerWidget *parent = 0); 00044 00051 void setState(int num); 00052 00057 int state() const; 00058 00061 Wt::WImage *icon1() const { return icon1_; } 00062 00065 Wt::WImage *icon2() const { return icon2_; } 00066 00069 void showIcon1(); 00070 00073 void showIcon2(); 00074 00075 private: 00076 Wt::WContainerWidget *impl_; 00077 00079 Wt::WImage *icon1_; 00080 00082 Wt::WImage *icon2_; 00083 00084 public: 00088 Wt::EventSignal<Wt::WMouseEvent>& icon1Clicked; 00089 00093 Wt::EventSignal<Wt::WMouseEvent>& icon2Clicked; 00094 00095 private: 00097 int previousState_; 00098 00100 void undoShowIcon1(); 00101 00103 void undoShowIcon2(); 00104 }; 00105 00108 #endif // ICONPAIR_H_