示例#1
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;
}
示例#2
0
void
ListView::create_ui_objects()
{
  /* -------- Create ui components. -------- */
  f_shell = new WTopLevelShell (toplevel(), WPopup, f_name);
  window_system().register_shell (f_shell);
  WXmForm form (*f_shell, "form");

  /* -------- allow child to be creative -------- */
  child_create_ui_pre(form);


  WXmPushButton close (form, "close", WAutoManage);
  WXmPushButton help (form, "help", WAutoManage);

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

  // 7/30/93 rtp - bear with this hack, it's a little bogus
  char *help_name = new char[strlen(f_name) + strlen("_help") + 1];
  sprintf(help_name, "%s%s", f_name, "_help");
  // What i've done is appended '_help' to the widget name and added
  // a help callback to the help button that will reference this name
  help_agent().add_activate_help (help, help_name);

  f_activate = WXmPushButton (form, "activate", WAutoManage);
  XtVaSetValues(f_activate, XmNlabelString,
	(XmString)XmStringLocalized(CATGETS(Set_AgentLabel, 165, "Display")), NULL);
  //  WXmLabelGadget label (form, "label", WAutoManage);
  WXmSeparator separator (form, "separator", WAutoManage);
  // NOTE: Fix WWL to have a scrolled list object!
  Widget scrolled_list = XmCreateScrolledList (form, "list", NULL, 0);
  f_list = new WXmList (scrolled_list);
  f_list->Manage();

  XmFontList defaultList;
  {
    XmFontList font;
    XtVaGetValues(scrolled_list, XmNfontList, &font, NULL);
    defaultList = XmFontListCopy(font);
  }
  if (window_system().dtinfo_space_font())
    defaultList = XmFontListAppendEntry(defaultList,
                                        window_system().dtinfo_space_font());
  XtVaSetValues(scrolled_list, XmNfontList, defaultList, NULL);

  /* -------- let child add anything else -------- */
  child_create_ui_post(form);

  /* -------- Callbacks -------- */
  f_wm_delete_callback =
    new WCallback (*f_shell, window_system().WM_DELETE_WINDOW(),
		   this, (WWL_FUN) &ListView::close_window);
  close.SetActivateCallback (this, (WWL_FUN) &ListView::close_window);
  f_list->SetSingleSelectionCallback (this, (WWL_FUN) &ListView::select);
  f_list->SetBrowseSelectionCallback (this, (WWL_FUN) &ListView::select);
  f_list->SetDefaultActionCallback (this, (WWL_FUN) &ListView::activate);
  f_activate.SetActivateCallback (this, (WWL_FUN) &ListView::activate);

  /* -------- Finalize -------- */
  form.DefaultButton (f_activate);
  form.ShadowThickness (0);  // get rid of border turds (motif bug)
  form.Manage();
}
示例#3
0
void
HelpAgent::add_activate_help (WXmPushButton &pb, const String card_id)
{
  pb.SetActivateCallback (this, (WWL_FUN) &HelpAgent::help_cb,
			  (void *) card_id);
}