Wt examples  4.10.4
IconPair.h
Go to the documentation of this file.
1 // This may look like C code, but it's really -*- C++ -*-
2 /*
3  * Copyright (C) 2008 Emweb bv, Herent, Belgium.
4  *
5  * See the LICENSE file for terms of use.
6  */
7 #ifndef ICONPAIR_H_
8 #define ICONPAIR_H_
9 
10 #include <Wt/WCompositeWidget.h>
11 
12 using namespace Wt;
13 
14 namespace Wt {
15  class WImage;
16 }
17 
22 
36 class IconPair : public WCompositeWidget
37 {
38 public:
44  IconPair(const std::string icon1URI, const std::string icon2URI,
45  bool clickIsSwitch = true);
46 
53  void setState(int num);
54 
59  int state() const;
60 
63  WImage *icon1() const { return icon1_; }
64 
67  WImage *icon2() const { return icon2_; }
68 
71  void showIcon1();
72 
75  void showIcon2();
76 
77 private:
79 
82 
85 
86 public:
91 
96 
97 private:
100 
102  void undoShowIcon1();
103 
105  void undoShowIcon2();
106 };
107 
110 #endif // ICONPAIR_H_
An icon pair (identical to WIconPair)
Definition: IconPair.h:37
WImage * icon2_
Second icon.
Definition: IconPair.h:84
WContainerWidget * impl_
Definition: IconPair.h:78
EventSignal< WMouseEvent > * icon2Clicked
Signal emitted when clicked while in state 1 (icon 2 is shown).
Definition: IconPair.h:95
WImage * icon1() const
Get the first icon image.
Definition: IconPair.h:63
WImage * icon1_
First icon.
Definition: IconPair.h:81
WImage * icon2() const
Get the second icon image.
Definition: IconPair.h:67
EventSignal< WMouseEvent > * icon1Clicked
Signal emitted when clicked while in state 0 (icon 1 is shown).
Definition: IconPair.h:90
int previousState_
Undo state for prelearning stateless showIcon1() and showIcon2() slots.
Definition: IconPair.h:99