Exemple #1
0
radiobutton newradiobutton(char *text, rect r, actionfn fn)
{
	radiobutton obj = newchildwin("button", text, BS_RADIOBUTTON, r, fn);
	if (obj) {
		obj->kind = RadioObject;
		setbackground(obj, getbackground(parentwindow(obj)));
	}
	return obj;
}
Exemple #2
0
static void hit_button(control c)
{
    window w = parentwindow(c);
    dialog_data *d = data(w);
    int value = getvalue(c);

    d->hit = value;
    hide(w);
}
Exemple #3
0
checkbox newcheckbox(char *text, rect r, actionfn fn)
{
	checkbox obj = newchildwin("button", text, BS_CHECKBOX, r, fn);
	if (obj) {
		obj->kind = CheckboxObject;
		setbackground(obj, getbackground(parentwindow(obj)));
	}
	return obj;
}
Exemple #4
0
/*
 *  Create a new static text label. Now implemented using
 *  GraphApp code instead of native MS-Windows "static"
 *  text. This gives more flexibility, better cross-platform
 *  support and there are no 'look and feel' issues with
 *  labels, so no problems are introduced by doing this.
 */
control newlabel(char *text, rect r, int alignment)
{
	control obj = newcontrol(text, r);
	if (obj) {
		obj->kind = LabelObject;
		setredraw(obj, draw_label);
		setvalue(obj, alignment);
		setbackground(obj, getbackground(parentwindow(obj)));
		settextfont(obj, SystemFont);
		show(obj);
	}
	return obj;
}
Exemple #5
0
/*
 *  Private menu deletion function.
 */
static void private_delmenu(menu m)
{
    window w = parentwindow(m);
    if (m->kind == MenuitemObject)
	RemoveMenu(m->parent->handle, m->id, MF_BYCOMMAND);
    else if (m->kind == MenuObject) {
	DeleteMenu(m->parent->handle,
		   find_menu_position(m->parent, m->text),
		   MF_BYPOSITION);
    }
    else
	DestroyMenu(m->handle);
    if (w)
	DrawMenuBar(w->handle);
}
Exemple #6
0
label newlabel(char *text, rect r, int alignment)
{
	label obj;
	unsigned long style = SS_LEFT;

	if ((alignment & AlignRight) == AlignRight)
		style = SS_RIGHT;
	if ((alignment & Center) == Center)
		style = SS_CENTER;

	obj = newchildwin("static", text, style, r, NULL);
	obj->kind = LabelObject;
	setbackground(obj, getbackground(parentwindow(obj)));
	return obj;
}
Exemple #7
0
radiobutton newradiobutton(char *text, rect r, actionfn fn)
{
	radiobutton obj = newcontrol(text, r);
	if (obj) {
		obj->kind = RadioObject;
		setredraw(obj, draw_radio);
		setmousedown(obj, checkbox_mousedown);
		setmousemove(obj, checkbox_mousemove);
		setmousedrag(obj, checkbox_mousemove);
		setmouseup(obj, radio_mouseup);
		setkeydown(obj, radio_keydown);
		setaction(obj, fn);
		setbackground(obj, getbackground(parentwindow(obj)));
		settextfont(obj, SystemFont);
		show(obj);
	}
	return obj;
}
Exemple #8
0
checkbox newcheckbox(char *text, rect r, actionfn fn)
{
	checkbox obj = newcontrol(text, r);
	if (obj) {
		obj->kind = CheckboxObject;
		setredraw(obj, draw_checkbox);
		setmousedown(obj, checkbox_mousedown);
		setmousemove(obj, checkbox_mousemove);
		setmousedrag(obj, checkbox_mousemove);
		setmouseup(obj, checkbox_mouseup);
		setkeydown(obj, checkbox_keydown);
		setaction(obj, fn);
		setbackground(obj, getbackground(parentwindow(obj)));
		settextfont(obj, SystemFont);
		show(obj);
	}
	return obj;
}
Exemple #9
0
static void hit_key(window w, int key)
{
    button btn;
    char *name = NULL;

    w = parentwindow(w);

    if (data(w) == NULL)
	return;

    if ((btn = data(w)->yes) != NULL) {
	name = getname(btn);
	if ((key == '\n') || (tolower(name[0]) == tolower(key)))
	{
	    flashcontrol(btn);
	    activatecontrol(btn);
	    return;
	}
    }

    if ((btn = data(w)->cancel) != NULL) {
	name = getname(btn);
	if ((key == ESC) || (tolower(name[0]) == tolower(key)))
	{
	    flashcontrol(btn);
	    activatecontrol(btn);
	    return;
	}
    }

    if ((btn = data(w)->no) != NULL) {
	name = getname(btn);
	if ((key == ESC) || (tolower(name[0]) == tolower(key)))
	{
	    flashcontrol(btn);
	    activatecontrol(btn);
	    return;
	}
    }

}