window_cursor.h
The pointer shapes both platform windows carry, with the same values as ui::cursor_shape.
#include "isolenui/platform/window_cursor.h". The guide starts at Cursors.
Window cursors
Explained in Cursors.
window_cursorwindow_cursor_arrowwindow_cursor_textwindow_cursor_handwindow_cursor_resize_xwindow_cursor_resize_ywindow_cursor_movewindow_cursor_crosshairwindow_cursor_not_allowedwindow_cursor_countwindow_cursor_namewindow_set_cursorExample
editor.cpp
#include "isolenui/ui/ui.h"
#include "isolenui/kit/kit.h"
struct sketch {
float split;
bool locked;
};
static void paint_board(gfx_list* l, lay_box b, void* user)
{
(void)user;
gfx_fill(l, b.x, b.y, b.w, b.h, 0xff1a1a1au);
}
static void editor(ui::ctx* u, sketch* s)
{
ui_box(u, ui::row().width(lay_pct(1.0f)).height(lay_pct(1.0f)))
{
// a drawing surface shows the crosshair while the pointer is over it
ui::canvas(u, ui::row().width(lay_px(s->split)).height(lay_pct(1.0f)), paint_board, s);
if (ui::interact(u).hovered) {
ui::cursor(u, ui::cursor_crosshair);
}
// a hand made grip, the last cursor call in the frame wins
ui_box(u, ui::row().width(lay_px(6.0f)).height(lay_pct(1.0f)).bg("#333333")) {}
const ui::hit h = ui::interact(u);
if (h.hovered || h.held) {
ui::cursor(u, s->locked ? ui::cursor_not_allowed : ui::cursor_resize_x);
}
if (h.held && !s->locked) {
s->split = ui::input_of(u)->mouse_x;
}
// a text box needs no call, a field under the pointer picks the text beam
static char name[64];
ui::text_box(u, "name", name, sizeof(name));
}
}