static void _createWidgets(void) { GWidgetInit wi; // Apply some default values for GWIN gwinWidgetClearInit(&wi); wi.g.show = TRUE; // Create a surprise label behind the frame window wi.g.width = 100; wi.g.height = 20; wi.g.y = 100; wi.g.x = 150; wi.text = "Surprise!"; gwinLabelCreate(0, &wi); // Apply the frame parameters wi.g.width = 300; wi.g.height = 200; wi.g.y = 10; wi.g.x = 10; wi.text = "Colorpicker"; ghFrame1 = gwinFrameCreate(0, &wi, GWIN_FRAME_BORDER | GWIN_FRAME_CLOSE_BTN | GWIN_FRAME_MINMAX_BTN); // Apply the button parameters wi.g.width = 60; wi.g.height = 20; wi.g.x = 10; wi.g.y = 10; wi.text = "Random"; wi.g.parent = ghFrame1; ghButton1 = gwinButtonCreate(0, &wi); // Apply the slider parameters wi.g.width = 200; wi.g.height = 20; wi.g.x = 80; wi.g.y += 0; wi.text = "Red"; wi.g.parent = ghFrame1; ghSliderR = gwinSliderCreate(0, &wi); gwinSliderSetRange(ghSliderR, 0, 255); gwinSliderSetPosition(ghSliderR, 180); // Apply the button parameters wi.g.width = 60; wi.g.height = 20; wi.g.x = 10; wi.g.y += 25; wi.text = "Random"; wi.g.parent = ghFrame1; ghButton2 = gwinButtonCreate(0, &wi); // Apply the slider parameters wi.g.width = 200; wi.g.height = 20; wi.g.x = 80; wi.g.y += 0; wi.text = "Green"; wi.g.parent = ghFrame1; ghSliderG = gwinSliderCreate(0, &wi); gwinSliderSetRange(ghSliderG, 0, 255); gwinSliderSetPosition(ghSliderG, 60); // Apply the button parameters wi.g.width = 60; wi.g.height = 20; wi.g.x = 10; wi.g.y += 25; wi.text = "Random"; wi.g.parent = ghFrame1; ghButton3 = gwinButtonCreate(0, &wi); // Apply the slider parameters wi.g.width = 200; wi.g.height = 20; wi.g.x = 80; wi.g.y += 0; wi.text = "Blue"; wi.g.parent = ghFrame1; ghSliderB = gwinSliderCreate(0, &wi); gwinSliderSetRange(ghSliderB, 0, 255); gwinSliderSetPosition(ghSliderB, 235); // Color Preview wi.g.width = 270; wi.g.height = 65; wi.g.x = 10; wi.g.y = 90; ghWindow1 = gwinWindowCreate(0, &wi.g); _updateColor(); }
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); }