예제 #1
0
void ro_gui_popup_menu(wimp_menu *menu, wimp_w w, wimp_i i) {
	wimp_window_state state;
	wimp_icon_state icon_state;
	state.w = w;
	icon_state.w = w;
	icon_state.i = i;
	wimp_get_window_state(&state);
	wimp_get_icon_state(&icon_state);
	menu_icon = i;
	ro_gui_create_menu(menu,
			state.visible.x0 + icon_state.icon.extent.x1 + 64,
			state.visible.y1 + icon_state.icon.extent.y1);
}
예제 #2
0
void icon_range_set_flags(wimp_w          w,
                          wimp_i          i_low,
                          wimp_i          i_high,
                          wimp_icon_flags eor,
                          wimp_icon_flags clear)
{
  wimp_icon_state state;
  wimp_i          i;

  state.w = w;
  for (i = i_low; i <= i_high; i++)
  {
    state.i = i;
    wimp_get_icon_state(&state);

    if (((state.icon.flags & ~clear) ^ eor) != state.icon.flags)
      wimp_set_icon_state(w, i, eor, clear);
  }
}
예제 #3
0
void icon_set_validation(wimp_w w, wimp_i i, const char *validation)
{
  wimp_icon_state state;

  state.w = w;
  state.i = i;
  wimp_get_icon_state(&state);

  if ((state.icon.flags & (wimp_ICON_TEXT | wimp_ICON_INDIRECTED)) == 0)
    return; /* not text + indirected */

  if (strcmp(state.icon.data.indirected_text.validation, validation) == 0)
  {
    return; /* exactly the same contents */
  }

  str_cpy(state.icon.data.indirected_text.validation, validation);

  /* Force a redraw of the icon */
  wimp_set_icon_state(w, i, 0, 0);
}
예제 #4
0
static error search_attach_child(wimp_w parent, wimp_w child, wimp_i icon)
{
  wimp_window_state         pstate;
  wimp_icon_state           istate;
  wimp_window_nesting_flags linkage;
  wimp_window_state         cstate;
  wimp_outline              coutline;

  pstate.w = parent;
  wimp_get_window_state(&pstate);

  istate.w = parent;
  istate.i = icon;
  wimp_get_icon_state(&istate);

  cstate.w = child;
  wimp_get_window_state(&cstate);

  coutline.w = child;
  wimp_get_window_outline(&coutline);

  /* record window furniture sizes */
  coutline.outline.x0 -= cstate.visible.x0;
  coutline.outline.y0 -= cstate.visible.y0;
  coutline.outline.x1 -= cstate.visible.x1;
  coutline.outline.y1 -= cstate.visible.y1;

  /* scr to wrk: wrk_x = scr_x + xscroll - visible_x0 */
  /* wrk to scr: scr_x = wrk_x - xscroll + visible_x0 */

  cstate.visible.x0 = istate.icon.extent.x0 - pstate.xscroll + pstate.visible.x0;
  cstate.visible.y0 = istate.icon.extent.y0 - pstate.yscroll + pstate.visible.y1;
  cstate.visible.x1 = istate.icon.extent.x1 - pstate.xscroll + pstate.visible.x0;
  cstate.visible.y1 = istate.icon.extent.y1 - pstate.yscroll + pstate.visible.y1;

  /* adjust for furniture */
  cstate.visible.x0 -= coutline.outline.x0;
  cstate.visible.y0 -= coutline.outline.y0;
  cstate.visible.x1 -= coutline.outline.x1;
  cstate.visible.y1 -= -coutline.outline.y0; /* the title bar is removed when
                                                we open the window, so use
                                                the bottom edge as a guide */

  cstate.next   = wimp_TOP;
  cstate.flags &= ~(wimp_WINDOW_AUTO_REDRAW |
                    wimp_WINDOW_BACK_ICON   |
                    wimp_WINDOW_CLOSE_ICON  |
                    wimp_WINDOW_TITLE_ICON  |
                    wimp_WINDOW_TOGGLE_ICON |
                    wimp_WINDOW_SIZE_ICON   |
                    wimp_WINDOW_HSCROLL);

  linkage = (wimp_CHILD_LINKS_PARENT_WORK_AREA << wimp_CHILD_LS_EDGE_SHIFT) |
            (wimp_CHILD_LINKS_PARENT_WORK_AREA << wimp_CHILD_BS_EDGE_SHIFT) |
            (wimp_CHILD_LINKS_PARENT_WORK_AREA << wimp_CHILD_RS_EDGE_SHIFT) |
            (wimp_CHILD_LINKS_PARENT_WORK_AREA << wimp_CHILD_TS_EDGE_SHIFT) |
            (wimp_CHILD_LINKS_PARENT_WORK_AREA << wimp_CHILD_XORIGIN_SHIFT) |
            (wimp_CHILD_LINKS_PARENT_WORK_AREA << wimp_CHILD_YORIGIN_SHIFT);

  wimp_open_window_nested_with_flags(&cstate, parent, linkage);

  return error_OK;
}