1 /* 2 * Grace - GRaphing, Advanced Computation and Exploration of data 3 * 4 * Home page: http://plasma-gate.weizmann.ac.il/Grace/ 5 * 6 * Copyright (c) 1991-1995 Paul J Turner, Portland, OR 7 * Copyright (c) 1996-2000 Grace Development Team 8 * 9 * Maintained by Evgeny Stambulchik 10 * 11 * 12 * All Rights Reserved 13 * 14 * This program is free software; you can redistribute it and/or modify 15 * it under the terms of the GNU General Public License as published by 16 * the Free Software Foundation; either version 2 of the License, or 17 * (at your option) any later version. 18 * 19 * This program is distributed in the hope that it will be useful, 20 * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 * GNU General Public License for more details. 23 * 24 * You should have received a copy of the GNU General Public License 25 * along with this program; if not, write to the Free Software 26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 27 */ 28 29 /* 30 * for Motif specific items 31 */ 32 33 #ifndef __MOTIFINC_H_ 34 #define __MOTIFINC_H_ 35 36 /* for Widget */ 37 #include <X11/Intrinsic.h> 38 /* for XmString; TODO: remove! */ 39 #include <Xm/Xm.h> 40 41 /* 42 * Accept/Apply/Close for aac_cb callbacks 43 */ 44 #define AAC_ACCEPT 0 45 #define AAC_APPLY 1 46 #define AAC_CLOSE 2 47 48 #define LIST_TYPE_SINGLE 0 49 #define LIST_TYPE_MULTIPLE 1 50 51 #define SPIN_TYPE_INT 0 52 #define SPIN_TYPE_FLOAT 1 53 54 #define ALIGN_BEGINNING 0 55 #define ALIGN_CENTER 1 56 #define ALIGN_END 2 57 58 #define CreateMenuSeparator(w) CreateSeparator(w) 59 60 extern Widget app_shell; /* defined in xmgrace.c */ 61 62 /* set selection gadget */ 63 typedef struct _SetChoiceItem { 64 int type; 65 int display; 66 int gno; 67 int spolicy; 68 int indx; 69 Widget list; 70 } SetChoiceItem; 71 72 typedef struct { 73 int value; 74 char *label; 75 } OptionItem; 76 77 typedef struct { 78 int value; 79 unsigned char *bitmap; 80 } BitmapOptionItem; 81 82 typedef struct { 83 int value; 84 Widget widget; 85 } OptionWidgetItem; 86 87 typedef struct { 88 int nchoices; 89 int ncols; /* preferred number of columns */ 90 Widget menu; 91 Widget pulldown; 92 OptionWidgetItem *options; 93 } OptionStructure; 94 95 typedef struct { 96 int nchoices; 97 int *values; 98 void *anydata; 99 Widget rc; 100 Widget list; 101 } ListStructure; 102 103 typedef struct { 104 int type; 105 double min; 106 double max; 107 double incr; 108 Widget rc; 109 Widget text; 110 Widget arrow_up; 111 Widget arrow_down; 112 } SpinStructure; 113 114 typedef struct { 115 Widget label; 116 Widget form; 117 Widget text; 118 } TextStructure; 119 120 typedef struct { 121 Widget popup; 122 Widget label_item; 123 Widget shownd_item; 124 Widget showh_item; 125 Widget hide_item; 126 Widget show_item; 127 Widget bringf_item; 128 Widget sendb_item; 129 Widget duplicate_item; 130 Widget kill_item; 131 Widget killd_item; 132 Widget copy12_item; 133 Widget copy21_item; 134 Widget move12_item; 135 Widget move21_item; 136 Widget swap_item; 137 Widget edit_item; 138 } SetPopupMenu; 139 140 typedef enum { 141 SetMenuHideCB, 142 SetMenuShowCB, 143 SetMenuBringfCB, 144 SetMenuSendbCB, 145 SetMenuDuplicateCB, 146 SetMenuKillCB, 147 SetMenuKillDCB, 148 SetMenuCopy12CB, 149 SetMenuCopy21CB, 150 SetMenuMove12CB, 151 SetMenuMove21CB, 152 SetMenuSwapCB, 153 SetMenuNewFCB, 154 SetMenuNewSCB, 155 SetMenuNewECB, 156 SetMenuNewBCB, 157 SetMenuEditSCB, 158 SetMenuEditECB, 159 SetMenuPackCB 160 } SetMenuCBtype; 161 162 typedef struct { 163 int standalone; 164 int gno; 165 int view_comments; 166 int show_hidden; 167 int show_nodata; 168 SetPopupMenu *menu; 169 } SetChoiceData; 170 171 typedef struct { 172 Widget frame; 173 ListStructure *graph_sel; 174 ListStructure *set_sel; 175 } GraphSetStructure; 176 177 typedef struct { 178 Widget form; 179 GraphSetStructure *src; 180 GraphSetStructure *dest; 181 } SrcDestStructure; 182 183 typedef struct { 184 Widget dialog; 185 Widget FSB; 186 Widget rc; 187 } FSBStructure; 188 189 typedef struct { 190 Widget frame; 191 OptionStructure *r_sel; 192 Widget negate; 193 } RestrictionStructure; 194 195 typedef struct { 196 Widget form; 197 SrcDestStructure *srcdest; 198 } TransformStructure; 199 200 201 /* OptionChoice CB procedure */ 202 typedef void (*OC_CBProc)( 203 int value, /* value */ 204 void * /* data the application registered */ 205 ); 206 207 /* ToggleButton CB procedure */ 208 typedef void (*TB_CBProc)( 209 int onoff, /* True/False */ 210 void * /* data the application registered */ 211 ); 212 213 /* FileSelectionBox CB procedure */ 214 typedef int (*FSB_CBProc)( 215 char *, /* filename */ 216 void * /* data the application registered */ 217 ); 218 219 /* Button CB procedure */ 220 typedef void (*Button_CBProc)( 221 void * /* data the application registered */ 222 ); 223 224 /* List CB procedure */ 225 typedef void (*List_CBProc)( 226 int n, /* # of items selected */ 227 int *values, /* list of values of the selected items */ 228 void * /* data the application registered */ 229 ); 230 231 /* Text input CB procedure */ 232 typedef void (*Text_CBProc)( 233 void * /* data the application registered */ 234 ); 235 236 /* AAC Dialog CB procedure */ 237 typedef int (*AACDialog_CBProc)( 238 void * /* data the application registered */ 239 ); 240 241 void ManageChild(Widget w); 242 void UnmanageChild(Widget w); 243 void SetSensitive(Widget w, int onoff); 244 245 Widget GetParent(Widget w); 246 247 void RegisterEditRes(Widget shell); 248 249 void SetDimensions(Widget w, unsigned int width, unsigned int height); 250 void GetDimensions(Widget w, unsigned int *width, unsigned int *height); 251 252 Widget CreateDialogForm(Widget parent, char *s); 253 void SetDialogFormResizable(Widget form, int onoff); 254 void AddDialogFormChild(Widget form, Widget child); 255 Widget CreateFrame(Widget parent, char *s); 256 257 Widget CreateSeparator(Widget parent); 258 259 Widget CreateVContainer(Widget parent); 260 Widget CreateHContainer(Widget parent); 261 262 Widget CreateGrid(Widget parent, int ncols, int nrows); 263 void PlaceGridChild(Widget grid, Widget w, int col, int row); 264 265 Widget CreateTab(Widget parent); 266 Widget CreateTabPage(Widget parent, char *s); 267 void SelectTabPage(Widget tab, Widget w); 268 269 Widget CreateScale(Widget parent, char *s, int min, int max, int delta); 270 void SetScaleValue(Widget w, int value); 271 int GetScaleValue(Widget w); 272 void SetScaleWidth(Widget w, int width); 273 274 Widget CreateCharSizeChoice(Widget parent, char *s); 275 double GetCharSizeChoice(Widget w); 276 void SetCharSizeChoice(Widget w, double size); 277 278 Widget CreateAngleChoice(Widget parent, char *s); 279 int GetAngleChoice(Widget w); 280 void SetAngleChoice(Widget w, int angle); 281 282 Widget CreateToggleButton(Widget parent, char *s); 283 int GetToggleButtonState(Widget w); 284 void SetToggleButtonState(Widget w, int value); 285 void AddToggleButtonCB(Widget w, TB_CBProc cbproc, void *anydata); 286 287 Widget CreateButton(Widget parent, char *label); 288 Widget CreateBitmapButton(Widget parent, 289 int width, int height, const unsigned char *bits); 290 void AddButtonCB(Widget button, Button_CBProc cbproc, void *data); 291 292 void CreateAACDialog(Widget form, 293 Widget container, AACDialog_CBProc cbproc, void *data); 294 295 Widget CreateAACButtons(Widget parent, Widget form, Button_CBProc aac_cb); 296 297 OptionStructure *CreateOptionChoice(Widget parent, char *labelstr, int ncols, 298 int nchoices, OptionItem *items); 299 OptionStructure *CreateBitmapOptionChoice(Widget parent, char *labelstr, int ncols, 300 int nchoices, int width, int height, BitmapOptionItem *items); 301 void SetOptionChoice(OptionStructure *opt, int value); 302 int GetOptionChoice(OptionStructure *opt); 303 void UpdateOptionChoice(OptionStructure *optp, int nchoices, OptionItem *items); 304 305 void AddOptionChoiceCB(OptionStructure *opt, TB_CBProc cbproc, void *anydata); 306 307 ListStructure *CreateListChoice(Widget parent, char *labelstr, int type, 308 int nvisible, int nchoices, OptionItem *items); 309 int SelectListChoice(ListStructure *listp, int choice); 310 void SelectListChoices(ListStructure *listp, int nchoices, int *choices); 311 void UpdateListChoice(ListStructure *listp, int nchoices, OptionItem *items); 312 int GetListChoices(ListStructure *listp, int **values); 313 int GetSingleListChoice(ListStructure *listp, int *value); 314 void AddListChoiceCB(ListStructure *listp, List_CBProc cbproc, void *anydata); 315 316 void list_selectall_action(Widget w, XEvent *e, String *par, Cardinal *npar); 317 void list_unselectall_action(Widget w, XEvent *e, String *par, Cardinal *npar); 318 void list_invertselection_action(Widget w, XEvent *e, String *par, 319 Cardinal *npar); 320 321 SpinStructure *CreateSpinChoice(Widget parent, char *s, int len, 322 int type, double min, double max, double incr); 323 double GetSpinChoice(SpinStructure *spinp); 324 void SetSpinChoice(SpinStructure *spinp, double value); 325 326 TextStructure *CreateTextInput(Widget parent, char *s); 327 TextStructure *CreateCSText(Widget parent, char *s); 328 char *GetTextString(TextStructure *cst); 329 void SetTextString(TextStructure *cst, char *s); 330 void AddTextInputCB(TextStructure *cst, Text_CBProc cbproc, void *data); 331 int GetTextCursorPos(TextStructure *cst); 332 void TextInsert(TextStructure *cst, int pos, char *s); 333 void cstext_edit_action(Widget w, XEvent *e, String *par, Cardinal *npar); 334 335 FSBStructure *CreateFileSelectionBox(Widget parent, char *s); 336 void AddFileSelectionBoxCB(FSBStructure *fsbp, FSB_CBProc cbproc, void *anydata); 337 void SetFileSelectionBoxPattern(FSBStructure *fsb, char *pattern); 338 339 Widget CreateLabel(Widget parent, char *s); 340 341 OptionStructure *CreateFontChoice(Widget parent, char *s); 342 OptionStructure *CreatePatternChoice(Widget parent, char *s); 343 OptionStructure *CreateLineStyleChoice(Widget parent, char *s); 344 OptionStructure *CreateSetTypeChoice(Widget parent, char *s); 345 OptionStructure *CreateColorChoice(Widget parent, char *s); 346 OptionStructure *CreateFormatChoice(Widget parent, char *s); 347 OptionStructure *CreateASChoice(Widget parent, char *s); 348 OptionStructure *CreateJustChoice(Widget parent, char *s); 349 350 RestrictionStructure *CreateRestrictionChoice(Widget parent, char *s); 351 352 ListStructure *CreateGraphChoice(Widget parent, char *labelstr, int type); 353 354 ListStructure *CreateSetChoice(Widget parent, char *labelstr, 355 int type, int standalone); 356 void UpdateSetChoice(ListStructure *listp, int gno); 357 358 GraphSetStructure *CreateGraphSetSelector(Widget parent, char *s, int sel_type); 359 SrcDestStructure *CreateSrcDestSelector(Widget parent, int sel_type); 360 361 void switch_focus_proc(void *data); 362 void hide_graph_proc(void *data); 363 void show_graph_proc(void *data); 364 void duplicate_graph_proc(void *data); 365 void kill_graph_proc(void *data); 366 void copy12_graph_proc(void *data); 367 void copy21_graph_proc(void *data); 368 void move12_graph_proc(void *data); 369 void move21_graph_proc(void *data); 370 void swap_graph_proc(void *data); 371 void create_new_graph_proc(void *data); 372 373 void hide_set_proc(void *data); 374 void show_set_proc(void *data); 375 void duplicate_set_proc(void *data); 376 void kill_set_proc(void *data); 377 void killd_set_proc(void *data); 378 void copy12_set_proc(void *data); 379 void copy21_set_proc(void *data); 380 void move12_set_proc(void *data); 381 void move21_set_proc(void *data); 382 void swap_set_proc(void *data); 383 void newF_set_proc(void *data); 384 void newS_set_proc(void *data); 385 void newE_set_proc(void *data); 386 void newB_set_proc(void *data); 387 void editS_set_proc(void *data); 388 void editE_set_proc(void *data); 389 390 SpinStructure *CreateLineWidthChoice(Widget parent, char *s); 391 392 393 SetChoiceItem CreateSetSelector(Widget parent, char *label, int type, int ff, int gtype, int stype); 394 int GetSelectedSet(SetChoiceItem l); 395 int GetSelectedSets(SetChoiceItem l, int **sets); 396 void update_set_list(int gno, SetChoiceItem l); 397 int save_set_list(SetChoiceItem l); 398 void update_save_set_list( SetChoiceItem l, int newgr ); 399 400 int SetSelectedSet(int gno, int setno, SetChoiceItem l); 401 402 403 Widget *CreatePanelChoice(Widget parent, char *labstr, int nchoices, ...); 404 void SetChoice(Widget * w, int value); 405 int GetChoice(Widget * w); 406 407 Widget CreateTextItem2(Widget parent, int len, char *s); 408 Widget CreateTextItem4(Widget parent, int len, char *s); 409 Widget CreateScrollTextItem2(Widget parent, int hgt, char *s); 410 411 Widget CreateCommandButtons(Widget parent, int n, Widget * buts, char **l); 412 Widget CreateCommandButtonsNoDefault(Widget parent, int n, Widget * buts, char **l); 413 414 Widget *CreatePrecisionChoice(Widget parent, char *s); 415 416 TransformStructure *CreateTransformDialogForm(Widget parent, 417 char *s, int sel_type); 418 int GetTransformDialogSettings(TransformStructure *tdialog, int exclusive, 419 int *gsrc, int *gdest, 420 int *nssrc, int **svaluessrc, int *nsdest, int **svaluesdest); 421 422 void SetLabel(Widget w, char *s); 423 void AlignLabel(Widget w, int alignment); 424 void SetFixedFont(Widget w); 425 426 Widget CreateMenuBar(Widget parent); 427 Widget CreateMenu(Widget parent, char *label, char mnemonic, int help); 428 Widget CreateMenuButton(Widget parent, char *label, char mnemonic, 429 Button_CBProc cb, void *data); 430 Widget CreateMenuCloseButton(Widget parent, Widget shell); 431 Widget CreateMenuHelpButton(Widget parent, char *label, char mnemonic, 432 Widget form, char *ha); 433 Widget CreateMenuToggle(Widget parent, char *label, char mnemonic, 434 TB_CBProc cb, void *data); 435 Widget CreateMenuLabel(Widget parent, char *name); 436 437 void AddHelpCB(Widget w, char *ha); 438 void ContextHelpCB(void *data); 439 440 char *GetStringSimple(XmString xms); 441 442 char *xv_getstr(Widget w); 443 Boolean xv_evalexpr(Widget w, double *); 444 Boolean xv_evalexpri(Widget w, int *); 445 void xv_setstr(Widget w, char *s); 446 void handle_close(Widget w); 447 void RaiseWindow(Widget w); 448 void destroy_dialog(Widget w, XtPointer client_data, XtPointer call_data); 449 void destroy_dialog_cb(void *data); 450 void savewidget(Widget w); 451 void deletewidget(Widget w); 452 453 #endif /* __MOTIFINC_H_ */ 454