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 00067 public slots: 00070 void showIcon1(); 00071 00074 void showIcon2(); 00075 00076 private: 00077 Wt::WContainerWidget *impl_; 00078 00080 Wt::WImage *icon1_; 00081 00083 Wt::WImage *icon2_; 00084 00085 public: 00089 Wt::EventSignal<Wt::WMouseEvent>& icon1Clicked; 00090 00094 Wt::EventSignal<Wt::WMouseEvent>& icon2Clicked; 00095 00096 private: 00098 int previousState_; 00099 00101 void undoShowIcon1(); 00102 00104 void undoShowIcon2(); 00105 }; 00106 00109 #endif // ICONPAIR_H_