summaryrefslogtreecommitdiff
path: root/src/user/rhello/main.cpp
diff options
context:
space:
mode:
authorBenji Dial <benji6283@gmail.com>2021-03-08 18:06:38 -0500
committerBenji Dial <benji6283@gmail.com>2021-03-08 18:06:38 -0500
commitfd4557c4adddf710979a42e9f9d470bc8b3f77bd (patch)
tree485ff6f0514cc1918f8758927a1e2da2198e7d8a /src/user/rhello/main.cpp
parent920f1f010284d59bad86f78355ed90ac2f3e1d2c (diff)
downloadportland-os-fd4557c4adddf710979a42e9f9d470bc8b3f77bd.tar.gz
hbox, better painting logic in raleigh
Diffstat (limited to 'src/user/rhello/main.cpp')
-rw-r--r--src/user/rhello/main.cpp24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/user/rhello/main.cpp b/src/user/rhello/main.cpp
index 22b4fd5..8ea0bf0 100644
--- a/src/user/rhello/main.cpp
+++ b/src/user/rhello/main.cpp
@@ -3,6 +3,7 @@
#include <raleigh/w/button.h>
#include <raleigh/w/label.h>
#include <raleigh/w/entry.h>
+#include <raleigh/w/hbox.h>
#include <raleigh/w/vbox.h>
#include <raleigh/runtime.h>
@@ -16,6 +17,7 @@ using namespace raleigh;
colorpicker *cp;
label *p_l;
window *p_w;
+label *l;
void onclick(button &from) {
const _pixel_t pc = cp->get_picked_color();
@@ -25,23 +27,37 @@ void onclick(button &from) {
p_w->show();
}
+void onclick2(button &from) {
+ l->change_value("I can be changed on the fly.");
+}
+
void main() {
- label l("Hello, world! Close me with Alt+F4.");
- padding pl(l, 2);
+ l = new label("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.");
+ label b2l("Click me too!");
+ padding pb2l(b2l, 4);
+ button b2(pb2l, &onclick2);
+ padding pb2(b2, 2);
+
+ dllist<widget &> bbl;
+ bbl.add_front(pb2);
+ bbl.add_front(pb);
+ hbox bb(bbl);
+
+ entry e(8, 31, "This window is made with the Raleigh widget toolkit for Portland OS.\n\nI am a text entry widget. You can move my cursor, but I cannot yet be edited.");
padding pe(e, 2);
cp = new colorpicker();
padding pcp(*cp, 2);
dllist<widget &> wl;
- wl.add_front(pb);
+ wl.add_front(bb);
wl.add_front(pcp);
wl.add_front(pe);
wl.add_front(pl);