⚲
Project
General
Profile
Sign in
Register
Home
Projects
Help
Search
:
Wt
All Projects
Wt
Overview
Activity
Roadmap
Issues
Wiki
Forums
Download (872 Bytes)
Bug #202
ยป signaldemo.cpp
Anonymous, 12/02/2009 11:55 PM
#include
"Wt/WContainerWidget"
#include
"Wt/WPushButton"
#include
"Wt/WSignal"
class
MyWidget
:
public
Wt
::
WContainerWidget
{
public:
MyWidget
(
Wt
::
WContainerWidget
*
parent
=
0
)
:
Wt
::
WContainerWidget
(
parent
),
done_
(
this
)
{
Wt
::
WPushButton
*
button
=
new
Wt
::
WPushButton
(
"Okay"
);
button
->
clicked
().
connect
(
SLOT
(
this
,
MyWidget
::
process
));
}
// provide an accessor for the signal
Wt
::
Signal
<
int
,
std
::
string
>&
done
()
{
return
done_
;
}
private:
Wt
::
Signal
<
int
,
std
::
string
>
done_
;
void
process
()
{
done_
.
emit
(
42
,
"Totally done"
);
// emit the signal
}
};
class
GUIClass
:
public
Wt
::
WContainerWidget
{
private:
void
init
()
{
MyWidget
*
widget
=
new
MyWidget
(
this
);
widget
->
done
().
connect
(
SLOT
(
this
,
GUIClass
::
whenDone
));
}
void
whenDone
(
int
result
,
const
std
::
string
&
description
)
{
}
};
(1-1/1)
Loading...