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; }
GHandle gwinGTabsetCreate(GDisplay *g, GTabsetObject *fo, GWidgetInit *pInit, uint32_t flags) { if (!(fo = (GTabsetObject *)_gcontainerCreate(g, (GContainerObject *)fo, pInit, &tabsetVMT))) return 0; // Set Tabset specific stuff fo->c.g.flags |= flags & GWIN_TABSET_USER_FLAGS; fo->border_top = GWIN_TABSET_TABHEIGHT; gwinSetVisible(&fo->c.g, pInit->g.show); return &fo->c.g; }
GHandle gwinGFrameCreate(GDisplay *g, GFrameObject *fo, GWidgetInit *pInit, uint32_t flags) { if (!(fo = (GFrameObject *)_gcontainerCreate(g, (GContainerObject *)fo, pInit, &frameVMT))) return 0; // Make sure we only have "safe" flags. flags &= GWIN_FRAME_USER_FLAGS; /* Apply flags. We apply these here so the controls above are outside the child area */ fo->g.flags |= flags; gwinSetVisible(&fo->g, pInit->g.show); return &fo->g; }
GHandle gwinGFrameCreate(GDisplay *g, GFrameObject *fo, GWidgetInit *pInit, uint32_t flags) { if (!(fo = (GFrameObject *)_gcontainerCreate(g, &fo->gc, pInit, &frameVMT))) return 0; fo->btnClose = 0; fo->btnMin = 0; fo->btnMax = 0; /* Buttons require a border */ if ((flags & (GWIN_FRAME_CLOSE_BTN|GWIN_FRAME_MINMAX_BTN))) flags |= GWIN_FRAME_BORDER; /* create and initialize the listener if any button is present. */ if ((flags & (GWIN_FRAME_CLOSE_BTN|GWIN_FRAME_MINMAX_BTN))) { geventListenerInit(&fo->gl); gwinAttachListener(&fo->gl); geventRegisterCallback(&fo->gl, _callbackBtn, (GHandle)fo); } /* create close button if necessary */ if ((flags & GWIN_FRAME_CLOSE_BTN)) { GWidgetInit wi; gwinWidgetClearInit(&wi); wi.g.show = TRUE; wi.g.parent = &fo->gc.g; wi.g.x = fo->gc.g.width - BORDER_X - BUTTON_X; wi.g.y = (BORDER_Y - BUTTON_Y) / 2; wi.g.width = BUTTON_X; wi.g.height = BUTTON_Y; wi.text = "X"; fo->btnClose = gwinGButtonCreate(g, 0, &wi); } /* create minimize and maximize buttons if necessary */ if ((flags & GWIN_FRAME_MINMAX_BTN)) { GWidgetInit wi; gwinWidgetClearInit(&wi); wi.g.show = TRUE; wi.g.parent = &fo->gc.g; wi.g.x = (flags & GWIN_FRAME_CLOSE_BTN) ? fo->gc.g.width - 2*BORDER_X - 2*BUTTON_X : fo->gc.g.width - BORDER_X - BUTTON_X; wi.g.y = (BORDER_Y - BUTTON_Y) / 2; wi.g.width = BUTTON_X; wi.g.height = BUTTON_Y; wi.text = "O"; fo->btnMin = gwinGButtonCreate(g, 0, &wi); wi.g.x = (flags & GWIN_FRAME_CLOSE_BTN) ? fo->gc.g.width - 3*BORDER_X - 3*BUTTON_X : fo->gc.g.width - BORDER_X - BUTTON_X; wi.g.y = (BORDER_Y - BUTTON_Y) / 2; wi.g.width = BUTTON_X; wi.g.height = BUTTON_Y; wi.text = "_"; fo->btnMax = gwinGButtonCreate(g, 0, &wi); } /* Apply flags. We apply these here so the controls above are outside the child area */ fo->gc.g.flags |= flags; gwinSetVisible(&fo->gc.g, pInit->g.show); return &fo->gc.g; }