示例#1
0
文件: file.c 项目: idunham/dtextra
/*
 * file->save
 */
void
mgv_file_save(Widget w, XtPointer closure, XtPointer call)
{
	MGV	*m = (MGV *)closure;
	USEUP(w); USEUP(call);
	assert(MgvOK(m));

	if(m->fs_save == NULL) {
		if((m->fs_save = wl_create(m->main, file_save)) == NULL)
			return;
		mgv_sens(m->senscache, m->sens);
		wl_callback(XtParent(m->fs_save), &fs_cb[0], (XtPointer)m);
	}
	else {
		XmFileSelectionDoSearch(m->fs_save, NULL);
	}
	wl_dlg_popup(m->fs_save);
}
示例#2
0
文件: uquestio.c 项目: oeli/yafra
XtCallbackProc xUIquestion( Widget w, XtPointer closure, XtPointer wdata)
{
	extern XtCallbackProc (*funcquestion)();
	extern XtPointer adrptr;
	extern MENU menu[];
	extern int   aktmenu[];
	extern int   aktmenuz;
	extern Widget questionshell;
	extern Widget questionbox;

	MENU *a;
	int   n;

	if (closure) {
		(*funcquestion)(w, adrptr, 0);
	}
	XtDestroyWidget(XtParent(w));
}
示例#3
0
文件: buttons.c 项目: Bpara001/CS_UCR
static void
print_mem_prompt (Widget button, XtPointer client_data, XtPointer call_data)
{
  if (print_popup == NULL)
    {
      print_popup = popup_two_field_dialog (XtParent (button), "print memory",
					"from", "",
					"to", "",
					"print", parse_print_value,
					NULL, NULL,
					&print_field1_text,
					&print_field2_text);
      XtAddCallback (print_popup, XtNdestroyCallback, print_prompt_destroyed,
		     (XtPointer) 0);
    }
  confirmAction = parse_print_value;
  XtPopup (print_popup, XtGrabNone);
}
示例#4
0
文件: help.c 项目: idunham/dtextra
/*
 * standard help callback
 */
