/* * Part of LaGUI demonstration programs * Copyright (C) 2022-2023 Wu Yiming * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program 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 General Public License * along with this program. If not, see . */ #include "la_5.h" extern LA MAIN; int INV_MyOperator(laOperator* a, laEvent* e){ printf("Something happened in stdout!\n"); logPrint("Something happened in LaGUI terminal!\n"); return LA_FINISHED; } int INV_MyModalOperator(laOperator* a, laEvent* e){ printf("Modal opeator!\n"); logPrint("Modal opeator!\n"); return LA_RUNNING; } int MOD_MyModalOperator(laOperator* a, laEvent* e){ printf("%d,%d\n",e->x,e->y); logPrint("%d,%d\n",e->x,e->y); if(e->type==LA_R_MOUSE_DOWN){ printf("Modal opeator finished!\n"); logPrint("Modal opeator finished!\n"); return LA_FINISHED; } return LA_RUNNING; } void MyPanel(laUiList *uil, laPropPack *This, laPropPack *DetachedProps, laColumn *UNUSED, int context){ laColumn* c=laFirstColumn(uil); laShowLabel(uil,c,"Hello world!",0,0); laShowItem(uil,c,0,"MY_invoke_test"); laShowItem(uil,c,0,"MY_modal_test"); } int main(int argc, char *argv[]){ laGetReady(); laCreateOperatorType("MY_invoke_test", "Something!", "Print some strings.",0,0,0,INV_MyOperator,0,L'🗨',0); laCreateOperatorType("MY_modal_test", "Modal!", "Print mouse positions.",0,0,0,INV_MyModalOperator,MOD_MyModalOperator,L'🏃',0); laRegisterUiTemplate("my_panel","My Panel", MyPanel,0,0,"Demonstration", 0,0,0); // Uncomment this to load preferences. // laEnsureUserPreferences(); if(!MAIN.Windows.pFirst){ laWindow* w = laDesignWindow(-1,-1,600,600); laLayout* l = laDesignLayout(w,"My Layout"); laSplitBlockHorizon(l->FirstBlock,0.5); laCreatePanel(l->FirstBlock->B1,"LAUI_terminal"); laCreatePanel(l->FirstBlock->B2,"my_panel"); laStartWindow(w); } laMainLoop(); }