diff options
Diffstat (limited to 'src/user/rhello/main.cpp')
-rw-r--r-- | src/user/rhello/main.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/user/rhello/main.cpp b/src/user/rhello/main.cpp index 45329b5..22b4fd5 100644 --- a/src/user/rhello/main.cpp +++ b/src/user/rhello/main.cpp @@ -1,3 +1,4 @@ +#include <raleigh/w/colorpicker.h> #include <raleigh/w/padding.h> #include <raleigh/w/button.h> #include <raleigh/w/label.h> @@ -7,14 +8,20 @@ #include <raleigh/runtime.h> #include <raleigh/window.h> -#include <popups/info.h> +#include <knob/format.h> #include <pland/pcrt.h> using namespace raleigh; +colorpicker *cp; +label *p_l; window *p_w; void onclick(button &from) { + const _pixel_t pc = cp->get_picked_color(); + char *const text = format("Selected color is #%2x%2x%2x", pc.r, pc.g, pc.b); + p_l->change_value(text); + free_block(text); p_w->show(); } @@ -30,17 +37,21 @@ void main() { entry e(8, 31, "This window is made with the Raleigh widget toolkit for Portland OS.\n\nI am a text entry widget. My cursor can be used, but editing is not yet implemented."); padding pe(e, 2); + cp = new colorpicker(); + padding pcp(*cp, 2); + dllist<widget &> wl; - wl.add_front(pe); wl.add_front(pb); + wl.add_front(pcp); + wl.add_front(pe); wl.add_front(pl); vbox vb(wl); padding pvb(vb, 2); window w(pvb, RGB(bf, bf, bf), (bool (*)(window &))&__pcrt_quit); - label p_l("You clicked that button!"); - padding p_pl(p_l, 4); + p_l = new label(""); + padding p_pl(*p_l, 4); p_w = new window(p_pl); w.show(); |