void
wl_help(Widget w, XtPointer closure, XtPointer call)
{
static	int	firsttime = TRUE;
	XtResource hr[] = {
		{
			XwlNhelpChapter, XwlCHelpChapter,
			XtRString, sizeof(String), XtOffsetOf(HELP, chapter),
			XtRString, NULL
		}, {
			XwlNhelpSection, XwlCHelpSection,
			XtRString, sizeof(String), XtOffsetOf(HELP, section),
			XtRString, NULL
		}, {
			XwlNhelpType, XwlCHelpType,
			XwlRHelpType, sizeof(WL_HELPFN), XtOffsetOf(HELP, f),
			XtRString, (XtPointer)"remote"
		}
	};
	HELP		help;
	WLP_HELP	h;
	USEUP(call); USEUP(closure);

	if(firsttime) {
		XtSetTypeConverter(XtRString, XwlRHelpType, string2help,
						NULL, 0, XtCacheNone, NULL);
		firsttime = FALSE;
	}

	for(; w != NULL; w = XtParent(w))
		if(XtHasCallbacks(w, XmNhelpCallback) == XtCallbackHasSome)
			break;
	if(w == NULL)
		return;

	memset((void *)&help, '\0', sizeof(help));
	XtGetApplicationResources(w, &help, &hr[0], XtNumber(hr), NULL, 0);
	if(help.f == NULL || help.chapter == NULL)
		return;
	h.chapter = help.chapter;
	h.section = help.section;

	help.f(w, &h);
}
示例#5
0
文件: Host.c 项目: idunham/dtextra
static void
initialize(Widget request, Widget new_w, ArgList args, Cardinal *num_args)
{
    String Name;
    String Class;

    /*
       printf("initialize() - %i args\n", *num_args);
       printf("Fd   %i\n", Host_Fd(new_w));
       printf("Name %s\n", Host_Name(new_w));
       printf("Port %s\n", Host_Port(new_w));
     */
    Host_Mode(new_w) = MODE_ASCII;
    Host_Throttle(new_w) = False;
    Host_InputId(new_w) = 0;
    Host_OutputId(new_w) = 0;
    Host_Fd(new_w) = -1;
    Host_OutputMaxSize(new_w) = 1;
    Host_OutputSize(new_w) = 0;
    Host_OutputData(new_w) = XtMalloc(Host_OutputMaxSize(new_w));
    Host_InputMaxSize(new_w) = 1;
    Host_InputSize(new_w) = 0;
    Host_InputData(new_w) = XtMalloc(Host_InputMaxSize(new_w));
    Host_Dialog(new_w) = NULL;
    Host_InputNeed(new_w) = 0;
    Host_BinaryTimeOutId(new_w) = (XtIntervalId)NULL;
    Host_NumClients(new_w) = 0;
    Host_ClientList(new_w) = NULL;
    Host_SaveDialog(new_w) = NULL;
    if (Host_Terminator(new_w) == NULL)
    {
	Host_Terminator(new_w) = XtNewString("\r\n");
    }
    if (Host_Name(new_w) == NULL)
    {
	Host_Name(new_w) = XtNewString("localhost");
    }
    if (Host_Port(new_w) == NULL)
    {
	XtGetApplicationNameAndClass(XtDisplay(XtParent(new_w)), &Name, &Class);
	Host_Port(new_w) = XtNewString(Name);
    }
    Connect(new_w);
}
示例#6
0
/*----------------------------------------------------------------------*/
static void
DelayedArm(Widget w,XEvent * event,char ** params,Cardinal * nparams)
{
	static XtActionProc		delayed_arm_action = NULL;
    XfeBmCascadePart *		bmc = _XfeBmCascadePart(w);

	if (!delayed_arm_action)
	{
		delayed_arm_action = _XfeGetActionProc(xmCascadeButtonWidgetClass,
											  "DelayedArm");
	}

	if (XfeBmAccentIsEnabled())
	{
		/*
		 * There is a very nasty motif bug that causes the cascading shell
		 * to appear much to the right of what it is supposed to be.
		 * 
		 * The reason for this is very complicated, but fortunately the
		 * solution is pretty simple.  By moving the parent row column
		 * to (0,0) every time before the cascading shell is posted, the
		 * problem is fixed.
		 */
		_XfeMoveWidget(XtParent(w),0,0);

		_XfeBmActionWithoutDrawing(w,delayed_arm_action,event,params,nparams);
		
		AccentUpdate(w,event->xcrossing.y);
	}
	else
	{
		delayed_arm_action(w,event,params,nparams);
	}


	/*
	 * Redraw the pixmap since fancy motif menus such as those in 
	 * irix or cde will fill the whole background and erase the 
	 * previous menu.  This should be smarter, and redraw the pixmap
	 * only if needed, but the extra waste in time is smaller than
	 * the effort needed to implement it.
	 */
	DrawPixmap(w,NULL,NULL);
}
示例#7
0
文件: utils.c 项目: juddy/edcde
void
Help(
    char *helpVolume,
    char *locationId)
{
    Arg args[10];
    int n;

    if(G_help_dialog == NULL)
    {
        n = 0;
        XtSetArg(args[n], DtNhelpType, DtHELP_TYPE_TOPIC);
        n++;
        XtSetArg(args[n], DtNhelpVolume, helpVolume);
        n++;
        XtSetArg(args[n], DtNlocationId, locationId);
        n++;
        XtSetArg (args[n], XmNtitle,  GETMESSAGE(6, 5, "Directory Copy Help"));
        n++;

        G_help_dialog = DtCreateHelpDialog(G_toplevel, "helpDlg", args, n);

        XtAddCallback(G_help_dialog, DtNhyperLinkCallback,
                      (XtCallbackProc)help_hyperyperlink_callback, NULL);
        XtAddCallback(G_help_dialog, DtNcloseCallback,
                      (XtCallbackProc)help_close_callback, NULL);

        XtManageChild(G_help_dialog);
    }
    else
    {
        n = 0;
        XtSetArg(args[n], DtNhelpType, DtHELP_TYPE_TOPIC);
        n++;
        XtSetArg(args[n], DtNhelpVolume, helpVolume);
        n++;
        XtSetArg(args[n], DtNlocationId, locationId);
        n++;
        XtSetValues(G_help_dialog, args, n);
    }

    XtMapWidget(XtParent(G_help_dialog));
}
示例#8
0
文件: XsOutline.C 项目: beanhome/dev
Boolean XsOutline::_grabPointer ( )
{
   
// Sync everything up before being grabby

   XSync (XtDisplay (_w), False);   

// Grab the pointer

   if (XGrabPointer (XtDisplay (_w), XtWindow (_w), False, GrabEventMask, 
      GrabModeAsync, GrabModeAsync, XtWindow (XtParent (_w)), _getCursor ( ), 
      CurrentTime) != GrabSuccess)
   {
      XBell (XtDisplay (_w), 100);
      return (False);
   }
      
   return (True);
}
示例#9
0
void
FindDialog::directionCallback(Widget	widget,
			      XtPointer closure,
			      XtPointer)
{
  int	       which = (int) ((long) closure);	// closure contains button #
  FindDialog	*find; 
  
  // Client data is actually on the @!$?@* parent, not the toggle item
  XtVaGetValues(XtParent(widget), XmNuserData, &find, NULL);

  if (which == 0) {
    find->setSearchForward(TRUE);
  } else {
    find->setSearchForward(False);
  }

  return;
}
示例#10
0
文件: GetValues.c 项目: aosm/X11libs
void XtGetValues(
    register Widget   w,
    register ArgList  args,
    register Cardinal num_args)
{
    WidgetClass wc;
    int targ;
    XtAppContext app = XtWidgetToApplicationContext(w);

    if (num_args == 0) return;
    if ((args == NULL) && (num_args != 0)) {
	XtAppErrorMsg(app,
		"invalidArgCount","xtGetValues",XtCXtToolkitError,
            "Argument count > 0 on NULL argument list in XtGetValues",
              (String *)NULL, (Cardinal *)NULL);
    }

    LOCK_APP(app);
    wc = XtClass(w);
    LOCK_PROCESS;
    /* Get widget values */
    targ = GetValues((char*)w, (XrmResourceList *) wc->core_class.resources,
	wc->core_class.num_resources, args, num_args);
    UNLOCK_PROCESS;
    if (targ != -1 && XtIsWidget(w)) {
	XtTranslations translations = _XtGetTranslationValue(w);
	_XtCopyToArg((char*)&translations, &args[targ].value,
		     sizeof(XtTranslations));
    }

    /* Get constraint values if necessary */
    /* constraints may be NULL if constraint_size==0 */
    if (XtParent(w) != NULL && !XtIsShell(w) && XtIsConstraint(XtParent(w)) &&
	w->core.constraints) {
	ConstraintWidgetClass cwc
	    = (ConstraintWidgetClass) XtClass(XtParent(w));
	LOCK_PROCESS;
	GetValues((char*)w->core.constraints,
		  (XrmResourceList *)(cwc->constraint_class.resources),
		  cwc->constraint_class.num_resources, args, num_args);
	UNLOCK_PROCESS;
    }
    /* Notify any class procedures that we have performed get_values */
    CallGetValuesHook(wc, w, args, num_args);

    /* Notify constraint get_values if necessary */
    if (XtParent(w) != NULL && !XtIsShell(w) && XtIsConstraint(XtParent(w)))
	CallConstraintGetValuesHook(XtClass(XtParent(w)), w, args,num_args);
    UNLOCK_APP(app);
} /* XtGetValues */
示例#11
0
文件: Stroke.c 项目: idunham/dtextra
static StrokeStatePtr 
StrokeGetMap(Widget W)
{
	StrokeStatePtr State;

	State = StrokeMapList;
	while (State != NULL)
	{
		if (State->widget == W)
		{
			break;
		}
		State = State->next;
	}
	if (State == NULL)
	{
		StrokeStatePtr NewState;

		NewState = XtNew(StrokeState_t);
		NewState->next = StrokeMapList;
		StrokeMapList = NewState;
		NewState->widget = W;
		NewState->InStroke = False;
		NewState->points = NULL;
		NewState->box = NULL;
		NewState->Map = NULL;
		NewState->npoints = 0;
		NewState->maxpoints = 0;
		NewState->gc = (GC)NULL;
		XtGetSubresources(XtParent(W),
				  NewState,
				  XtName(W),
				  XtClass(W)->core_class.class_name,
				  resources,
				  XtNumber(resources),
				  NULL,
				  0);
		CompileTranslations(NewState);
		State = NewState;
	}
	return (State);
}
示例#12
0
文件: MwCombo.c 项目: UlricE/Mowitz
static void combo_text_edit(Widget w, XtPointer p, XEvent *event, Boolean *n)
{
	MwComboWidget cw = (MwComboWidget)XtParent(w);
	char *old = MwTextFieldGetString(w);

	XtAddGrab(w, True, False);
	if (cw->combo.topLevel != None) {
		XtSetKeyboardFocus(cw->combo.topLevel, w);
	}
	XtVaSetValues(w,
		XtNdisplayCaret, True,
		(char *)0);
	combo_status = WAITING;
	while (combo_status == WAITING) {
		int count, bufsiz = 10;
		XEvent event;
		XtAppNextEvent(XtWidgetToApplicationContext(w), &event);
		if (event.type == KeyPress) {
			char buf[12];
			KeySym keysym;
			XKeyEvent kevent = event.xkey;
			count = XLookupString(&kevent,
				buf, bufsiz, &keysym, NULL);
			if (keysym == XK_Escape) combo_status = ABORT;
			else if (keysym == XK_Return) combo_status = DONE;
			else XtDispatchEvent(&event);
		} else {
			XtDispatchEvent(&event);
		}
	}
	XtVaSetValues(w,
		XtNdisplayCaret, False,
		(char *)0);
	XtRemoveGrab(w);
	if (cw->combo.topLevel) {
		XtSetKeyboardFocus(cw->combo.topLevel, None);
	}
	if (combo_status == ABORT)
		MwTextFieldSetString(w, old);
	XtCallCallbackList((Widget)cw, cw->combo.text_callbacks,
		(XtPointer)MwTextFieldGetString(w));
}
static void
XawMultiSinkResize(Widget w)
{
    TextWidget ctx = (TextWidget)XtParent(w);
    MultiSinkObject sink = (MultiSinkObject)w;
    XRectangle rect;
    int width, height;

    if (w->core.widget_class != multiSinkObjectClass)
	return;

    rect.x = ctx->text.r_margin.left;
    rect.y = ctx->text.r_margin.top;
    width = (int)XtWidth(ctx) -
      (int)ctx->text.r_margin.right - (int)ctx->text.r_margin.left;
    height = (int)XtHeight(ctx) -
      (int)ctx->text.r_margin.top - (int)ctx->text.r_margin.bottom;
    rect.width = width;
    rect.height = height;

    if (sink->multi_sink.normgc) {
	if (width >= 0 && height >= 0)
	    XSetClipRectangles(XtDisplay((Widget)ctx), sink->multi_sink.normgc,
			       0, 0, &rect, 1, Unsorted);
	else
	    XSetClipMask(XtDisplay((Widget)ctx), sink->multi_sink.normgc, None);
    }
    if (sink->multi_sink.invgc) {
	if (width >= 0 && height >= 0)
	    XSetClipRectangles(XtDisplay((Widget)ctx), sink->multi_sink.invgc,
			       0, 0, &rect, 1, Unsorted);
	else
	    XSetClipMask(XtDisplay((Widget)ctx), sink->multi_sink.invgc, None);
    }
    if (sink->multi_sink.xorgc) {
	if (width >= 0 && height >= 0)
	    XSetClipRectangles(XtDisplay((Widget)ctx), sink->multi_sink.xorgc,
			       0, 0, &rect, 1, Unsorted);
	else
	    XSetClipMask(XtDisplay((Widget)ctx), sink->multi_sink.xorgc, None);
    }
}
示例#14
0
void SetMenuItemChecked(Widget w, int state)
{
  int n=0;
  Arg wargs[5];
  Pixmap mark;

  if (lsx_curwin->toplevel == NULL || w == NULL)
    return;

  if (lsx_curwin->check_mark == None)  /* create the check mark bitmap */
   {
     Display *d=XtDisplay(XtParent(w));

     mark = XCreateBitmapFromData(d, DefaultRootWindow(d),
                                  (char *)check_mark_bits,
                                  check_mark_width, check_mark_height);
     if (mark == None)
       return;

     lsx_curwin->check_mark = mark;
   }
  else
    mark = lsx_curwin->check_mark;

  /*
   * Now set the check mark.
   */
  n=0;
  XtSetArg(wargs[n], XtNleftMargin, 16);          n++;
  if (state)
    {
      /* checkmark on */
      XtSetArg(wargs[n], XtNleftBitmap, mark);    n++;
    }
  else
    {
      /* checkmark off */
      XtSetArg(wargs[n], XtNleftBitmap, None);    n++;
    }

  XtSetValues(w, wargs, n);
}
示例#15
0
static void default_save(
Widget		w,
XtPointer	data,
FILE		*fp)
{
    Position	x, y;
    Position	x_off=0, y_off=0;
    Dimension	width, height;
    String	name = XtName( w ), topl_name = (String) data;

    fprintf(fp, "!\n! %s widget geometry\n!\n", name);

    if( XtIsTransientShell( w ) )
    {
	HGU_XmGetShellOffsets( w, &x_off, &y_off );
	if( HGU_XmIsViewable( w ) )
	    fprintf(fp, "%s*%s.mappedWhenManaged: True\n",
		    topl_name, XtName(XtParent(w)));
	else
	    fprintf(fp, "%s*%s.mappedWhenManaged: False\n",
		    topl_name, XtName(XtParent(w)));
    } 
    else if( XtIsTransientShell( XtParent( w )) )
    {
	HGU_XmGetShellOffsets( XtParent( w ), &x_off, &y_off );
	if( HGU_XmIsViewable( w ) )
	    fprintf(fp, "%s*%s.mappedWhenManaged: True\n",
		    topl_name, XtName(XtParent(w)));
	else
	    fprintf(fp, "%s*%s.mappedWhenManaged: False\n",
		    topl_name, XtName(XtParent(w)));
    }

    if( XtIsSubclass( w, xmBulletinBoardWidgetClass ) ){
	if( HGU_XmIsViewable( w ) )
	    fprintf(fp, "%s*%s.defaultPosition: \tFalse\n", topl_name, name);
	else
	    fprintf(fp, "%s*%s.defaultPosition: \tTrue\n", topl_name, name);
    }
	    
    XtVaGetValues(w, XmNx, &x, XmNy, &y,
		  XmNwidth, &width, XmNheight, &height, 
		  NULL);
    fprintf(fp, "%s*%s.x:     \t%d\n", topl_name, name, x - x_off);
    fprintf(fp, "%s*%s.y:     \t%d\n", topl_name, name, y - y_off);
    fprintf(fp, "%s*%s.width: \t%d\n", topl_name, name, width);
    fprintf(fp, "%s*%s.height:\t%d\n", topl_name, name, height);
    return;
}
示例#16
0
文件: listbox.cpp 项目: hgwells/tive
void wxListBox::ChangeForegroundColour()
{
    wxWindow::ChangeForegroundColour();

    Widget parent = XtParent ((Widget) m_mainWidget);
    Widget hsb, vsb;

    XtVaGetValues(parent,
                  XmNhorizontalScrollBar, &hsb,
                  XmNverticalScrollBar, &vsb,
                  NULL);

    /* TODO: should scrollbars be affected? Should probably have separate
             function to change them (by default, taken from wxSystemSettings)

        wxDoChangeForegroundColour((WXWidget) hsb, m_foregroundColour);
        wxDoChangeForegroundColour((WXWidget) vsb, m_foregroundColour);
        wxDoChangeForegroundColour((WXWidget) parent, m_foregroundColour);
    */
}
示例#17
0
文件: test52.c 项目: melanj/lesstif
static void
ReportRC(Widget w)
{
XmRowColumnPart *rc = &((XmRowColumnWidget)w)->row_column;

	printf("%7s %17s %15s %9s %11s %11s %11s %11s %17s %8s %11s %11s %s\n",
		XtName(w),
		XtName(XtParent(w)),
		XdbRcType2String(rc->type),
		rc->armed & XmRC_ARMED_BIT ? "armed" : "not-armed",
		rc->cascadeBtn ? XtName(rc->cascadeBtn) : "NULL",
		rc->memory_subwidget ? XtName(rc->memory_subwidget) : "NULL",
		rc->lastSelectToplevel ? XtName(rc->lastSelectToplevel) : "NULL",
		rc->popupPosted ? XtName(rc->popupPosted) : "NULL",
		rc->ParentShell ? XtName(rc->ParentShell) : "NULL",
		rc->to_state ? "torn" : "not-torn",
		rc->tear_off_lastSelectToplevel ? XtName(rc->tear_off_lastSelectToplevel) : "NULL",
		rc->tear_off_focus_item ? XtName(rc->tear_off_focus_item) : "NULL",
		"");
}
示例#18
0
void iupdrvReparent(Ihandle* ih)
{
  /* Intrinsics and Motif do NOT support reparent. 
     XReparentWindow can NOT be used because will reparent only the X-Windows windows.
     So must unmap and map again to obtain the same effect. */
  Widget new_parent = iupChildTreeGetNativeParentHandle(ih);
  Widget widget = (Widget)iupAttribGet(ih, "_IUP_EXTRAPARENT");  /* here is used as the native child because is the outmost component of the elemement */
  if (!widget) widget = ih->handle;
  if (XtParent(widget) != new_parent)
  {
    int old_visible = IupGetInt(ih, "VISIBLE");
    if (old_visible)
      IupSetAttribute(ih, "VISIBLE", "NO");
    motSaveAttributesRec(ih); /* this does not save everything... */
    IupUnmap(ih);
    IupMap(ih);
    if (old_visible)
      IupSetAttribute(ih, "VISIBLE", "Yes");
  }
}
示例#19
0
文件: fileswin.cpp 项目: nixz/covise
void create_netcdffiles_popup(Widget, XtPointer, XtPointer)
{
    int x, y;
    static Widget top;
    Widget dialog;
    Widget wbut, rc, fr;
    Arg args[2];

    set_wait_cursor();
    if (top == NULL)
    {
        top = XmCreateFileSelectionDialog(app_shell, "netcdfs", NULL, 0);
        XtVaSetValues(XtParent(top), XmNtitle, "Select netCDF file", NULL);

        XtAddCallback(top, XmNokCallback, (XtCallbackProc)do_netcdffile_proc, (XtPointer)top);
        XtAddCallback(top, XmNcancelCallback, (XtCallbackProc)destroy_dialog, (XtPointer)top);
    }
    XtRaise(top);
    unset_wait_cursor();
}
示例#20
0
static GdkWindow *getGdkWindow(PluginInstance *This)
{
#ifdef MOZ_X11
    GdkWindow *gdk_window;
    Window xwin = (Window) This->window;
    Widget xt_w = XtWindowToWidget(This->display, xwin);

    if (xt_w) {
      xt_w = XtParent(xt_w);
      if (xt_w) {
         xwin = XtWindow(xt_w);
         /* xwin = xt_w->core.window; */
      }
    }
    gdk_window = gdk_window_lookup(xwin);
    return gdk_window;
#else
    return NULL;
#endif
}
示例#21
0
/*+++++++++++++++++++++++++++++++++++++++*/
static void 
_DtmapCB_dtwmDlg(
        Widget w,
        XtPointer client_data,
        XtPointer call_data )
{

    static int  first_time = 1;
    int         n;
    Arg         args[MAX_ARGS];


    DtWsmRemoveWorkspaceFunctions(style.display, XtWindow(XtParent(w)));

    if (!save.restoreFlag)
        putDialog ((Widget)client_data, w);
   
    XtRemoveCallback(style.dtwmDialog, XmNmapCallback, _DtmapCB_dtwmDlg, NULL);
  
}
示例#22
0
/*
 * Calculate size hints
 */
