예제 #1
0
파일: ttest.c 프로젝트: jeffreyhorner/cxxr
/* keyboard shortcuts: CR or A/a accepts, ESC or C/c cancels */
static void hit_key(window w, int key)
{
    if(key == '\n' || tolower(key) == 'a') {
        flashcontrol(bApply);
        activatecontrol(bApply);
    }
    if(key == ESC || tolower(key) == 'c') {
        flashcontrol(bCancel);
        activatecontrol(bCancel);
    }
}
예제 #2
0
파일: menus.c 프로젝트: Bgods/r-source
static void adjust_menus_top_down(object obj)
{
    /* Recursively step up the list. */
    if (! obj)
	return;
    adjust_menus_top_down(obj->parent);

    /* Adjust menubar then child menus as we descend. */
    if (obj->kind == MenubarObject) {
	activatecontrol(obj);
	DrawMenuBar(obj->parent->handle);
    }
    else if (obj->kind == MenuObject)
	activatecontrol(obj);
}
예제 #3
0
파일: buttons.c 프로젝트: Vladimir84/rcc
static void button_keydown(control c, int ch)
{
	if (ch == ' ') {
		flashcontrol(c);
		activatecontrol(c);
	}
}
예제 #4
0
파일: buttons.c 프로젝트: Vladimir84/rcc
static void radio_hit(control c)
{
	if (!ischecked(c)) {
		uncheck_neighbours(c);
		check(c);
		activatecontrol(c);
	}
}
예제 #5
0
파일: menus.c 프로젝트: Bgods/r-source
/*
 *  Handle the menu selection. wParam is what WM_[SYS]COMMAND sets
 *  it to i.e. the object id number. The menus will already have
 *  received WM_INITMENU messages so they will be up-to-date.
 */
PROTECTED
void handle_menu_id (WPARAM wParam)
{
    object obj;

    obj = find_by_id(wParam);
    if (obj)
	activatecontrol(obj);
}
예제 #6
0
파일: buttons.c 프로젝트: Vladimir84/rcc
static void button_mouseup(control c, int buttons, point xy)
{
	if (!isarmed(c))
		return;
	disarm(c);
	unhighlight(c);
	if (ptinr(xy, getrect(c)))
		activatecontrol(c);
}
예제 #7
0
파일: buttons.c 프로젝트: Vladimir84/rcc
static void checkbox_keydown(control c, int ch)
{
	if (ch == ' ') {
		if (ischecked(c))
			uncheck(c);
		else
			check(c);
		activatecontrol(c);
	}
}
예제 #8
0
파일: menus.c 프로젝트: Bgods/r-source
/*
 *  The adjust_menu function is called just after the program
 *  receives a WM_INITMENU message.  This message is sent even if
 *  the user is attempting to use the system menu, which is nice.
 *  We use this function to keep menubars and menus up-to-date by
 *  calling their respective action functions.
 */
PROTECTED
void adjust_menu(WPARAM wParam)
{
    object obj;
    obj = find_by_handle((HANDLE)wParam);
    if (obj) {
	activatecontrol(obj);
	if (obj->kind == MenubarObject)
	    DrawMenuBar(obj->parent->handle);
    }
}
예제 #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;
	}
    }

}
예제 #10
0
파일: buttons.c 프로젝트: Vladimir84/rcc
static void checkbox_mouseup(control c, int buttons, point xy)
{
	if (! isenabled(c))
		return;
	disarm(c);
	unhighlight(c);
	if (! ptinr(xy, getrect(c)))
		return;
	if (ischecked(c))
		uncheck(c);
	else
		check(c);
	activatecontrol(c);
}
예제 #11
0
파일: menus.c 프로젝트: Bgods/r-source
PROTECTED
int handle_menu_key(WPARAM wParam)
{
    object win, obj;
    win = find_by_handle(GetFocus());
    if (win) {
	if (win->kind != WindowObject)
	    win = win->parent;
	obj = find_by_key(win, wParam);
	if (obj) {
	    adjust_menus_top_down(obj);
	    if (isenabled(obj)) /* Don't do menu actions which are greyed out. CJ */
		activatecontrol(obj);
	    return 1;
	}
    }
    return 0;
}
예제 #12
0
파일: buttons.c 프로젝트: Vladimir84/rcc
/*
 *  Activate a control's action function. We do several things here.
 *  Checking to see what kind of control it is, we handle some
 *  events and discard others. We automatically toggle the state of
 *  checkboxes and radio buttons, and handle listbox changes and
 *  allow text box update events to call the control's action.
 */
PROTECTED
void handle_control(HWND hwnd, UINT message)
{
	object obj;
	int index;

	obj = find_by_handle(hwnd);

	if ((! obj) || (! (obj->state & Enabled)))
		return;

	/* Only let certain events cause activation. */
	switch (obj->kind)
	{
	  case CheckboxObject:
		if (obj->state & Checked)
			uncheck(obj);
		else
			check(obj);
		break;

	  case RadioObject:
		if (!(obj->state & Checked)) {
			uncheck_neighbours(obj);
			check(obj);
		}
		break;

	  case ListboxObject:
		/* Ignore all but selection-change events. */
		if (message != LBN_SELCHANGE)
			return;
		index = sendmessage(hwnd, LB_GETCURSEL, 0, 0L);
		obj->value = index;
		break;

	  case MultilistObject:
		/* Ignore all but selection-change events. */
		if (message != LBN_SELCHANGE)
			return;
		index = sendmessage(hwnd, LB_GETCARETINDEX, 0, 0L);
		/* We do want to see de-selection events too
		if (! sendmessage(hwnd, LB_GETSEL, index, 0L))
		  return;*/
		obj->value = index;
		break;

	  case DroplistObject:
	  case DropfieldObject:
		/* Ignore all but selection-change events. */
		if (message != CBN_SELCHANGE)
			return;
		index = sendmessage(hwnd, CB_GETCURSEL, 0, 0L);
		obj->value = index;
		break;

	  case FieldObject:
	  case TextboxObject:
	      if (message == EN_MAXTEXT) {
		  /* increase the character limit in the editor by 50%
		     if the limit is reached, but this should not
		     happen */
		  setlimittext(obj, 1.5 * getlimittext(obj));
	      }
	      /* Ignore everything else but killfocus. */
	      else if (message != EN_KILLFOCUS)
			return;
		break;

	  default:
		break;
	}
	/* activate the control's callback */
	activatecontrol(obj);
}