12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- /*
- * 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 <http://www.gnu.org/licenses/>.
- */
- #include "la_5.h"
- void Widgets(laUiList *uil, laPropPack *This, laPropPack *DetachedProps, laColumn *UNUSED, int context){
- laColumn* c=laFirstColumn(uil);
- laColumn* cl,*cr;laSplitColumn(uil,c,0.5);cl=laLeftColumn(c,0);cr=laRightColumn(c,0);
- laShowLabel(uil,c,"This is a label",0,0);
- laShowLabel(uil,c,"This label is aligned to the center",0,0)->Flags|=LA_TEXT_ALIGN_CENTER;
- laShowLabel(uil,c,"This label is aligned to the right",0,0)->Flags|=LA_TEXT_ALIGN_RIGHT;
- laShowSeparator(uil,c);
- laUiItem* b=laBeginRow(uil,c,0,0);
- laShowLabel(uil,c,"This is a button:",0,0);
- laShowItem(uil,c,0,"LA_pure_yes_no");
- laEndRow(uil,b);
- laShowSeparator(uil,c);
- laUiItem* g=laMakeGroup(uil,cl,"Group",0); laUiList* gu=g->Page; laColumn* gc=laFirstColumn(gu);
- laShowLabel(gu,gc,"Label inside a group",0,0);
- g=laMakeTab(uil,cr,0);
- gu=laAddTabPage(g,"Page1"); gc=laFirstColumn(gu);
- laShowLabel(gu,gc,"Label 1 in tab",0,0);
- laShowLabel(gu,gc,"Label 2 in tab",0,0);
- gu=laAddTabPage(g,"Page2"); gc=laFirstColumn(gu);
- laShowLabel(gu,gc,"Label 3 in tab",0,0);
- laShowSeparator(uil,c);
- laShowLabel(uil,c,"Below are some built-in example properties,\ntry changing the values in them:",0,0)->Flags|=LA_TEXT_LINE_WRAP;
- laShowLabel(uil,cl,"Value slider:",0,0)->Flags|=LA_TEXT_ALIGN_RIGHT; laShowItem(uil,cr,0,"la.example_int");
- laShowLabel(uil,cl,"String editor:",0,0)->Flags|=LA_TEXT_ALIGN_RIGHT; laShowItem(uil,cr,0,"la.example_string")->Flags|=LA_TEXT_ONE_LINE;
- laShowLabel(uil,cl,"Color picker:",0,0)->Flags|=LA_TEXT_ALIGN_RIGHT; laShowItem(uil,cr,0,"la.themes.color");
- laShowLabel(uil,cl,"Multi-line string:",0,0)->Flags|=LA_TEXT_ALIGN_RIGHT;
- laShowItemFull(uil,cr,0,"la.example_string",LA_WIDGET_STRING_MULTI,0,0,0)->Extra->HeightCoeff=5;
- laShowSeparator(uil,c);
- laShowLabel(uil,cl,"This is a 3D viewer",0,0);
- laShowCanvas(uil,cl,0,0,"la_3DView",6);
- laShowLabel(uil,cr,"And this is 2D",0,0);
- laCanvasExtra*ce=laShowCanvas(uil,cr,0,"tns.texture_list",0,6)->Extra; ce->ZoomX=10; ce->ZoomY=10;
- }
- int main(int argc, char *argv[]){
- laGetReady();
- laRegisterUiTemplate("my_widgets","Widgets", Widgets,0,0,"Demonstration", 0,0,0);
- laWindow* w = laDesignWindow(-1,-1,400,800);
- laLayout* l = laDesignLayout(w,"My Layout");
- laCreatePanel(l->FirstBlock,"my_widgets");
- laStartWindow(w);
- laMainLoop();
- }
|