Wt examples: treelist/IconPair.h Source File

Wt examples 4.10.4

Loading...
Searching...
No Matches
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
12using namespace Wt;
13
14namespace Wt {
15 class WImage;
16}
17
22
36 class IconPair : public WCompositeWidget
37{
38public:
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
77private:
78 WContainerWidget *impl_;
79
81 WImage *icon1_;
82
84 WImage *icon2_;
85
86public:
90 EventSignal<WMouseEvent> *icon1Clicked;
91
95 EventSignal<WMouseEvent> *icon2Clicked;
96
97private:
99 int previousState_;
100
102 void undoShowIcon1();
103
105 void undoShowIcon2();
106};
107
110#endif // ICONPAIR_H_
IconPair
An icon pair (identical to WIconPair)
Definition IconPair.h:37
IconPair::icon2_
WImage * icon2_
Second icon.
Definition IconPair.h:84
IconPair::state
int state() const
Get the current state.
Definition IconPair.C:61
IconPair::impl_
WContainerWidget * impl_
Definition IconPair.h:78
IconPair::icon2Clicked
EventSignal< WMouseEvent > * icon2Clicked
Signal emitted when clicked while in state 1 (icon 2 is shown).
Definition IconPair.h:95
IconPair::icon1
WImage * icon1() const
Get the first icon image.
Definition IconPair.h:63
IconPair::undoShowIcon2
void undoShowIcon2()
Undo function for prelearning showIcon2()
Definition IconPair.C:83
IconPair::setState
void setState(int num)
Set which icon should be visible.
Definition IconPair.C:50
IconPair::icon1_
WImage * icon1_
First icon.
Definition IconPair.h:81
IconPair::showIcon2
void showIcon2()
Set state to 1 (show icon 2).
Definition IconPair.C:72
IconPair::undoShowIcon1
void undoShowIcon1()
Undo function for prelearning showIcon1()
Definition IconPair.C:78
IconPair::icon2
WImage * icon2() const
Get the second icon image.
Definition IconPair.h:67
IconPair::IconPair
IconPair(const std::string icon1URI, const std::string icon2URI, bool clickIsSwitch=true)
Construct a two-state icon widget.
Definition IconPair.C:14
IconPair::icon1Clicked
EventSignal< WMouseEvent > * icon1Clicked
Signal emitted when clicked while in state 0 (icon 1 is shown).
Definition IconPair.h:90
IconPair::previousState_
int previousState_
Undo state for prelearning stateless showIcon1() and showIcon2() slots.
Definition IconPair.h:99
IconPair::showIcon1
void showIcon1()
Set state to 0 (show icon 1).
Definition IconPair.C:66
Wt
Definition AddresseeEdit.h:16