shithub: 9ferno

ref: 4142b62431afba148dba3473c32f7063dce861e4

View raw version
typedef struct TkLabel TkLabel;

/*
 * widgets that use the label code:
 *	label
 *	checkbutton
 *	button
 *	menubutton
 *	separator
 *	cascade
 *	radiobutton
 */

struct TkLabel
{
	char*		text;		/* Label value */
	Image*		bitmap;		/* Bitmap to display */
	TkImg*		img;
	int			justify;
	int			anchor;
//	int			flags;		/* justify/anchor */
	int		w;
	int		h;
	int		textheight;

	/* button fields */
	char*		command;	/* Command to execute at invoke */
	char*		value;		/* Variable value in radio button */
	char*		offvalue;		/* Off value for check button */
	char*		variable;		/* Variable name in radio button */
	int		ul;
	int		check;		/* check/radiobutton/choicebutton state */
	int		indicator;		/* -indicatoron setting */
	char*		menu;

	char**	values;
	int nvalues;
	/* current value of choicebutton is represented by check */
};

/* Layout constants */
enum {
	Textpadx	= 3,
	Textpady	= 0,
	Bitpadx	= 0,	/* Bitmap padding in labels */
	Bitpady	= 0,
	CheckButton	= 10,
	CheckButtonBW	= 1,
	ButtonBorder	= 4,
	CheckSpace = CheckButton + 2*CheckButtonBW + 2*ButtonBorder,
};

extern	TkOption	tkbutopts[];
extern	TkOption	tkradopts[];
extern	TkOption	tkcbopts[];

/* label.c */
extern	void		tksizelabel(Tk*);
extern	char*	tkdrawlabel(Tk*, Point);
extern	void		tkfreelabel(Tk*);
extern	void		tklabelgetimgs(Tk*, Image**, Image**);
extern	char*	tksetvar(TkTop*, char*, char*);

/* buton.c */
extern	Tk*	tkmkbutton(TkTop*, int);
extern	void	tksizebutton(Tk*);
extern	char*	tkdrawbutton(Tk*, Point);
extern	char*	tkbuttoninvoke(Tk*, char*, char**);
extern	char*	tkradioinvoke(Tk*, char*, char**);
extern	void		tkfreebutton(Tk*);

/* support for menus */
extern	int		tklabelmargin(Tk*);
extern	int		tkbuttonmargin(Tk*);