GHandle gwinTabsetAddTab(GHandle gh, const char *title, bool_t useAlloc) { GWidgetInit wi; if (gh->vmt != (gwinVMT *)&tabsetVMT) return 0; // Set up the init structure gwinWidgetClearInit(&wi); wi.g.x = wi.g.y = 0; wi.g.width = gwinGetInnerWidth(gh); wi.g.height = gwinGetInnerHeight(gh); wi.g.show = !gwinTabsetCountTabs(gh); wi.g.parent = gh; // Create the page if (!(gh = _gcontainerCreate(gh->display, 0, &wi, &tabpageVMT))) return 0; // Set the text and visibility gwinSetText(gh, title, useAlloc); FixTabSizePos(gh->parent); gwinSetVisible(gh, wi.g.show); gwinRedraw(gh->parent); return gh; }
static void draw( void ) { glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); glPushMatrix(); glRotatef( view_rotx, 1.0, 0.0, 0.0 ); glRotatef( view_roty, 0.0, 1.0, 0.0 ); glRotatef( view_rotz, 0.0, 0.0, 1.0 ); glPushMatrix(); glTranslatef( -3.0, -2.0, 0.0 ); glRotatef( angle, 0.0, 0.0, 1.0 ); glCallList(gear1); glPopMatrix(); glPushMatrix(); glTranslatef( 3.1, -2.0, 0.0 ); glRotatef( -2.0*angle-9.0, 0.0, 0.0, 1.0 ); glCallList(gear2); glPopMatrix(); glPushMatrix(); glTranslatef( -3.1, 4.2, 0.0 ); glRotatef( -2.0*angle-25.0, 0.0, 0.0, 1.0 ); glCallList(gear3); glPopMatrix(); glPopMatrix(); gwinRedraw(gh); }
void gwinTabsetSetTitle(GHandle gh, const char *title, bool_t useAlloc) { if (gh->vmt != (gwinVMT *)&tabpageVMT) return; gwinSetText(gh, title, useAlloc); FixTabSizePos(gh->parent); gwinRedraw(gh->parent); }
void gwinListEnableRender(GHandle gh, bool_t ena) { // is it a valid handle? if (gh->vmt != (gwinVMT *)&listVMT) return; if (ena) { gh->flags |= GLIST_FLG_ENABLERENDER; gwinRedraw(gh); } else { gh->flags &=~ GLIST_FLG_ENABLERENDER; } }
void gwinSetDefaultStyle(const GWidgetStyle *pstyle, bool_t updateAll) { if (!pstyle) pstyle = &BlackWidgetStyle; if (updateAll) { GHandle gh; for(gh = gwinGetNextWindow(0); gh; gh = gwinGetNextWindow(gh)) { if ((gh->flags & GWIN_FLG_WIDGET) && ((GWidgetObject *)gh)->pstyle == defaultStyle) gwinSetStyle(gh, pstyle); else gwinRedraw(gh); } } gwinSetDefaultBgColor(pstyle->background); defaultStyle = pstyle; }
void gwinTabsetSetTab(GHandle gh) { GHandle ph; if (gh->vmt != (gwinVMT *)&tabpageVMT || (gh->flags & GWIN_FLG_VISIBLE)) return; // We alter the visibility flags here directly as we know we are going to redraw everything for(ph = gwinGetFirstChild(gh->parent); ph; ph = gwinGetSibling(ph)) { if (ph->vmt == (gwinVMT *)&tabpageVMT && (ph->flags & GWIN_FLG_VISIBLE)) { // Mark this page invisible ph->flags &= ~GWIN_FLG_VISIBLE; break; } } // Mark this tab as visible gh->flags |= GWIN_FLG_VISIBLE; _gwinRippleVisibility(); // Force a redraw of the tabset gwinRedraw(gh->parent); }
static void createSettingsFrame(void) { GWidgetInit wi; gwinWidgetClearInit(&wi); wi.g.show = FALSE; wi.g.width = 320; wi.g.height = 190; wi.g.y = 25; wi.g.x = 0; wi.text = "Settings"; ghFrame1 = gwinFrameCreate(0, &wi, GWIN_FRAME_CLOSE_BTN);// | GWIN_FRAME_MINMAX_BTN); // Apply some default values for GWIN wi.customDraw = 0; wi.customParam = 0; wi.customStyle = 0; wi.g.show = true; // Apply the list parameters wi.g.width = 65; wi.g.height = 50; wi.g.y = 10; wi.g.x = 10; wi.text = "Month"; wi.g.parent = ghFrame1; // Create the actual list ghListMonth = gwinListCreate(NULL, &wi, FALSE); char item[20]; int i = 0; for (i = 0; i < 12; i++) { sprintf(item, "%s", months[i]); gwinListAddItem(ghListMonth, item, true); } gwinListSetScroll(ghListMonth, scrollSmooth); // Apply some default values for GWIN wi.customDraw = 0; wi.customParam = 0; wi.customStyle = 0; wi.g.show = true; // Apply the list parameters wi.g.width = 25; wi.g.height = 50; wi.g.y = 10; wi.g.x = 80; wi.text = "Day"; wi.g.parent = ghFrame1; // Create the actual list ghListDay = gwinListCreate(NULL, &wi, FALSE); for (i = 1; i <= 31; i++) { sprintf(item, "%i", i); gwinListAddItem(ghListDay, item, true); } gwinListSetScroll(ghListDay, scrollSmooth); // Apply some default values for GWIN wi.customDraw = 0; wi.customParam = 0; wi.customStyle = 0; wi.g.show = true; // Apply the list parameters wi.g.width = 45; wi.g.height = 50; wi.g.y = 10; wi.g.x = 110; wi.text = "Year"; wi.g.parent = ghFrame1; // Create the actual list ghListYear = gwinListCreate(NULL, &wi, FALSE); for (i = 2016; i <= 2030; i++) { sprintf(item, "%i", i); gwinListAddItem(ghListYear, item, true); } gwinListSetScroll(ghListYear, scrollSmooth); wi.g.width = 25; wi.g.height = 50; wi.g.y = 10; wi.g.x = 160; wi.text = "Hour"; wi.g.parent = ghFrame1; // Create the actual list ghListHour = gwinListCreate(NULL, &wi, FALSE); for (i = 1; i <= 24; i++) { sprintf(item, "%i", i); gwinListAddItem(ghListHour, item, true); } gwinListSetScroll(ghListHour, scrollSmooth); wi.g.width = 25; wi.g.height = 50; wi.g.y = 10; wi.g.x = 190; wi.text = "Min"; wi.g.parent = ghFrame1; // Create the actual list ghListMin = gwinListCreate(NULL, &wi, FALSE); for (i = 1; i <= 60; i++) { sprintf(item, "%i", i); gwinListAddItem(ghListMin, item, true); } gwinListSetScroll(ghListMin, scrollSmooth); // create Slider1 wi.g.y = 10; wi.g.x = 235; wi.g.width = 20; wi.g.height = 100; wi.text = "B"; wi.g.parent = ghFrame1; ghSliderBl = gwinSliderCreate(NULL, &wi); // create Slider2 wi.g.y = 10; wi.g.x = 260; wi.g.width = 20; wi.g.height = 100; wi.text = "C"; wi.g.parent = ghFrame1; ghSliderCt = gwinSliderCreate(NULL, &wi); // Apply the checkbox parameters wi.g.width = 60; // includes text wi.g.height = 20; wi.g.y = 75; wi.g.x = 10; wi.text = " 12 Hr"; ghCheckBoxHR = gwinCheckboxCreate(NULL, &wi); // create button widget: ghBtnSettings wi.g.show = TRUE; wi.g.x = 235; wi.g.y = 130; wi.g.width = 50; wi.g.height = 27; wi.g.parent = ghFrame1; wi.text = "Save"; wi.customDraw = gwinButtonDraw_Rounded; //wi.customParam = &iconSettings; //wi.customStyle = &WhiteWidgetStyle; ghBtnSave = gwinButtonCreate(0, &wi); gwinSetFont(ghBtnSave, dejavu_sans_16_anti_aliased_u); // Create label widget: ghlblDateTime wi.g.show = TRUE; wi.g.x = 75; wi.g.y = 75; wi.g.width = 150; wi.g.height = 17; wi.g.parent = ghFrame1; wi.text = "00/00/00 00:00:00"; wi.customDraw = gwinLabelDrawJustifiedLeft; wi.customParam = 0; //wi.customStyle = &syBar; ghlblDateTime = gwinLabelCreate(0, &wi); gwinLabelSetBorder(ghlblDateTime, FALSE); gwinSetFont(ghlblDateTime, dejavu_sans_16_anti_aliased_u); gwinRedraw(ghlblDateTime); }