Exemplo n.º 1
0
int
main (int argc, char **argv)
{
    XtAppContext xtcontext;
    Widget toplevel;

    ProgramName = argv[0];

    XtSetLanguageProc(NULL, (XtLanguageProc) NULL, NULL);

    toplevel = XtAppInitialize(&xtcontext, "XBiff", options, XtNumber (options),
			       &argc, argv, NULL, NULL, 0);
    if (argc != 1) Usage ();

    /*
     * This is a hack so that f.delete will do something useful in this
     * single-window application.
     */
    wm_delete_window = XInternAtom (XtDisplay(toplevel), "WM_DELETE_WINDOW",
                                    False);
    XtAppAddActions (xtcontext, xbiff_actions, XtNumber(xbiff_actions));
    XtOverrideTranslations(toplevel,
		   XtParseTranslationTable ("<Message>WM_PROTOCOLS: quit()"));

    (void) XtCreateManagedWidget ("mailbox", mailboxWidgetClass, toplevel,
				  NULL, 0);
    XtRealizeWidget (toplevel);
    (void) XSetWMProtocols (XtDisplay(toplevel), XtWindow(toplevel),
                            &wm_delete_window, 1);
    XtAppMainLoop (xtcontext);

    return 0;
}
Exemplo n.º 2
0
void
xaw_create_menu(struct button_info *item, Widget parent, int *ret_width)
{
    Dimension y_pos = resource.btn_top_spacing;
    size_t i;

    XtAppAddActions(XtWidgetToApplicationContext(globals.widgets.form_widget), menu_actions, XtNumber(menu_actions));

    for (i = 0; item != NULL && i < item->size; i++) {
        Widget button;
        Dimension w, h;

        if (item->elems[i].type == BT_SEP) { /* separator */
            XDVI_ERROR((stderr, "Cannot have a separator on a toplevel Xaw menu (ignoring)"));
            /* y_pos += resource.btn_between_extra; */
            continue;
        }
        else if (item->elems[i].submenu != NULL) { /* menu button, create a pulldown menu */
            Widget shell;

            button = XtVaCreateWidget("button", menuButtonWidgetClass, parent,
                                      XtNmenuName, item->elems[i].title,
                                      XtNlabel, item->elems[i].title,
                                      XtNx, resource.btn_side_spacing,
                                      XtNy, y_pos,
                                      XtNborderWidth, resource.btn_border_width,
                                      NULL);
            shell = XtCreatePopupShell(item->elems[i].title, simpleMenuWidgetClass, button, NULL, 0);

            create_menu_entries(item->elems[i].submenu, shell);
        }
        else { /* command button */
            command_call[0].closure = (XtPointer)item->elems[i].action;
            button = XtVaCreateWidget(item->elems[i].title, commandWidgetClass, parent,
                                      XtNlabel, item->elems[i].title,
                                      XtNx, resource.btn_side_spacing,
                                      XtNy, y_pos,
                                      XtNborderWidth, resource.btn_border_width,
                                      XtNcallback, (XtArgVal)command_call,
                                      NULL);
        }
        XtVaGetValues(button, XtNwidth, &w, XtNheight, &h, NULL);
        y_pos += h + resource.btn_between_spacing + 2 * resource.btn_border_width;
        if (w > m_panel_width)
            m_panel_width = w;
        item->elems[i].widget = button;
    }

    /* adjust button sizes, and manage buttons (managing them earlier may result
       in `parent has no geometry manager' error) */
    for (i = 0; item != NULL && i < item->size; i++) {
        XtVaSetValues(item->elems[i].widget, XtNwidth, m_panel_width, NULL);
        XtManageChild(item->elems[i].widget);
    }

    m_y_pos = y_pos - resource.btn_between_spacing + resource.btn_top_spacing + 2 * resource.btn_border_width;
    m_panel_width += 2 * resource.btn_side_spacing + resource.btn_border_width;
    XtVaSetValues(panel_widget, XtNwidth, m_panel_width, NULL);
    *ret_width = m_panel_width;
}
Exemplo n.º 3
0
Widget
xaw_create_menu_widgets(Widget parent)
{
    /* hack to disable the magnifier in the panel: */
    XtTranslations panel_translations = XtParseTranslationTable("#augment <ButtonPress>:");

    XtAppAddActions(XtWidgetToApplicationContext(parent), menu_actions, XtNumber(menu_actions));

    line_widget = XtVaCreateWidget("line", widgetClass, parent,
                                   XtNbackground, (XtArgVal)resource.fore_Pixel,
                                   XtNwidth, (XtArgVal)1,
                                   XtNfromHoriz, (XtArgVal)globals.widgets.vport_widget,
                                   XtNborderWidth, (XtArgVal)0,
                                   XtNtop, (XtArgVal)XtChainTop,
                                   XtNbottom, (XtArgVal)XtChainBottom,
                                   XtNleft, (XtArgVal)XtChainRight,
                                   XtNright, (XtArgVal)XtChainRight,
                                   NULL);
    panel_widget = XtVaCreateWidget("panel", compositeWidgetClass, parent,
                                    XtNborderWidth, (XtArgVal)0,
                                    XtNfromHoriz, (XtArgVal)line_widget,
                                    XtNtranslations, (XtArgVal)panel_translations,
                                    XtNtop, (XtArgVal)XtChainTop,
                                    XtNbottom, (XtArgVal)XtChainBottom,
                                    XtNleft, (XtArgVal)XtChainRight,
                                    XtNright, (XtArgVal)XtChainRight,
                                    NULL);
    return panel_widget;
}
Exemplo n.º 4
0
static Widget
make_dialog (const char* name, Widget parent, Boolean pop_up_p,
	     const char* shell_title, const char* UNUSED (icon_name),
             Boolean text_input_slot,
	     Boolean radio_box, Boolean list,
	     int left_buttons, int right_buttons)
{
  Arg av [20];
  int ac = 0;
  int i, bc;
  char button_name [255];
  Widget shell;
  Widget dialog;
  Widget button;
  XtTranslations override;

  if (! pop_up_p) abort (); /* not implemented */
  if (text_input_slot) abort (); /* not implemented */
  if (radio_box) abort (); /* not implemented */
  if (list) abort (); /* not implemented */

  if (! actions_initted)
    {
      XtAppContext app = XtWidgetToApplicationContext (parent);
      XtAppAddActions (app, xaw_actions,
		       sizeof (xaw_actions) / sizeof (xaw_actions[0]));
      actions_initted = True;
    }

  override = XtParseTranslationTable (overrideTrans);
Exemplo n.º 5
0
static void 
_StrokeInitialize(Widget W)
{
	StrokeStatePtr NewState;

	if (StrokeStateList == NULL)
	{
		NewState = XtNew(StrokeState_t);
		NewState->next = StrokeStateList;
		StrokeStateList = 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;
		XtGetApplicationResources(W,
					  NewState,
					  resources, XtNumber(resources),
					  NULL, 0);
		if (NewState->slop < 3)
		{
			XtWarning("Stroke slop cannot be less than 3");
			NewState->slop = 3;
		}
	}
	XtAppAddActions(XtWidgetToApplicationContext(W),
			Actions, XtNumber(Actions));
}
Exemplo n.º 6
0
void iupdrvTabsInitClass(Iclass* ic)
{
  /* Driver Dependent Class functions */
  ic->Map = motTabsMapMethod;
  ic->ChildAdded     = motTabsChildAddedMethod;
  ic->ChildRemoved   = motTabsChildRemovedMethod;

  {
    /* Set up a translation table that captures "Resize" events
       (also called ConfigureNotify or Configure events). */
    XtActionsRec rec = {"iupTabsConfigure", motTabsConfigureNotify};
    XtAppAddActions(iupmot_appcontext, &rec, 1);
  }

  /* Driver Dependent Attribute functions */

  /* Common */
  iupClassRegisterAttribute(ic, "STANDARDFONT", NULL, motTabsSetStandardFontAttrib, IUPAF_SAMEASSYSTEM, "DEFAULTFONT", IUPAF_NOT_MAPPED);

  /* Visual */
  iupClassRegisterAttribute(ic, "BGCOLOR", NULL, motTabsSetBgColorAttrib, IUPAF_SAMEASSYSTEM, "DLGBGCOLOR", IUPAF_DEFAULT);
  iupClassRegisterAttribute(ic, "FGCOLOR", NULL, motTabsSetFgColorAttrib, IUPAF_SAMEASSYSTEM, "0 0 0", IUPAF_DEFAULT);
  iupClassRegisterAttribute(ic, "BACKGROUND", NULL, motTabsSetBackgroundAttrib, IUPAF_SAMEASSYSTEM, "DLGBGCOLOR", IUPAF_DEFAULT);
  
  /* IupTabs only */
  iupClassRegisterAttribute(ic, "TABTYPE", iupTabsGetTabTypeAttrib, motTabsSetTabTypeAttrib, IUPAF_SAMEASSYSTEM, "TOP", IUPAF_NOT_MAPPED|IUPAF_NO_INHERIT);  
  iupClassRegisterAttribute(ic, "TABORIENTATION", iupTabsGetTabOrientationAttrib, NULL, IUPAF_SAMEASSYSTEM, "HORIZONTAL", IUPAF_READONLY|IUPAF_NOT_MAPPED|IUPAF_NO_INHERIT);  /* can not be set, always HORIZONTAL in Motif */
  iupClassRegisterAttributeId(ic, "TABTITLE", NULL, motTabsSetTabTitleAttrib, IUPAF_NO_INHERIT);
  iupClassRegisterAttributeId(ic, "TABIMAGE", NULL, motTabsSetTabImageAttrib, IUPAF_NO_INHERIT);
  iupClassRegisterAttribute(ic, "PADDING", iupTabsGetPaddingAttrib, motTabsSetPaddingAttrib, IUPAF_SAMEASSYSTEM, "0x0", IUPAF_NOT_MAPPED);
}
Exemplo n.º 7
0
static int motSetDragSourceAttrib(Ihandle* ih, const char* value)
{
  Widget w = (Widget)iupAttribGet(ih, "_IUPMOT_DND_WIDGET");
  if (!w)
    w = ih->handle;

  if(iupStrBoolean(value))
  {
    char dragTranslations[] = "#override <Btn2Down>: iupStartDrag()";
    static int do_rec = 0;

    if (!do_rec)
    {
      XtActionsRec rec = {"iupStartDrag", (XtActionProc)motDragStart};
      XtAppAddActions(iupmot_appcontext, &rec, 1);
      do_rec = 1;
    }
    XtOverrideTranslations(w, XtParseTranslationTable(dragTranslations));

    XtVaSetValues(w, XmNuserData, ih, NULL);  /* Warning: always check if this affects other controls */
  }
  else
    iupmotDisableDragSource(w);

  return 1;
}
Exemplo n.º 8
0
Arquivo: proj.c Projeto: juddy/edcde
/*
 * Register project actions with Xt
 */
void
proj_register_actions(
    XtAppContext app
)
{
    XtAppAddActions(app, projwin_actions, XtNumber(projwin_actions));
}
Exemplo n.º 9
0
Widget make_text_widget(char *name, Widget parent, Arg *args, int n)
{
  /* white background when active, emacs translations */
  /* used only for comment widget in file data box (snd-xfile.c), but needs to be in this file to pick up actions etc */
  Widget df;
  if (!actions_loaded) 
    {
      XtAppAddActions(MAIN_APP(ss), acts, NUM_ACTS); 
      actions_loaded = true;
    }
  XtSetArg(args[n], XmNeditMode, XmMULTI_LINE_EDIT); n++;
  /* XmNblinkRate 0 turns off the cursor blink */
  XtSetArg(args[n], XmNcursorPositionVisible, false); n++;
  XtSetArg(args[n], XmNhighlightThickness, 1); n++;
  df = XmCreateScrolledText(parent, name, args, n);
  XtManageChild(df);
  XtAddCallback(df, XmNfocusCallback, textfield_focus_callback, NULL);
  XtAddCallback(df, XmNlosingFocusCallback, textfield_unfocus_callback, NULL);
  XtAddEventHandler(df, EnterWindowMask, false, mouse_enter_text_callback, NULL);
  XtAddEventHandler(df, LeaveWindowMask, false, mouse_leave_text_callback, NULL);
  if (!transTable3) 
    transTable3 = XtParseTranslationTable(TextTrans3);
  XtOverrideTranslations(df, transTable3);
  return(df);
}
Exemplo n.º 10
0
PRIVATE void CreateLido ()
{
	Widget	sink;
	Arg	args[10];
	int	n;

      /* Create a new toplevel Shell */
	n = 0;
	if (LidoGeometry[0] != '\0')
	{
		XtSetArg (args[n], XtNgeometry, LidoGeometry); n++;
	}
	XtSetArg (args[n], XtNtitle, Res.lido_name); n++;
	LidoTop = XtCreatePopupShell ("lido", topLevelShellWidgetClass,
						Toplevel, args, n);

      /* Create the Text Widget */
	n = 0;
	XtSetArg (args[n], XtNtype, XawAsciiFile); n++;
	XtSetArg (args[n], XtNstring, Res.lido_name); n++;
	LidoText = XtCreateManagedWidget ("lidoText", asciiTextWidgetClass,
						LidoTop, args, n);

      /* Realize the new top level Widget */
	XtPopup (LidoTop, XtGrabNone);

      /*
       * This is a hack so that wm_delete_window will close the rule graph window.
       */
       
        /* Register Actions */
       XtAppAddActions (XtWidgetToApplicationContext(LidoTop), lido_actions, XtNumber(lido_actions));

       XtOverrideTranslations(LidoTop, 
		    XtParseTranslationTable ("<Message>WM_PROTOCOLS: close()"));
       
       wm_delete_window = XInternAtom (XtDisplay(LidoTop), "WM_DELETE_WINDOW", False);
       
       XSetWMProtocols (XtDisplay(LidoTop), XtWindow(LidoTop),
			    &wm_delete_window, 1);


      /* Try to find text sink */
	sink = XtNameToWidget (LidoTop, AsciiTextSinkName);
	if (sink == NULL)
	{
/* Don't give warnings... XtNameToWidget has never worked!
		fprintf (stderr,"%s: Couldn't find window of LIDO text.\n",
				ProgName);
		fprintf (stderr, "Menu will not work in LIDO window.\n");
*/
		return;
	}
	
      /* Register a passive grab for menu-popup */
	XGrabButton (XtDisplay (sink), AnyButton, AnyModifier, 
		XtWindow (sink), TRUE, ButtonPressMask|ButtonReleaseMask,
		GrabModeAsync, GrabModeAsync, None, None);
}
Exemplo n.º 11
0
void 
launch_about(Widget w, XtPointer closure, XtPointer call_data)
{
    DeclareArgs(10);
    Widget    form, icon, ok;
    Position  x, y;
    char	  info[400];

    /* turn off Compose key LED */
    setCompLED(0);

    /* don't make more than one */
    if (!help_popup) {

	/* get the position of the help button */
	XtTranslateCoords(w, (Position) 0, (Position) 0, &x, &y);
	FirstArg(XtNx, x);
	NextArg(XtNy, y);
	help_popup = XtCreatePopupShell("About Xfig",transientShellWidgetClass,
				tool, Args, ArgCount);
	XtOverrideTranslations(help_popup,
			   XtParseTranslationTable(about_translations));
	XtAppAddActions(tool_app, about_actions, XtNumber(about_actions));

	FirstArg(XtNborderWidth, 0);
	form = XtCreateManagedWidget("help_form", formWidgetClass, help_popup,
				Args, ArgCount);
	/* put the xfig icon in a label and another label saying which version this is */
	FirstArg(XtNbitmap, fig_icon);
	NextArg(XtNinternalHeight, 0);
	NextArg(XtNinternalWidth, 0);
	NextArg(XtNborderWidth, 0);
	icon = XtCreateManagedWidget("xfig_icon", labelWidgetClass, form, Args, ArgCount);

	/* make up some information */
	strcpy(info,xfig_version);
	strcat(info,"\n  Parts Copyright \251 1989-2013 by Brian V. Smith ([email protected])");
	strcat(info,"\n  Parts Copyright \251 1991 by Paul King");
	strcat(info,"\n  Copyright \251 1985-1988 by Supoj Sutanthavibul");
	strcat(info,"\n  See source files and man pages for other copyrights");

	FirstArg(XtNlabel, info);
	NextArg(XtNfromHoriz, icon);
	NextArg(XtNhorizDistance, 20);
	NextArg(XtNborderWidth, 0);
	XtCreateManagedWidget("xfig_icon", labelWidgetClass, form, Args, ArgCount);

	FirstArg(XtNlabel, " Ok ");
	NextArg(XtNwidth, 50);
	NextArg(XtNheight, 30);
	NextArg(XtNfromVert, icon);
	NextArg(XtNvertDistance, 20);
	ok = XtCreateManagedWidget("help_ok", commandWidgetClass, form, Args, ArgCount);
	XtAddCallback(ok, XtNcallback, help_ok, (XtPointer) NULL);
    }
    XtPopup(help_popup,XtGrabNone);
    (void) XSetWMProtocols(tool_d, XtWindow(help_popup), &wm_delete_window, 1);
}
Exemplo n.º 12
0
static void make_command_widget(int height)
{
  if (!listener_text)
    {
      Arg args[32];
      Widget wv, wh;
      int n;

      if (!actions_loaded) {XtAppAddActions(MAIN_APP(ss), acts, NUM_ACTS); actions_loaded = true;}

      n = attach_all_sides(args, 0);
      XtSetArg(args[n], XmNheight, height); n++;
      if ((sound_style(ss) == SOUNDS_IN_NOTEBOOK) || (sound_style(ss) == SOUNDS_HORIZONTAL))
	listener_pane = XtCreateManagedWidget("frm", xmFormWidgetClass, SOUND_PANE_BOX(ss), args, n);
      else listener_pane = XtCreateManagedWidget("frm", xmFormWidgetClass, SOUND_PANE(ss), args, n);
      /* this widget is not redundant at least in Metroworks Motif */

      n = 0;
      XtSetArg(args[n], XmNbackground, ss->sgx->listener_color); n++;
      XtSetArg(args[n], XmNforeground, ss->sgx->listener_text_color); n++;
      if (ss->sgx->listener_fontlist) {XtSetArg(args[n], XM_FONT_RESOURCE, ss->sgx->listener_fontlist); n++;}
      n = attach_all_sides(args, n);
      XtSetArg(args[n], XmNeditMode, XmMULTI_LINE_EDIT); n++;
      XtSetArg(args[n], XmNskipAdjust, true); n++;
      XtSetArg(args[n], XmNvalue, listener_prompt(ss)); n++;
      XtSetArg(args[n], XmNpendingDelete, false); n++; /* don't cut selection upon paste */
      XtSetArg(args[n], XmNpositionIndex, XmLAST_POSITION); n++;
      XtSetArg(args[n], XmNhighlightThickness, 1); n++;
      listener_text = XmCreateScrolledText(listener_pane, "lisp-listener", args, n);
      ss->sgx->listener_pane = listener_text;

      XtVaSetValues(MAIN_SHELL(ss), XmNallowShellResize, false, NULL);

      XtManageChild(listener_text);
      XmTextSetCursorPosition(listener_text, 1);
      if (!transTable4) 
	transTable4 = XtParseTranslationTable(TextTrans4);
      XtOverrideTranslations(listener_text, transTable4);
      printout_end = 0;
      XtAddCallback(listener_text, XmNactivateCallback, command_return_callback, NULL);
      XtAddCallback(listener_text, XmNmodifyVerifyCallback, command_modify_callback, NULL);
      XtAddCallback(listener_text, XmNmotionVerifyCallback, command_motion_callback, NULL);

      lisp_window = XtParent(listener_text);
      XtAddEventHandler(lisp_window, EnterWindowMask, false, listener_focus_callback, NULL);
      XtAddEventHandler(lisp_window, LeaveWindowMask, false, listener_unfocus_callback, NULL);
      
      XmChangeColor(lisp_window, ss->sgx->basic_color);
      XtVaGetValues(lisp_window, XmNverticalScrollBar, &wv, XmNhorizontalScrollBar, &wh, NULL);
      XmChangeColor(wv, ss->sgx->basic_color);
      XmChangeColor(wh, ss->sgx->basic_color);
      map_over_children(SOUND_PANE(ss), color_sashes);

      if (auto_resize(ss))
	XtVaSetValues(MAIN_SHELL(ss), XmNallowShellResize, true, NULL);
    }
}
Exemplo n.º 13
0
static Widget
make_dialog (char* name,
             Widget parent,
             Boolean pop_up_p,
             char* shell_title,
             char* icon_name,
             Boolean text_input_slot,
             Boolean radio_box,
             Boolean list,
             int left_buttons,
             int right_buttons,
             widget_instance *instance)
{
    Arg av [20];
    int ac = 0;
    int i, bc;
    char button_name [255];
    Widget shell;
    Widget dialog;
    Widget button;
    XtTranslations override;
#ifdef HAVE_XFT
    XftFont *xft_font = 0;
    XtTranslations button_override;
#endif

    if (! pop_up_p) abort (); /* not implemented */
    if (text_input_slot) abort (); /* not implemented */
    if (radio_box) abort (); /* not implemented */
    if (list) abort (); /* not implemented */

    if (! actions_initted)
    {
        XtAppContext app = XtWidgetToApplicationContext (parent);
        XtAppAddActions (app, xaw_actions,
                         sizeof (xaw_actions) / sizeof (xaw_actions[0]));
#ifdef HAVE_XFT
        XtAppAddActions (app, button_actions,
                         sizeof (button_actions) / sizeof (button_actions[0]));
#endif
        actions_initted = True;
    }

    override = XtParseTranslationTable (overrideTrans);
Exemplo n.º 14
0
Arquivo: server.c Projeto: rtoy/cmucl
void serve_client(int socket)
{
    XEvent event;

    XtToolkitInitialize();
    app_context = XtCreateApplicationContext();

    LispAction.string = "Lisp";
    LispAction.proc   = LispActionProc;
    XtAppAddActions(app_context, &LispAction, 1);

    string_token_tag = find_type_entry(ExtRStringToken);
    string_tag = find_type_entry(XtRString);
    xm_string_tag = find_type_entry(XmRXmString);
    enum_tag = find_type_entry(XtREnum);
    int_tag = find_type_entry(XtRInt);
    window_tag = find_type_entry(XtRWindow);
    boolean_tag = find_type_entry(XtRBoolean);
    widget_tag = find_type_entry(XtRWidget);
    function_tag = find_type_entry(XtRFunction);
    callback_reason_tag = find_type_entry(ExtRCallbackReason);
    event_tag = find_type_entry(ExtREvent);
    resource_list_tag = find_type_entry(ExtRResourceList);
    translation_table_tag = find_type_entry(XtRTranslationTable);
    accelerator_table_tag = find_type_entry(XtRAcceleratorTable);
    atom_tag = find_type_entry(XtRAtom);
    font_list_tag = find_type_entry(XmRFontList);
    string_table_tag = find_type_entry(XtRStringTable);
    xm_string_table_tag = find_type_entry(XmRXmStringTable);
    int_list_tag = find_type_entry(ExtRIntList);
    cursor_tag = find_type_entry(XtRCursor);

    client_socket = socket;
    greet_client(socket);

    XtAppAddInput(app_context, socket, (XtPointer)XtInputReadMask,
                  (XtInputCallbackProc)get_input, (XtPointer)NULL);

    XtAppSetErrorHandler(app_context, MyErrorHandler);
    XtAppSetWarningHandler(app_context, MyWarningHandler);

    /* Here is where we want to return on errors */
    if( setjmp(env) ) {
        printf("Attempting to recover from error.\n");
        fflush(stdout);
    }
    while( !terminate_server ) {
        XtAppNextEvent(app_context, &event);
        XtDispatchEvent(&event);
    }

    close(socket);
    XtDestroyApplicationContext(app_context);

    exit(0);
}
Exemplo n.º 15
0
/* ---
*/
void interp_startup(void)
{
	XtAppContext app_context = XtWidgetToApplicationContext(topLevel);
	init_subr_0("image-filename", limage_filename);
	init_subr_2("ani-property", ani_property);
	init_subr_2("ani-ctl", lani_ctl);
	init_subr_0("next-page", lnext_page);
	init_subr_0("previous-page", lprevious_page);
	XtAppAddActions(app_context, actions, XtNumber(actions));
}
Exemplo n.º 16
0
/*----------------------------------------------------------------------*/
/* extern */ void
XfeAddActions(Widget w,XtActionList actions,Cardinal num_actions)
/*----------------------------------------------------------------------*/
{
	assert( _XfeIsAlive(w) );
	assert( actions != NULL );
	assert( num_actions > 0 );

	XtAppAddActions(XtWidgetToApplicationContext(w),actions,num_actions);
}
Exemplo n.º 17
0
/*
** Install the action for following hyperlinks in the help window
*/
void InstallHelpLinkActions(XtAppContext context)
{   
    static XtActionsRec Actions[] =
    {
        {"help-hyperlink", helpHyperlinkAP},
        {"help-focus-buttons", helpFocusButtonsAP},
        {"help-button-action", helpButtonActionAP}
    };

    XtAppAddActions(context, Actions, XtNumber(Actions));
}
Exemplo n.º 18
0
void iupmotDisableDragSource(Widget w)
{
  char dragTranslations[] = "#override <Btn2Down>: iupDoNothing()";
  static int do_nothing_rec = 0;
  if (!do_nothing_rec)
  {
    XtActionsRec rec = {"iupDoNothing", (XtActionProc)motDoNothing};
    XtAppAddActions(iupmot_appcontext, &rec, 1);
    do_nothing_rec = 1;
  }
  XtOverrideTranslations(w, XtParseTranslationTable(dragTranslations));
}
Exemplo n.º 19
0
void readDTIcons(void)
{
 FILE *fp;
 AppRec app;
 char *name, *directory, *fname, *icon, *push_action, *drop_action, *xp, *yp;
 char s[MAXAPPSTRINGLEN];
 int i, p, x, y;

 XtAppAddActions(app_context, icon_actions, XtNumber(icon_actions));
 trans = XtParseTranslationTable(icon_translations);

 dticons_blocked = False;

 if (stat(resources.dticon_file, &dticons_stats) ||
     !(fp = fopen(resources.dticon_file, "r")))
 {
     dticons_readable = False;
     error(getAnyShell(), "Cannot read desktop icons from", resources.dticon_file);
     return;
 }

 dticons_readable = True;

 for (i=0; (p = parseIcon(fp, &name, &directory, &fname, &icon, &push_action, &drop_action, &xp, &yp)) > 0; i++)
 {
     dtIcons = (DTIconRec **) XTREALLOC(dtIcons, (i+1) * sizeof(DTIconRec *));
     app.name = XtNewString(strparse(s, name, "\\:"));
     app.directory = XtNewString(strparse(s, directory, "\\:"));
     app.fname = XtNewString(strparse(s, fname, "\\:"));
     app.icon = XtNewString(strparse(s, icon, "\\:"));
     app.push_action = XtNewString(strparse(s, push_action, "\\:"));
     app.drop_action = XtNewString(strparse(s, drop_action, "\\:"));
     app.objType = getObjectType(app.push_action);
     app.remove_file = False;
     if ((x = atoi(strparse(s, xp, "\\:"))) < 0)
	 x += winInfo.rootWidth - DTICONWIDTH;
     if ((y = atoi(strparse(s, yp, "\\:"))) < 0)
	 y += winInfo.rootHeight - DTICONHEIGHT;

     dtIcons[i] = createDTIcon(getAnyShell(), &app, x, y);
     dtIcons[i]->save = True;
     displayDTIcon(dtIcons[i]);
 }
 
 if (p == -1)
     error(getAnyShell(), "Error reading desktop icons from", resources.dticon_file);

 n_dtIcons = i;

 if (fclose(fp))
     sysError(getAnyShell(), "Error reading desktop icons:");
}
Exemplo n.º 20
0
void add_completer_to_textfield(Widget w, int completer)
{
  /* used to make file selection dialog act like other text field widgets */
  if (!actions_loaded) 
    {
      XtAppAddActions(MAIN_APP(ss), acts, NUM_ACTS); 
      actions_loaded = true;
    }
  if (!transTable2) 
    transTable2 = XtParseTranslationTable(TextTrans2);
  XtOverrideTranslations(w, transTable2);
  add_completer_widget(w, completer);
}
Exemplo n.º 21
0
int Ginitgraphics (void) {
    argn = 0;
#if defined(FEATURE_NEXTAW) || defined(FEATURE_XAW3D)
    if (!(Groot = XtAppInitialize (
        &appcontext, "LEFTY", NULL, 0, &argn, NULL, props, NULL, 0
    )))
#else
    if (!(Groot = XtAppInitialize (
        &appcontext, "LEFTY", NULL, 0, &argn, NULL, NULL, NULL, 0
    )))
#endif
        Gerr (POS, G_ERRINITFAILED);
    XtAppAddActions (appcontext, actiontable, XtNumber (actiontable));
    Gtweoltable = XtParseTranslationTable (deftweoltrans);
    Gqwpoptable = XtParseTranslationTable (defqwpoptrans);
    Glwanytable = XtParseTranslationTable (deflwanytrans);
    Gcwanytable = XtParseTranslationTable (defcwanytrans);
    Gqwdeltable = XtParseTranslationTable (defqwdeltrans);
    Gwmdeltable = XtParseTranslationTable (defwmdeltrans);
    XtRegisterGrabAction (
        Glwbutaction, True,
        ButtonPressMask | ButtonReleaseMask, GrabModeAsync, GrabModeAsync
    );
    XtRegisterGrabAction (
        Gcwbutaction, True,
        ButtonPressMask | ButtonReleaseMask, GrabModeAsync, GrabModeAsync
    );
    Gdisplay = XtDisplay (Groot);
    Gscreenn = DefaultScreen (Gdisplay);
    Gdepth = DefaultDepth (Gdisplay, Gscreenn);
    deffont = XLoadQueryFont (Gdisplay, "fixed");
    Gxfd = ConnectionNumber (Gdisplay);
    Gqwdelatom = XInternAtom (Gdisplay, "WM_DELETE_WINDOW", False);
    Gwmdelatom = XInternAtom (Gdisplay, "WM_DELETE_WINDOW", False);
    Gpopdownflag = FALSE;
    Glazyq.flag = 0;
    Gbufp = Marrayalloc ((long) BUFINCR * BUFSIZE);
    Gbufn = BUFINCR;
    Gppp = Marrayalloc ((long) PPINCR * PPSIZE);
    Gppn = PPINCR;
    Gfontp = Marrayalloc ((long) FONTSIZE);
    Gfontn = 1;
    Gfontp[0].name = strdup ("default");
    if (!Gdefaultfont)
        Gfontp[0].font = deffont;
    else if (Gdefaultfont[0] != '\000')
        Gfontp[0].font = XLoadQueryFont (Gdisplay, Gdefaultfont);
    else
        Gfontp[0].font = NULL;
    return 0;
}
Exemplo n.º 22
0
Arquivo: log.c Projeto: aosm/X11
void
create_log_popup(void)

{
    /*
     * Pop up for session log
     */

    static XtActionsRec actions[] = {
        {"DelLogWinAction", DelLogWinAction}
    };

    XtAppAddActions (appContext, actions, XtNumber (actions));

    logPopup = XtVaCreatePopupShell ("logPopup",
	topLevelShellWidgetClass, topLevel,
	XtNallowShellResize, True,
	NULL);
    
    logForm = XtVaCreateManagedWidget (
	"logForm", formWidgetClass, logPopup,
	NULL);

    logText = XtVaCreateManagedWidget (
	"logText", asciiTextWidgetClass, logForm,
        XtNfromHoriz, NULL,
        XtNfromVert, NULL,
	XtNeditType, XawtextAppend,
        XtNdisplayCaret, False,
	XtNscrollVertical, XawtextScrollAlways,
	XtNscrollHorizontal, XawtextScrollWhenNeeded,
	XtNresizable, True,
	XtNtop, XawChainTop,
	XtNbottom, XawChainBottom,
	NULL);

    logOkButton = XtVaCreateManagedWidget (
	"logOkButton", commandWidgetClass, logForm,
        XtNfromHoriz, NULL,
        XtNfromVert, logText,
	XtNtop, XawChainBottom,
	XtNbottom, XawChainBottom,
	XtNleft, XawChainLeft,
	XtNright, XawChainLeft,
        NULL);

    XtAddCallback (logOkButton, XtNcallback, logOkXtProc, 0);
}
Exemplo n.º 23
0
void
fe_InitRemoteServer (Display *dpy)
{
  static Boolean done = False;
  static XtActionsRec actions [] =
    { { "HandleMozillaCommand", fe_property_change_action } };

  if (done) return;
  done = True;
  fe_init_atoms (dpy);

  XtAppAddActions (fe_XtAppContext, actions, countof (actions));

  fe_prop_translations =
    XtParseTranslationTable ("<PropertyNotify>: HandleMozillaCommand()");
}
Exemplo n.º 24
0
void plugin_init(Widget w, void (*handle_exit)(int), void (*exec_cmd)(char *))
{
	Display *dpy;
	XtAppContext app_context = XtWidgetToApplicationContext(w);
	topLevel = w;
	handle_plugin_exit = handle_exit;
	sane_cursor = XCreateFontCursor(XtDisplay(w), XC_top_left_arrow);
	lr_cursor = XCreateFontCursor(XtDisplay(w), XC_bottom_right_corner);
	XtAppAddActions(app_context, actions, XtNumber(actions));

	/* experimental code to get attention from plugins */
	dpy = XtDisplay(w);
	plugin_protocol = XInternAtom(dpy, "_PLUGIN_PROTOCOL", False);
	plugin_execute = exec_cmd;
	XtAddEventHandler(w, NoEventMask, True,
			PluginDispatchEvent, NULL);
}
Exemplo n.º 25
0
static Object P_Context_Add_Action (Object c, Object s, Object p) {
    ACTION *ap;
    XtActionsRec a;

    Check_Context (c);
    Check_Procedure (p);
    ap = (ACTION *)XtMalloc (sizeof (ACTION));
    ap->num = Register_Function (p);
    ap->name = XtNewString (Get_Strsym (s));
    ap->con = CONTEXT(c)->context;
    ap->next = actions;
    actions = ap;
    a.string = ap->name;
    a.proc = (XtActionProc)Dummy_Action;
    XtAppAddActions (ap->con, &a, 1);
    return Void;
}
Exemplo n.º 26
0
void iupdrvDialogInitClass(Iclass* ic)
{
  /* Driver Dependent Class methods */
  ic->Map = motDialogMapMethod;
  ic->UnMap = motDialogUnMapMethod;
  ic->LayoutUpdate = motDialogLayoutUpdateMethod;
  ic->SetPosition = motDialogSetPositionMethod;
  ic->GetInnerNativeContainerHandle = motDialogGetInnerNativeContainerMethod;

  if (!iupmot_wm_deletewindow)
  {
    /* Set up a translation table that captures "Resize" events
      (also called ConfigureNotify or Configure events). */
    XtActionsRec rec = {"iupDialogConfigure", motDialogConfigureNotify};
    XtAppAddActions(iupmot_appcontext, &rec, 1);

    /* register atom to intercept the close button in the window frame */
    iupmot_wm_deletewindow = XmInternAtom(iupmot_display, "WM_DELETE_WINDOW", False);
  }

  /* Driver Dependent Attribute functions */

  /* Visual */
  iupClassRegisterAttribute(ic, "BGCOLOR", NULL, motDialogSetBgColorAttrib, IUPAF_SAMEASSYSTEM, "DLGBGCOLOR", IUPAF_DEFAULT);

  /* Overwrite Visual */
  iupClassRegisterAttribute(ic, "X", motDialogGetXAttrib, NULL, NULL, NULL, IUPAF_NO_DEFAULTVALUE|IUPAF_READONLY|IUPAF_NO_INHERIT);
  iupClassRegisterAttribute(ic, "Y", motDialogGetYAttrib, NULL, NULL, NULL, IUPAF_NO_DEFAULTVALUE|IUPAF_READONLY|IUPAF_NO_INHERIT);

  /* Base Container */
  iupClassRegisterAttribute(ic, "CLIENTSIZE", motDialogGetClientSizeAttrib, NULL, NULL, NULL, IUPAF_NO_DEFAULTVALUE|IUPAF_READONLY|IUPAF_NO_INHERIT);

  /* Special */
  iupClassRegisterAttribute(ic, "TITLE", motDialogGetTitleAttrib, motDialogSetTitleAttrib, NULL, NULL, IUPAF_NO_DEFAULTVALUE|IUPAF_NO_INHERIT);

  /* IupDialog only */
  iupClassRegisterAttribute(ic, "BACKGROUND", NULL, motDialogSetBackgroundAttrib, IUPAF_SAMEASSYSTEM, "DLGBGCOLOR", IUPAF_DEFAULT);
  iupClassRegisterAttribute(ic, "ICON", NULL, motDialogSetIconAttrib, NULL, NULL, IUPAF_NO_INHERIT);
  iupClassRegisterAttribute(ic, "FULLSCREEN", NULL, motDialogSetFullScreenAttrib, NULL, NULL, IUPAF_WRITEONLY|IUPAF_NO_INHERIT);
  iupClassRegisterAttribute(ic, "MINSIZE", NULL, motDialogSetMinSizeAttrib, IUPAF_SAMEASSYSTEM, "1x1", IUPAF_NO_INHERIT);
  iupClassRegisterAttribute(ic, "MAXSIZE", NULL, motDialogSetMaxSizeAttrib, IUPAF_SAMEASSYSTEM, "65535x65535", IUPAF_NO_INHERIT);
  iupClassRegisterAttribute(ic, "SAVEUNDER", NULL, NULL, "YES", NULL, IUPAF_NO_INHERIT);

  /* IupDialog X Only */
  iupClassRegisterAttribute(ic, "XWINDOW", iupmotGetXWindowAttrib, NULL, NULL, NULL, IUPAF_NO_INHERIT|IUPAF_NO_STRING);
}
Exemplo n.º 27
0
int XttMotif::init_hotkey( XtAppContext AppCtx, Widget Top)
{
  hotkeySTATUS    HotkeySts;

  XtAppAddActions( AppCtx, HotkeyActions, XtNumber(HotkeyActions));

  HotkeySts = hotkey_Initialize (Top, &HotkeyHandle);
  switch ( HotkeySts ) {
  case TkERROR : 
    puts ("Xtt: Failed to bind hotkey(s)");
    break;
  case TkNO_BINDINGS :
    puts ("OpWin: No hotkey resource found in resource db");
    break;
  case TkPARSE_ERROR :
    puts ("OpWin: Syntax error in hotkey bindings");
  }
  return 1;
}
Exemplo n.º 28
0
int ui_menu_init(XtAppContext app_context, Display *d, int s)
{
    static XtActionsRec actions[] = {
        { "PositionSubmenu", position_submenu_action },
        { "Popdownsubmenus", popdown_submenus_action },
        { "Unhighlight", menu_unhighlight_action },
        { "Moved", menu_moved_action },
        { "Select", menu_select_action },
        { "ButtonDown", menu_buttondown_action },
        { "ButtonUp", menu_buttonup_action },
        { "PrevItem", menu_prev_item_action },
        { "NextItem", menu_next_item_action },
        { "ExitSubmenu", menu_exit_submenu_action },
        { "EnterSubmenu", menu_enter_submenu_action },
        { "FakeButton", fake_button_action },
    };

    my_display = d;
    my_screen = s;

    checkmark_bitmap = XCreateBitmapFromData(my_display,
                                             DefaultRootWindow(my_display),
                                             (char *)checkmark_bits,
                                             checkmark_width,
                                             checkmark_height);

    right_arrow_bitmap = XCreateBitmapFromData(my_display,
                                               DefaultRootWindow(my_display),
                                               (char *)right_arrow_bits,
                                               right_arrow_width,
                                               right_arrow_height);

    XtAppAddActions(app_context, actions, XtNumber(actions));
    XawSimpleMenuAddGlobalActions(app_context);

    if (registered_hotkeys != NULL) {
        lib_free(registered_hotkeys);
        num_registered_hotkeys = num_allocated_hotkeys = 0;
    }

    return 0;
}
Exemplo n.º 29
0
/* if the window manager closes the window, tell the
   window manager to send a message to xt. xt will
   call the wm_quit callback.
*/
void grab_window_quit(Widget top)
{
    XtAppContext app = XtWidgetToApplicationContext(top);
    /* if the user closes the window
       the Window Manager will call our quit() function
    */
    /* xorg/app/oclock/oclock.c */
    static XtActionsRec actions[] = {
        {"quit",	wm_quit}
    };
    XtAppAddActions
	(app, actions, XtNumber(actions));
    XtOverrideTranslations
	(TopLevel, XtParseTranslationTable ("<Message>WM_PROTOCOLS: quit()"));
    Atom wm_delete_window;
    wm_delete_window = XInternAtom(XtDisplay(top), "WM_DELETE_WINDOW",
				   False);
    (void) XSetWMProtocols (XtDisplay(top), XtWindow(top),
                            &wm_delete_window, 1);
}
Exemplo n.º 30
0
EIF_POINTER xt_init ()
{
	/* Initialize Xt toolkit and application context
	 * add action c_callback_on_trans to the list of
	 * application actions, it will be called by any
	 * new translations or accelerators.
	 * Prepare the Xt toolkit and create a global
	 * application context.
	 */
	XtAppContext gAppContext;

	static XtActionsRec	actionTable [] = {
			{c_trans_routine, handle_translation},
			}; 

	XtToolkitInitialize ();
	gAppContext = XtCreateApplicationContext ();
	XtAppAddActions (gAppContext, actionTable, XtNumber (actionTable));
	return (EIF_POINTER) gAppContext;
}