#include #include #include #include #include #include #include #include #include #include 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(); } void main() { label l("Hello, world! Close me with Alt+F4."); padding pl(l, 2); label bl("Click me!"); padding pbl(bl, 4); button b(pbl, &onclick); padding pb(b, 2); 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 wl; 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); p_l = new label(""); padding p_pl(*p_l, 4); p_w = new window(p_pl); w.show(); start_runtime(); }