Moved CharOptionChoice
[grace.git] / src / motifinc.h
blob1fb77fa0549fe203710e5c15df118f9655fe8d7e
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-2006 Grace Development Team
8 *
9 * Maintained by Evgeny Stambulchik
12 * All Rights Reserved
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.
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.
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.
30 * for Motif specific items
33 #ifndef __MOTIFINC_H_
34 #define __MOTIFINC_H_
36 #include "gui.h"
37 #include "graceapp.h"
39 /*
40 * Accept/Apply/Close for aac_cb callbacks
42 #define AAC_ACCEPT 0
43 #define AAC_APPLY 1
44 #define AAC_CLOSE 2
46 #define LIST_TYPE_SINGLE 0
47 #define LIST_TYPE_MULTIPLE 1
49 #define SPIN_TYPE_INT 0
50 #define SPIN_TYPE_FLOAT 1
52 #define ALIGN_BEGINNING 0
53 #define ALIGN_CENTER 1
54 #define ALIGN_END 2
56 #define TABLE_CELL_NONE 0
57 #define TABLE_CELL_STRING 1
58 #define TABLE_CELL_PIXMAP 2
60 #define DROP_ACTION_MOVE 0
61 #define DROP_ACTION_COPY 1
63 extern Widget app_shell; /* defined in xmgapp.c */
65 typedef struct {
66 int nchoices;
67 int *values;
68 void *anydata;
69 Widget rc;
70 Widget list;
71 } ListStructure;
73 /* Storage labeling procedure */
74 typedef char * (*Storage_LabelingProc)(
75 Quark *q,
76 unsigned int *rid
79 typedef struct _StorageStructure StorageStructure;
81 typedef void (*SS_PopupCBProc)(
82 StorageStructure *ss,
83 int nselected /* # of selected list items */
86 struct _StorageStructure {
87 int nchoices;
88 Quark **values;
89 void *anydata;
91 Quark *q;
92 Storage_LabelingProc labeling_proc;
94 StorageStructure *governor;
96 Widget rc;
97 Widget list;
98 Widget popup;
99 Widget selpopup;
101 Widget popup_hide_bt;
102 Widget popup_show_bt;
104 Widget popup_delete_bt;
105 Widget popup_duplicate_bt;
107 Widget popup_bring_to_front_bt;
108 Widget popup_send_to_back_bt;
109 Widget popup_move_up_bt;
110 Widget popup_move_down_bt;
112 Widget popup_properties_bt;
114 Widget popup_select_all_bt;
115 Widget popup_unselect_all_bt;
116 Widget popup_invert_selection_bt;
118 SS_PopupCBProc popup_cb;
119 void *data;
122 typedef struct {
123 Widget popup;
124 Widget label_item;
125 Widget shownd_item;
126 Widget showh_item;
127 Widget hide_item;
128 Widget show_item;
129 Widget bringf_item;
130 Widget sendb_item;
131 Widget duplicate_item;
132 Widget kill_item;
133 Widget killd_item;
134 Widget copy12_item;
135 Widget copy21_item;
136 Widget move12_item;
137 Widget move21_item;
138 Widget swap_item;
139 Widget edit_item;
140 } SetPopupMenu;
142 typedef enum {
143 SetMenuHideCB,
144 SetMenuShowCB,
145 SetMenuBringfCB,
146 SetMenuSendbCB,
147 SetMenuDuplicateCB,
148 SetMenuKillCB,
149 SetMenuKillDCB,
150 SetMenuCopy12CB,
151 SetMenuCopy21CB,
152 SetMenuMove12CB,
153 SetMenuMove21CB,
154 SetMenuSwapCB,
155 SetMenuNewFCB,
156 SetMenuNewSCB,
157 SetMenuNewECB,
158 SetMenuNewBCB,
159 SetMenuEditSCB,
160 SetMenuEditECB,
161 SetMenuPackCB
162 } SetMenuCBtype;
164 typedef struct {
165 Widget frame;
166 StorageStructure *graph_sel;
167 StorageStructure *set_sel;
168 } GraphSetStructure;
170 typedef struct {
171 Widget frame;
172 StorageStructure *ssd_sel;
173 StorageStructure *set_sel;
174 } SSDSetStructure;
176 typedef struct {
177 Widget frame;
178 StorageStructure *ssd_sel;
179 ListStructure *col_sel;
180 } SSDColStructure;
182 typedef struct {
183 Widget form;
184 SSDSetStructure *src;
185 SSDSetStructure *dest;
186 } SrcDestStructure;
188 typedef struct {
189 Widget frame;
190 OptionStructure *r_sel;
191 Widget negate;
192 } RestrictionStructure;
194 typedef struct _TransformStructure TransformStructure;
196 typedef void* (*TDBuild_CBProc)(
197 TransformStructure *tdialog
200 typedef void* (*TDGet_CBProc)(
201 void *gui /* specific GUI structure */
204 typedef void (*TDFree_CBProc)(
205 void *tddata /* data */
208 typedef int (*TDRun_CBProc)(
209 Quark *psrc,
210 Quark *pdest,
211 void *tddata /* data */
214 struct _TransformStructure {
215 Widget form;
216 Widget menubar;
217 Widget frame;
218 SrcDestStructure *srcdest;
219 int exclusive;
220 TDBuild_CBProc build_cb;
221 TDGet_CBProc get_cb;
222 TDFree_CBProc free_cb;
223 TDRun_CBProc run_cb;
224 void *gui;
227 typedef struct {
228 TDBuild_CBProc build_cb;
229 TDGet_CBProc get_cb;
230 TDFree_CBProc free_cb;
231 TDRun_CBProc run_cb;
232 } TD_CBProcs;
234 /* List CB procedure */
235 typedef void (*List_CBProc)(
236 ListStructure *listp,
237 int n, /* # of items selected */
238 int *values, /* list of values of the selected items */
239 void * /* data the application registered */
242 /* Storage CB procedure */
243 typedef void (*Storage_CBProc)(
244 StorageStructure *ss,
245 int n, /* # of items selected */
246 Quark **values, /* list of values of the selected items */
247 void *data /* data the application registered */
250 /* Storage double click CB procedure */
251 typedef void (*Storage_DCCBProc)(
252 StorageStructure *ss,
253 Quark *value, /* list of values of the selected items */
254 void *data /* data the application registered */
257 /* AAC Dialog CB procedure */
258 typedef int (*AACDialog_CBProc)(
259 void * /* data the application registered */
262 /* PenChoice input CB procedure */
263 typedef void (*Pen_CBProc )(
264 Widget,
265 const Pen*, /* pen value */
266 void * /* data the application registered */
269 typedef struct _FormatStructure FormatStructure;
271 /* FormatChoice input CB procedure */
272 typedef void (*Format_CBProc )(
273 FormatStructure *,
274 const Format*,
275 void * /* data the application registered */
278 struct _FormatStructure {
279 OptionStructure *type;
280 OptionStructure *prec;
281 TextStructure *fstring;
283 Format_CBProc cb_proc;
284 void *cb_data;
287 void Beep(void);
289 void InitWidgets(void);
291 Pixmap XpmToPixmap(char **xpm);
293 SpinStructure *CreateCharSizeChoice(Widget parent, char *s);
295 SpinStructure *CreateAngleChoice(Widget parent, char *s);
296 double GetAngleChoice(SpinStructure *sp);
297 void SetAngleChoice(SpinStructure *sp, double angle);
299 ListStructure *CreateListChoice(Widget parent, char *labelstr, int type,
300 int nvisible, int nchoices, OptionItem *items);
301 int SelectListChoice(ListStructure *listp, int choice);
302 void SelectListChoices(ListStructure *listp, int nchoices, int *choices);
303 void UpdateListChoice(ListStructure *listp, int nchoices, OptionItem *items);
304 int GetListChoices(ListStructure *listp, int **values);
305 int GetSingleListChoice(ListStructure *listp, int *value);
306 int GetListSelectedCount(ListStructure *listp);
307 void AddListChoiceCB(ListStructure *listp, List_CBProc cbproc, void *anydata);
309 StorageStructure *CreateStorageChoice(Widget parent,
310 char *labelstr, int type, int nvisible);
311 void SetStorageChoiceLabeling(StorageStructure *ss, Storage_LabelingProc proc);
312 int GetStorageChoices(StorageStructure *ss, Quark ***values);
313 int GetSingleStorageChoice(StorageStructure *ss, Quark **value);
314 int SelectStorageChoice(StorageStructure *ss, Quark *choice);
315 int SelectStorageChoices(StorageStructure *ss, int nchoices, Quark **choices);
316 void UpdateStorageChoice(StorageStructure *ss);
317 void SetStorageChoiceQuark(StorageStructure *ss, Quark *q);
318 void AddStorageChoiceCB(StorageStructure *ss,
319 Storage_CBProc cbproc, void *anydata);
320 void AddStorageChoiceDblClickCB(StorageStructure *ss,
321 Storage_DCCBProc cbproc, void *anydata);
323 OptionStructure *CreateFontChoice(Widget parent, char *s);
324 OptionStructure *CreatePatternChoice(Widget parent, char *s);
325 OptionStructure *CreateLineStyleChoice(Widget parent, char *s);
326 OptionStructure *CreateSetTypeChoice(Widget parent, char *s);
327 OptionStructure *CreateColorChoice(Widget parent, char *s);
328 OptionStructure *CreateASChoice(Widget parent, char *s);
329 OptionStructure *CreateTextJustChoice(Widget parent, char *s);
330 OptionStructure *CreateJustChoice(Widget parent, char *s);
331 OptionStructure *CreateFrameTypeChoice(Widget parent, char *s);
333 Widget CreatePenChoice(Widget parent, char *s);
334 void SetPenChoice(Widget button, Pen *pen);
335 int GetPenChoice(Widget pen_button, Pen *pen);
336 void AddPenChoiceCB(Widget button, Pen_CBProc cbproc, void *anydata);
338 FormatStructure *CreateFormatChoice(Widget parent);
339 void SetFormatChoice(FormatStructure *fstr, const Format *format);
340 Format *GetFormatChoice(FormatStructure *fstr);
341 void AddFormatChoiceCB(FormatStructure *fstr, Format_CBProc cbproc, void *data);
343 SpinStructure *CreateViewCoordInput(Widget parent, char *s);
345 RestrictionStructure *CreateRestrictionChoice(Widget parent, char *s);
347 StorageStructure *CreateSSDChoice(Widget parent, char *labelstr, int type);
349 StorageStructure *CreateFrameChoice(Widget parent, char *labelstr, int type);
351 StorageStructure *CreateGraphChoice(Widget parent, char *labelstr, int type);
353 StorageStructure *CreateSetChoice(Widget parent, char *labelstr,
354 int type, StorageStructure *graphss);
355 void UpdateSetChoice(StorageStructure *ss);
356 Quark *get_set_choice_gr(StorageStructure *ss);
358 GraphSetStructure *CreateGraphSetSelector(Widget parent, char *s, int sel_type);
359 SSDSetStructure *CreateSSDSetSelector(Widget parent, char *s, int sel_type);
360 SrcDestStructure *CreateSrcDestSelector(Widget parent, int sel_type);
362 ListStructure *CreateColChoice(Widget parent, char *labelstr, int type);
363 void UpdateColChoice(ListStructure *sel, const Quark *ssd);
365 SSDColStructure *CreateSSDColSelector(Widget parent, char *s, int sel_type);
366 int GetSSDColChoices(SSDColStructure *sc, Quark **ssd, int **cols);
368 SpinStructure *CreateLineWidthChoice(Widget parent, char *s);
370 OptionStructure *CreatePanelChoice(Widget parent, char *labstr, ...);
371 OptionStructure *CreatePrecisionChoice(Widget parent, char *s);
372 OptionStructure *CreatePaperOrientationChoice(Widget parent, char *s);
373 OptionStructure *CreatePaperFormatChoice(Widget parent, char *s);
375 WidgetList CreateAACDialog(Widget form,
376 Widget container, AACDialog_CBProc cbproc, void *data);
378 TransformStructure *CreateTransformDialogForm(Widget parent,
379 const char *s, int sel_type, int exclusive, const TD_CBProcs *cbs);
380 int GetTransformDialogSettings(TransformStructure *tdialog,
381 int *nssrc, Quark ***srcsets, Quark ***destsets);
382 void RaiseTransformationDialog(TransformStructure *tdialog);
384 void AddHelpCB(Widget w, char *ha);
385 void ContextHelpCB(Widget w, void *data);
387 void DefineDialogCursor(Cursor c);
388 void UndefineDialogCursor(void);
390 void AddWindowCloseCB(Widget w, Widget_CBProc cbproc, void *anydata);
391 void destroy_dialog_cb(Widget but, void *data);
393 void undo_cb(Widget but, void *data);
394 void redo_cb(Widget but, void *data);
396 void unlink_ssd_ui(Quark *q);
398 void set_title(char *title, char *icon_name);
400 /* Tree Widget */
401 typedef void TreeItem;
403 typedef struct {
404 TreeItem **items;
405 int count;
406 } TreeItemList;
408 typedef struct {
409 Widget w;
410 void *anydata;
411 void *udata;
412 int drop_action;
413 } TreeEvent;
415 typedef int (*Tree_CBProc)(TreeEvent *event);
416 typedef struct {
417 Widget w;
418 Tree_CBProc cbproc;
419 void *anydata;
420 } Tree_CBData;
422 Widget CreateTree(Widget parent);
423 TreeItem *TreeInsertItem(Widget w, TreeItem *parent, Quark *q, int row);
424 void TreeDeleteItem(Widget w, TreeItem *item);
425 void TreeSetItemOpen(Widget w, TreeItem *item, int open);
426 void TreeSetItemText(Widget w, TreeItem *item, char *text);
427 void TreeSetItemPixmap(Widget w, TreeItem *item, Pixmap pixmap);
428 Quark *TreeGetQuark(TreeItem *item);
429 void TreeGetHighlighted(Widget w, TreeItemList *items);
430 void TreeHighlightItem(Widget w, TreeItem *item);
431 void TreeClearSelection(Widget w);
432 void TreeScrollToItem(Widget w, TreeItem *item);
433 void TreeRefresh(Widget w);
435 void AddTreeContextMenuCB(Widget w, Tree_CBProc cbproc, void *anydata);
436 void AddTreeHighlightItemsCB(Widget w, Tree_CBProc cbproc, void *anydata);
437 void AddTreeDropItemsCB(Widget w, Tree_CBProc cbproc, void *anydata);
440 /* Table Widget */
441 Widget CreateTable(char *name, Widget parent, int nrows, int ncols, int nrows_visible, int ncols_visible);
442 void TableSSDInit(Widget w);
443 void TableFontInit(Widget w);
444 void TableDataSetPropInit(Widget w);
445 void TableLevalInit(Widget w);
446 void TableOptionChoiceInit(Widget w);
447 int TableGetNrows(Widget w);
448 int TableGetNcols(Widget w);
449 void TableAddRows(Widget w, int nrows);
450 void TableDeleteRows(Widget w, int nrows);
451 void TableAddCols(Widget w, int ncols);
452 void TableDeleteCols(Widget w, int ncols);
453 void TableGetCellDimentions(Widget w, int *cwidth, int *cheight);
454 void TableSetColWidths(Widget w, int *widths);
455 void TableSetDefaultRowLabelWidth(Widget w, int width);
456 void TableSetDefaultRowLabelAlignment(Widget w, int align);
457 void TableSetDefaultColWidth(Widget w, int width);
458 void TableSetDefaultColAlignment(Widget w, int align);
459 void TableSetDefaultColLabelAlignment(Widget w, int align);
460 void TableSetColMaxlengths(Widget w, int *maxlengths);
461 void TableSetRowLabels(Widget w, char **labels);
462 void TableSetColLabels(Widget w, char **labels);
463 void TableSetFixedCols(Widget w, int nfixed_cols);
464 void TableUpdateVisibleRowsCols(Widget w);
465 void TableCommitEdit(Widget w, int close);
466 void TableSetCells(Widget w, char ***cells);
467 void TableSetCell(Widget w, int row, int col, char *value);
468 char *TableGetCell(Widget w, int row, int col);
469 void TableSelectCell(Widget w, int row, int col);
470 void TableDeselectCell(Widget w, int row, int col);
471 void TableSelectRow(Widget w, int row);
472 void TableDeselectRow(Widget w, int row);
473 void TableSelectCol(Widget w, int col);
474 void TableDeselectCol(Widget w, int col);
475 void TableDeselectAllCells(Widget w);
476 int TableIsRowSelected(Widget w, int row);
477 int TableIsColSelected(Widget w, int col);
478 void TableUpdate(Widget w);
480 typedef struct {
481 int type;
482 int button;
483 int modifiers;
485 Widget w;
486 int row;
487 int col;
488 unsigned long background;
489 unsigned long foreground;
490 int value_type;
491 char *value;
492 Pixmap pixmap;
493 int row_label;
494 void *anydata;
495 void *udata;
496 } TableEvent;
498 typedef int (*Table_CBProc)(TableEvent *event);
499 typedef struct {
500 Widget w;
501 Table_CBProc cbproc;
502 void *anydata;
503 } Table_CBData;
505 void AddTableDrawCellCB(Widget w, Table_CBProc cbproc, void *anydata);
506 void AddTableEnterCellCB(Widget w, Table_CBProc cbproc, void *anydata);
507 void AddTableLeaveCellCB(Widget w, Table_CBProc cbproc, void *anydata);
508 void AddTableLabelActivateCB(Widget w, Table_CBProc cbproc, void *anydata);
510 /* ScrollBar */
511 void GetScrollBarValues(Widget w, int *value, int *maxvalue, int *slider_size, int *increment);
512 void SetScrollBarValue(Widget w, int value);
513 void SetScrollBarIncrement(Widget w, int increment);
514 Widget GetHorizontalScrollBar(Widget w);
515 Widget GetVerticalScrollBar(Widget w);
517 void AddMouseWheelSupport(Widget w);
519 #endif /* __MOTIFINC_H_ */