/* * Roo/E, the Kangaroo Punch Portable GUI Toolkit * Copyright (C) 2022 Scott Duensing * * http://kangaroopunch.com * * * This file is part of Roo/E. * * Roo/E is free software: you can redistribute it and/or modify it under the * terms of the GNU Affero General Public License as published by the Free * Software Foundation, either version 3 of the License, or (at your option) * any later version. * * Roo/E is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. * * You should have received a copy of the GNU Affero General Public License * along with Roo/E. If not, see . * */ #include "gui/gui-all.h" VscrollT *_v = NULL; HscrollT *_h = NULL; void clickHandler(WidgetT *widget, uint16_t x, uint16_t y, uint8_t event, void *data) { (void)widget; logWrite("%d %dx%d %s %d %d\n", event, x, y, data, vscrollValueGet(_v), hscrollValueGet(_h)); } int main(int argc, char *argv[]) { char title[256]; uint16_t i; WindowT *w = NULL; LabelT *l = NULL; ButtonT *b = NULL; CheckboxT *c = NULL; RadioT *r = NULL; ScrollableT *s = NULL; // frame // scrollarea // listbox // textbox // up/down // terminal // timer // msgbox (void)argc; memoryStartup(argv[0]); logOpenByHandle(memoryLogHandleGet()); if (guiStartup(800, 600, 16) == SUCCESS) { for (i=1; i<4; i++) { sprintf(title, "Testing %d", i); w = windowCreate(i * 50, i * 50, 600, 400, title, WIN_STANDARD, 640, 480); l = labelCreate(LABEL_ALIGN_LEFT, __guiFontVGA8x16, "Label"); labelColorSet(l, __guiBaseColors[i], GUI_BLACK); labelClickSet(l, clickHandler, title); widgetAdd(W(w), 20, 10, W(l)); b = buttonCreate("Button", clickHandler, NULL); widgetAdd(W(w), 20, 40, W(b)); c = checkboxCreate("Checkbox", 0); widgetAdd(W(w), 20, 80, W(c)); r = radioCreate("Radio 1", 0, 1); widgetAdd(W(w), 20, 110, W(r)); r = radioCreate("Radio 2", 0, 0); widgetAdd(W(w), 120, 110, W(r)); r = radioCreate("Radio 3", 0, 0); widgetAdd(W(w), 220, 110, W(r)); r = radioCreate("Radio A", 1, 0); widgetAdd(W(w), 20, 140, W(r)); r = radioCreate("Radio B", 1, 1); widgetAdd(W(w), 120, 140, W(r)); r = radioCreate("Radio C", 1, 0); widgetAdd(W(w), 220, 140, W(r)); _v = vscrollCreate(100, clickHandler, NULL); vscrollRangeSet(_v, 0, 640); widgetAdd(W(w), 200, 5, W(_v)); _h = hscrollCreate(100, clickHandler, NULL); hscrollRangeSet(_h, 0, 640); widgetAdd(W(w), 100, 5, W(_h)); s = scrollableCreate(300, 200, 648, 480, SCROLLABLE_STANDARD); widgetAdd(W(w), 20, 170, W(s)); } guiRun(); guiShutdown(); } logClose(); memoryShutdown(); return 0; }