static void calculateSizeHints(AngbandWidget wnew)
{
	TopLevelShellWidget parent =
	(TopLevelShellWidget)XtParent((Widget) wnew);

	/* Calculate minimum size */
	parent->wm.size_hints.min_height =
	(wnew->angband.min_rows * wnew->angband.fontheight +
	 2 * wnew->angband.internal_border);

	/* Calculate minimum size */
	parent->wm.size_hints.min_width =
	(wnew->angband.min_columns * wnew->angband.fontwidth +
	 2 * wnew->angband.internal_border);

	/* Calculate minimum size */
	parent->wm.size_hints.flags |= PMinSize;

	/* Calculate maximum size */
	parent->wm.size_hints.max_height =
	(wnew->angband.max_rows * wnew->angband.fontheight +
	 2 * wnew->angband.internal_border);

	/* Calculate maximum size */
	parent->wm.size_hints.max_width =
	(wnew->angband.max_columns * wnew->angband.fontwidth +
	 2 * wnew->angband.internal_border);

	/* Calculate maximum size */
	parent->wm.size_hints.flags |= PMaxSize;

	/* Calculate increment size */
	parent->wm.size_hints.height_inc = wnew->angband.fontheight;
	parent->wm.size_hints.width_inc = wnew->angband.fontwidth;
	parent->wm.size_hints.flags |= PResizeInc;

	/* Calculate base size */
	parent->wm.base_height = 2 * wnew->angband.internal_border;
	parent->wm.base_width = 2 * wnew->angband.internal_border;
	parent->wm.size_hints.flags |= PBaseSize;
}
示例#23
0
文件: XsOutline.C 项目: beanhome/dev
void XsOutline::_drawIt (int x, int y, int w, int h)
{
   const int nsegs = 8;
   XSegment    segs[nsegs];

// Across the top

   segs[0].x1 = x; segs[0].y1 = y;
   segs[0].x2 = x + w - 1; segs[0].y2 = y;
      
   segs[1].x1 = x + BorderSize; segs[1].y1 = y + BorderSize;
   segs[1].x2 = x + w - BorderSize - 1; segs[1].y2 = y + BorderSize;
      
// Down the left

   segs[2].x1 = x + w - 1; segs[2].y1 = y + 1;
   segs[2].x2 = x + w - 1; segs[2].y2 = y + h - 1;
   
   segs[3].x1 = x + w - BorderSize - 1; segs[3].y1 = y + BorderSize + 1;
   segs[3].x2 = x + w - BorderSize - 1; segs[3].y2 = y + h - BorderSize - 1;
   
// Across the bottom

   segs[4].x1 = x + 1; segs[4].y1 = y + h - 1;
   segs[4].x2 = x + w - 2; segs[4].y2 = y + h - 1;
   
   segs[5].x1 = x + BorderSize + 1; segs[5].y1 = y + h - BorderSize - 1;
   segs[5].x2 = x + w - BorderSize - 2; segs[5].y2 = y + h - BorderSize - 1;
   
// Up the left

   segs[6].x1 = x; segs[6].y1 = y + h - 1;
   segs[6].x2 = x; segs[6].y2 = y + 1;
   
   segs[7].x1 = x + BorderSize; segs[7].y1 = y + h - BorderSize - 1;
   segs[7].x2 = x + BorderSize; segs[7].y2 = y + BorderSize + 1;
   
// Draw the segments

   XDrawSegments (XtDisplay (_w), XtWindow (XtParent (_w)), _gc, segs, nsegs);
}
示例#24
0
void
abobjP_track_external_resizes(
    Widget	widget,
    XtPointer   client_data,
    XEvent 	*event,
    Boolean	cont_to_dispatch
)
{
    ABObj     	obj = (ABObj)client_data;
    Widget    	parent = XtParent(widget);
    int	      	new_value;
    int	      	new_h = -1; 
    int	      	new_w = -1;
    int		old_w, old_h;	
    BOOL      	resized = False;

    if (event->type == ConfigureNotify)
    {
        XConfigureEvent *cfg_event = (XConfigureEvent *)&event->xconfigure;

	obj_get_size(obj, &old_w, &old_h);

        if (old_w != -1)
	    new_w = (int)cfg_event->width + (2*cfg_event->border_width);

        if (old_h != -1)
            new_h = (int)cfg_event->height + (2*cfg_event->border_width);

	if (new_w != old_w || new_h != old_h)
	{
	    if (obj && obj_is_group(obj) && 
		(obj_get_group_type(obj) != AB_GROUP_IGNORE))
	    {
		return;
	    }

	    abobj_set_save_needed(obj_get_module(obj), TRUE);
	    obj_resize(obj, new_w, new_h);
	}
    }
}
void RenderingOptionsDialog::manage()
{
    Dimension dialogWidth;

    if (!XtIsRealized(this->getRootWidget()))
	XtRealizeWidget(this->getRootWidget());

    XtVaGetValues(this->getRootWidget(),
	XmNwidth, &dialogWidth,
	NULL);

    Position x;
    Position y;
    Dimension width;
    XtVaGetValues(parent,
	XmNx, &x,
	XmNy, &y,
	XmNwidth, &width,
	NULL);

    if (x > dialogWidth + 25)
	x -= dialogWidth + 25;
    else
	x += width + 25;

    Display *dpy = XtDisplay(this->getRootWidget());
    if (x > WidthOfScreen(DefaultScreenOfDisplay(dpy)) - dialogWidth)
	x = WidthOfScreen(DefaultScreenOfDisplay(dpy)) - dialogWidth;
    XtVaSetValues(this->getRootWidget(),
	XmNdefaultPosition, False, 
	NULL);
    XtVaSetValues(XtParent(this->getRootWidget()),
	XmNdefaultPosition, False, 
	XmNx, x, 
	XmNy, y, 
	NULL);

    this->Dialog::manage();

    this->resetApproximations();
}
示例#26
0
static void Reset(Widget w)
{
  int status;
  Widget list_w = XtNameToWidget(XtParent(w),"*interpreters");
  static struct descriptor_d cli = {0, DTYPE_T, CLASS_D, 0};
  static DESCRIPTOR(initial, "_I=0");
  static DESCRIPTOR(clis, "(clis()[_I++]//\"\\0\")");
  XtPointer user_data;
  int nid;
  String selections;
  String selection;
  int ctx = 0;
  int first = 1;
  XtVaGetValues(list_w, XmNuserData, &user_data, NULL);
  nid = (intptr_t)user_data;
  XmListDeselectAllItems(list_w);
  XmListDeleteAllItems(list_w);
  TdiExecute(&initial,&cli MDS_END_ARG);
  while ((status=TdiExecute(&clis, &cli MDS_END_ARG)&1 && cli.length > 0 && strlen(cli.pointer) > 0))
  {
    XmString item;
    item = XmStringCreateSimple(cli.pointer);
    if (!XmListItemExists(list_w,item))
      XmListAddItem(list_w,item,0);
    XmStringFree(item);
  }
  selections = XmdsGetNidText(nid);
  for (selection=strtok(selections,"\n");selection;selection=strtok(0,"\n"))
  {
    XmString item = XmStringCreateSimple(selection);
    XmListSelectItem(list_w, item, 0);
    if (first)
    {
      first = 0;
      XmListSetItem(list_w, item);
    }
    XmStringFree(item);
  }
  XtFree(selections);
  return;
}
示例#27
0
文件: I18nMain.c 项目: juddy/edcde
void 
popup_i18nBB(
        Widget shell )
{
    int ret = NoError;

    if (style.i18nDialog == NULL) {
      _DtTurnOnHourGlass(shell);  
      BuildI18nDlg(shell);
      ret = InitI18nValues(shell);
      XtManageChild(style.i18nDialog);
      if (ret != NoError)
	  _DtI18nErrorDialog(ret) ;
      _DtTurnOffHourGlass(shell);  
    }
    else 
    {
        XtManageChild(style.i18nDialog);
        raiseWindow(XtWindow(XtParent(style.i18nDialog)));
    }
}
示例#28
0
// Make sure that every new filter call is performed in all other
// dialogs as well
static void FilterAllCB(Widget dialog, XtPointer client_data, 
			XtPointer call_data)
{
    SyncFiltersCB(dialog, client_data, call_data);

    // std::clog << "widget = " << longName(dialog) << "\n";

    while (dialog != 0 && !XmIsFileSelectionBox(dialog))
	dialog = XtParent(dialog);
	
    // std::clog << "dialog = " << longName(dialog) << "\n";

    for (int i = 0; i < file_dialogs.size(); i++)
    {
	if (file_dialogs[i] != dialog)
	{
	    // std::clog << "other dialog = " << longName(file_dialogs[i]) << "\n";
	    XmFileSelectionDoSearch(file_dialogs[i], 0);
	}
    }
}
示例#29
0
文件: udcexp.c 项目: juddy/edcde
void selcharokCB(Widget widget, ListData * ld, XtPointer call_data)
{
    int		num;
    Exc_data	*ed;
    int		ans;
    char	*msg;

    msg = GETMESSAGE(10, 4, "No indexes are selected");

    XtVaGetValues(ld->list, XmNselectedItemCount, &num, NULL);
    if (num == 0) {
/*	AskUser(widget, ld->ed, msg, &ans, "error");*/
	return;
    } else {
	setselectedcode(ld);
	XtUnmanageChild(XtParent(widget));
	ed = ld->ed;
	freeld(ld);
	getbdffn(ed);
    }
}
示例#30
0
/*----------------------------------------------------------------------*/
static void
Initialize(Widget rw,Widget nw,ArgList args,Cardinal *nargs)
{
    XfeBmButtonPart *		bmp = _XfeBmButtonPart(nw);
	XmLabelPart *			lp = _XfeXmLabelPart(nw);

	assert( XmIsRowColumn(XtParent(nw)) );

	/* Force the type to be string always */
	lp->label_type = XmSTRING;

	bmp->pixmap_GC = XfeAllocateTransparentGc(nw);

	_XfePixmapPrepare(nw,
					  &lp->pixmap,
					  &bmp->pixmap_width,
					  &bmp->pixmap_height,
					  XmNlabelPixmap);

	XfeOverrideTranslations(nw,_XfeBmButtonExtraTranslations);
}