Skip to content

Commit f45b88f

Browse files
committed
Update README.md
1 parent d210fd8 commit f45b88f

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,42 @@ int push_button_cb( PtWidget_t *, void *, PtCallbackInfo_t *);//callback is defi
9494
button.resource.callback[Button::Callbacks::activate].add(push_button_cb);
9595
```
9696
97+
More complex use case:
98+
99+
```cpp
100+
// You have constructed somewhere PhWidgets::Button button1
101+
{
102+
using namespace PhWidgets;
103+
104+
Containter button1_containter = button1.Parent;
105+
106+
std::set<Widget> widgets = button1_containter.Widgets;
107+
108+
// turn all buttons of the button1 parent red
109+
// except for button1
110+
// change cursors of all buttons respectively
111+
112+
for(std::set<Widget>::iterator iterator it = widgets.begin(); it != widgets.end(); ++it)
113+
{
114+
if(nullptr == dynamic_widget_cast<Button>(*it))
115+
continue;
116+
117+
Button button = *it;
118+
if(button != button1)
119+
{
120+
button.Color = Drawing::Colors::Red;
121+
button.Cursor = Cursors::No;
122+
}
123+
else
124+
{
125+
button.Color = Drawing::Colors::Green;
126+
button.Cursor = Cursors::Finger;
127+
}
128+
129+
}
130+
}
131+
```
132+
97133
# Build
98134

99135
To build lib execute '.makelib.sh' - directory slib will contain your library with all headers and source code needed.

0 commit comments

Comments
 (0)