Exemple #1
0
/*
 *  ステータスバーの生成
 */
void CreateStatus(AG_Widget *parent)
{
	AG_Rect rec;
	AG_Surface *tmps;
	AG_PixelFormat fmt;
	int i;

	r.r = 255; // r->g
	r.g = 0; // g->b
	r.b = 0;  // b->r
	r.a = 255; // a->a

	b.r = 0;
	b.g = 0;
	b.b = 255;
	b.a = 255;

	n.r = 255;
	n.g = 255;
	n.b = 255;
	n.a = 255;

	black.r = 0;
	black.g = 0;
	black.b = 0;
	black.a = 255; //
	// アルファチャンネル
	alpha.r = 1;
	alpha.g = 1;
	alpha.b = 1;
	alpha.a = 180; //

	// Surfaceつくる
    SetPixelFormat(&fmt);
    pStatusFont =  AG_FetchFont (StatusFont, STAT_PT, 0);
	// Init Var

    nFontSize = STAT_PT;
    if(parent) {
       AG_VBox *vb;
       AG_HBox *hb;
       {
	  hb = (AG_HBox *)parent;
	  InitStatOSD(AGWIDGET(hb));
	  InitVFD(AGWIDGET(hb));
	  InitTapeOSD(AGWIDGET(hb));
	  InitLeds(AGWIDGET(hb));
       }
    }
    
}
Exemple #2
0
static void
UpdateFontSelection(AG_FontSelector *fs)
{
	AG_Variable *bFont;
	AG_Font *font, **pFont;

	font = AG_FetchFont(fs->curFace, fs->curSize, fs->curStyle);
	if (font == NULL) {
		AG_TextError(_("Error opening font: %s"), AG_GetError());
		return;
	}
	bFont = AG_GetVariable(fs, "font", &pFont);
	*pFont = font;
	AG_UnlockVariable(bFont);
}
Exemple #3
0
/*
 * 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));
	}
}