Esempio n. 1
0
static cb_ret_t
tree_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
    WTree *tree = (WTree *) w;
    WDialog *h = w->owner;
    WButtonBar *b;

    switch (msg)
    {
    case MSG_DRAW:
        tree_frame (h, tree);
        show_tree (tree);
        if (widget_get_state (w, WST_FOCUSED))
        {
            b = find_buttonbar (h);
            widget_redraw (WIDGET (b));
        }
        return MSG_HANDLED;

    case MSG_FOCUS:
        b = find_buttonbar (h);
        buttonbar_set_label (b, 1, Q_ ("ButtonBar|Help"), tree_map, w);
        buttonbar_set_label (b, 2, Q_ ("ButtonBar|Rescan"), tree_map, w);
        buttonbar_set_label (b, 3, Q_ ("ButtonBar|Forget"), tree_map, w);
        buttonbar_set_label (b, 4, tree_navigation_flag ? Q_ ("ButtonBar|Static")
                             : Q_ ("ButtonBar|Dynamc"), tree_map, w);
        buttonbar_set_label (b, 5, Q_ ("ButtonBar|Copy"), tree_map, w);
        buttonbar_set_label (b, 6, Q_ ("ButtonBar|RenMov"), tree_map, w);
#if 0
        /* FIXME: mkdir is currently defunct */
        buttonbar_set_label (b, 7, Q_ ("ButtonBar|Mkdir"), tree_map, w);
#else
        buttonbar_clear_label (b, 7, w);
#endif
        buttonbar_set_label (b, 8, Q_ ("ButtonBar|Rmdir"), tree_map, w);

        return MSG_HANDLED;

    case MSG_UNFOCUS:
        tree->searching = 0;
        return MSG_HANDLED;

    case MSG_KEY:
        return tree_key (tree, parm);

    case MSG_ACTION:
        /* command from buttonbar */
        return tree_execute_cmd (tree, parm);

    case MSG_DESTROY:
        tree_destroy (tree);
        return MSG_HANDLED;

    default:
        return widget_default_callback (w, sender, msg, parm, data);
    }
}
Esempio n. 2
0
File: tree.c Progetto: ebichu/dd-wrt
static cb_ret_t
tree_callback (Widget *w, widget_msg_t msg, int parm)
{
    WTree *tree = (WTree *) w;
    Dlg_head *h = tree->widget.parent;

    switch (msg) {
    case WIDGET_DRAW:
	tree_frame (h, tree);
	show_tree (tree);
	return MSG_HANDLED;

    case WIDGET_KEY:
	return tree_key (tree, parm);

    case WIDGET_FOCUS:
	tree->active = 1;
	buttonbar_set_label (h, 1, _("Help"), tree_help_cmd);
	buttonbar_set_label_data (h, 2, _("Rescan"),
	    tree_rescan_command, tree);
	buttonbar_set_label_data (h, 3, _("Forget"), tree_forget_cmd, tree);
	buttonbar_set_label_data (h, 5, _("Copy"), tree_copy_cmd, tree);
	buttonbar_set_label_data (h, 6, _("RenMov"), tree_move_cmd, tree);
#if 0
	/* FIXME: mkdir is currently defunct */
	buttonbar_set_label_data (h, 7, _("Mkdir"), tree_mkdir_cmd, tree);
#else
	buttonbar_clear_label (h, 7);
#endif
	buttonbar_set_label_data (h, 8, _("Rmdir"), tree_rmdir_command, tree);
	set_navig_label (tree);
	buttonbar_redraw (h);


	/* FIXME: Should find a better way of only displaying the
	   currently selected item */
	show_tree (tree);
	return MSG_HANDLED;

	/* FIXME: Should find a better way of changing the color of the
	   selected item */

    case WIDGET_UNFOCUS:
	tree->active = 0;
	show_tree (tree);
	return MSG_HANDLED;

    case WIDGET_DESTROY:
	tree_destroy (tree);
	return MSG_HANDLED;

    default:
	return default_proc (msg, parm);
    }
}
Esempio n. 3
0
void
MapAgent::create_ui()
{
  MapButton::f_kids_size = 8;
  MapButton::f_kids = (Widget *)
                      malloc (sizeof (Widget) * MapButton::f_kids_size);
  
  f_shell = new WTopLevelShell (toplevel(), WPopup, "map");
  window_system().register_shell (f_shell);

  XtVaSetValues(*f_shell, XmNtitle,
	        CATGETS(Set_MapAgent, 1, "Dtinfo: Local Map"), NULL);
  WindowGeometry wg = pref_mgr().get_geometry (PrefMgr::MapGeometry);
  f_shell->Set(WArgList(XmNwidth, wg.width,
			XmNheight, wg.height,
			NULL));

  // rtp - added new code 8/27/92
  WXmForm rootform (*f_shell, "rootform");

  WXmForm bottomform (rootform, "bottomform");
  WXmPushButton close (bottomform, "close", WAutoManage);
  WXmPushButton help (bottomform, "help", WAutoManage);
  help_agent().add_activate_help (help, (char*)"map_help");

  XtVaSetValues(close, XmNlabelString,
	(XmString)XmStringLocalized(CATGETS(Set_AgentLabel, 12, "Close")), NULL);
  XtVaSetValues(help, XmNlabelString,
	(XmString)XmStringLocalized(CATGETS(Set_AgentLabel, 48, "Help")), NULL);

  WXmPanedWindow pane (rootform, "pane");
  WXmForm topform (pane, "topform");
  XtVaSetValues(topform, XmNheight, 75, NULL);
  XtVaSetValues(pane, XmNpaneMinimum, 75, XmNpositionIndex, 1, NULL);

  WXmFrame panner_frame (topform, "pframe", WAutoManage);
  f_panner = new WXawPanner (panner_frame, "panner", WAutoManage);
  WXmFrame tree_frame (pane, "tframe", WAutoManage);
  f_porthole = new WXawPorthole (tree_frame, "porthole");

  f_lock = new WXmToggleButton (topform, "lock", WAutoManage);
  XtVaSetValues(*f_lock, XmNlabelString,
     (XmString)XmStringLocalized(CATGETS(Set_AgentLabel, 196, "Auto Update")),
                         XmNindicatorSize, 15, NULL);
  bool lock_status = pref_mgr().get_boolean (PrefMgr::MapAutoUpdate);
  f_lock->Set(lock_status);
  f_locked = lock_status ;
  // NOTE: Should have a way to remove displayer so that receive function
  // isn't called every time a node is displayed.  14:08 12-Oct-93 DJB 
  UAS_Common::request ((UAS_Receiver<UAS_DocumentRetrievedMsg> *) this);

  f_lock->SetValueChangedCallback(this, (WWL_FUN) &MapAgent::lock_toggle);
  f_porthole->SetReportCallback (this, (WWL_FUN) &MapAgent::porthole_resize);
  f_panner->SetReportCallback (this, (WWL_FUN) &MapAgent::panner_movement);

  bottomform.Manage();
  
  Dimension height;
  f_lock->Get (WArgList (XmNheight, (XtArgVal)&height, NULL));
  topform.Set(WArgList(XmNpaneMinimum, height, NULL));

  topform.Manage();
  f_porthole->Manage();
  pane.Manage();

  /* -------- Callbacks -------- */
  f_wm_delete_callback =
    new WCallback (*f_shell, window_system().WM_DELETE_WINDOW(),
                   this, (WWL_FUN) &MapAgent::close_window);
  close.SetActivateCallback (this, (WWL_FUN) &MapAgent::close_window);

  rootform.Manage();

  //  f_shell->Realize();

  f_tree = NULL;
}
Esempio n. 4
0
File: tree.c Progetto: ryanlee/mc
static cb_ret_t
tree_callback (Widget * w, widget_msg_t msg, int parm)
{
    WTree *tree = (WTree *) w;
    Dlg_head *h = tree->widget.owner;
    WButtonBar *b = find_buttonbar (h);

    switch (msg)
    {
    case WIDGET_DRAW:
        tree_frame (h, tree);
        show_tree (tree);
        return MSG_HANDLED;

    case WIDGET_FOCUS:
        tree->active = 1;
        buttonbar_set_label (b, 1, Q_ ("ButtonBar|Help"), tree_map, (Widget *) tree);
        buttonbar_set_label (b, 2, Q_ ("ButtonBar|Rescan"), tree_map, (Widget *) tree);
        buttonbar_set_label (b, 3, Q_ ("ButtonBar|Forget"), tree_map, (Widget *) tree);
        buttonbar_set_label (b, 4, tree_navigation_flag ? Q_ ("ButtonBar|Static")
                             : Q_ ("ButtonBar|Dynamc"), tree_map, (Widget *) tree);
        buttonbar_set_label (b, 5, Q_ ("ButtonBar|Copy"), tree_map, (Widget *) tree);
        buttonbar_set_label (b, 6, Q_ ("ButtonBar|RenMov"), tree_map, (Widget *) tree);
#if 0
        /* FIXME: mkdir is currently defunct */
        buttonbar_set_label (b, 7, Q_ ("ButtonBar|Mkdir"), tree_map, (Widget *) tree);
#else
        buttonbar_clear_label (b, 7, (Widget *) tree);
#endif
        buttonbar_set_label (b, 8, Q_ ("ButtonBar|Rmdir"), tree_map, (Widget *) tree);
        buttonbar_redraw (b);

        /* FIXME: Should find a better way of only displaying the
           currently selected item */
        show_tree (tree);
        return MSG_HANDLED;

        /* FIXME: Should find a better way of changing the color of the
           selected item */

    case WIDGET_UNFOCUS:
        tree->active = 0;
        tree->searching = 0;
        show_tree (tree);
        return MSG_HANDLED;

    case WIDGET_KEY:
        return tree_key (tree, parm);

    case WIDGET_COMMAND:
        /* command from buttonbar */
        return tree_execute_cmd (tree, parm);

    case WIDGET_DESTROY:
        tree_destroy (tree);
        return MSG_HANDLED;

    default:
        return default_proc (msg, parm);
    }
}