AG_Window * DEV_UnicodeBrowser(void) { AG_Window *win; AG_Combo *comRange; AG_Treetbl *tt; int i, w, wMax = 0; if ((win = AG_WindowNewNamedS(0, "DEV_UnicodeBrowser")) == NULL) { return (NULL); } AG_WindowSetCaptionS(win, _("Unicode Browser")); AG_WindowSetCloseAction(win, AG_WINDOW_DETACH); comRange = AG_ComboNew(win, AG_COMBO_HFILL, _("Range: ")); for (i = 0; i < unicodeRangeCount; i++) { AG_TextSize(unicodeRanges[i].name, &w, NULL); if (w > wMax) { wMax = w; } AG_TlistAddPtr(comRange->list, NULL, unicodeRanges[i].name, (void *)&unicodeRanges[i]); } AG_ComboSizeHintPixels(comRange, wMax, 10); tt = AG_TreetblNew(win, AG_TREETBL_EXPAND, NULL, NULL); AG_TreetblSizeHint(tt, 200, 6); AG_TreetblAddCol(tt, 0, "<XXXXXXX>", "Char"); AG_TreetblAddCol(tt, 1, "<XXXXXXX>", "Hex"); AG_SetEvent(comRange, "combo-selected", SelectUnicodeRange, "%p", tt); AG_WidgetFocus(comRange); return (win); }
void AG_UComboSizeHint(AG_UCombo *com, const char *text, int h) { AG_ObjectLock(com); AG_TextSize(text, &com->wPreList, NULL); com->hPreList = h; AG_ObjectUnlock(com); }
void DumpObject::InitFont(void) { char c[2]; AG_Surface *dummy; AG_PushTextState(); pDbgDialogTextFont = AG_TextFontLookup(&DebuggerTextFont[0], DBG_TEXT_PT, 0); c[0] = '0'; c[1] = '\0'; if(pDbgDialogTextFont != NULL) { AG_TextFont(pDbgDialogTextFont); } AG_TextSize(c ,&CHRW, &CHRH); pDbgDialogSymFont = AG_TextFontLookup(DebuggerSymFont, DBG_TEXT_PT, 0); AG_PopTextState(); }
/* * This function requests a minimal geometry for displaying the widget. * It is expected to return the width and height in pixels into r. * * Note: Some widgets will provide FooSizeHint() functions to allow the * programmer to request an initial size in pixels or some other metric * FooSizeHint() typically sets some structure variable, which are then * used here. */ static void SizeRequest(void *p, AG_SizeReq *r) { formaText *my = (formaText*)p; if (my->mySurface == -1) { /* * We can use AG_TextSize() to return the dimensions of rendered * text, without rendering it. */ AG_TextFont(AG_FetchFont(NULL, 24, 0)); AG_TextSize("Custom widget!", &r->w, &r->h); } else { /* * We can use the geometry of the rendered surface. The * AGWIDGET_SURFACE() macro returns the AG_Surface given a * Widget surface handle. */ r->w = AGWIDGET_SURFACE(my,my->mySurface)->w; r->h = AGWIDGET_SURFACE(my,my->mySurface)->h; //r->w=(min(r->w,600)); } }
void AG_ComboSizeHint(AG_Combo *com, const char *text, int h) { AG_TextSize(text, &com->wPreList, NULL); com->hPreList = h; }