Moved CreateBitmapOptionChoice
[grace.git] / src / motifinc.h
blob1c9fa04aa1100eee746238e3a3912d892d122d40
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 OptionStructure *CreateCharOptionChoice(Widget parent, char *s);
334 void UpdateCharOptionChoice(OptionStructure *opt, int font);
336 Widget CreatePenChoice(Widget parent, char *s);
337 void SetPenChoice(Widget button, Pen *pen);
338 int GetPenChoice(Widget pen_button, Pen *pen);
339 void AddPenChoiceCB(Widget button, Pen_CBProc cbproc, void *anydata);
341 FormatStructure *CreateFormatChoice(Widget parent);
342 void SetFormatChoice(FormatStructure *fstr, const Format *format);
343 Format *GetFormatChoice(FormatStructure *fstr);
344 void AddFormatChoiceCB(FormatStructure *fstr, Format_CBProc cbproc, void *data);
346 SpinStructure *CreateViewCoordInput(Widget parent, char *s);
348 RestrictionStructure *CreateRestrictionChoice(Widget parent, char *s);
350 StorageStructure *CreateSSDChoice(Widget parent, char *labelstr, int type);
352 StorageStructure *CreateFrameChoice(Widget parent, char *labelstr, int type);
354 StorageStructure *CreateGraphChoice(Widget parent, char *labelstr, int type);
356 StorageStructure *CreateSetChoice(Widget parent, char *labelstr,
357 int type, StorageStructure *graphss);
358 void UpdateSetChoice(StorageStructure *ss);
359 Quark *get_set_choice_gr(StorageStructure *ss);
361 GraphSetStructure *CreateGraphSetSelector(Widget parent, char *s, int sel_type);
362 SSDSetStructure *CreateSSDSetSelector(Widget parent, char *s, int sel_type);
363 SrcDestStructure *CreateSrcDestSelector(Widget parent, int sel_type);
365 ListStructure *CreateColChoice(Widget parent, char *labelstr, int type);
366 void UpdateColChoice(ListStructure *sel, const Quark *ssd);
368 SSDColStructure *CreateSSDColSelector(Widget parent, char *s, int sel_type);
369 int GetSSDColChoices(SSDColStructure *sc, Quark **ssd, int **cols);
371 SpinStructure *CreateLineWidthChoice(Widget parent, char *s);
373 OptionStructure *CreatePanelChoice(Widget parent, char *labstr, ...);
374 OptionStructure *CreatePrecisionChoice(Widget parent, char *s);
375 OptionStructure *CreatePaperOrientationChoice(Widget parent, char *s);
376 OptionStructure *CreatePaperFormatChoice(Widget parent, char *s);
378 WidgetList CreateAACDialog(Widget form,
379 Widget container, AACDialog_CBProc cbproc, void *data);
381 TransformStructure *CreateTransformDialogForm(Widget parent,
382 const char *s, int sel_type, int exclusive, const TD_CBProcs *cbs);
383 int GetTransformDialogSettings(TransformStructure *tdialog,
384 int *nssrc, Quark ***srcsets, Quark ***destsets);
385 void RaiseTransformationDialog(TransformStructure *tdialog);
387 void AddHelpCB(Widget w, char *ha);
388 void ContextHelpCB(Widget w, void *data);
390 void DefineDialogCursor(Cursor c);
391 void UndefineDialogCursor(void);
393 void AddWindowCloseCB(Widget w, Widget_CBProc cbproc, void *anydata);
394 void destroy_dialog_cb(Widget but, void *data);
396 void undo_cb(Widget but, void *data);
397 void redo_cb(Widget but, void *data);
399 void unlink_ssd_ui(Quark *q);
401 void set_title(char *title, char *icon_name);
403 /* Tree Widget */
404 typedef void TreeItem;
406 typedef struct {
407 TreeItem **items;
408 int count;
409 } TreeItemList;
411 typedef struct {
412 Widget w;
413 void *anydata;
414 void *udata;
415 int drop_action;
416 } TreeEvent;
418 typedef int (*Tree_CBProc)(TreeEvent *event);
419 typedef struct {
420 Widget w;
421 Tree_CBProc cbproc;
422 void *anydata;
423 } Tree_CBData;
425 Widget CreateTree(Widget parent);
426 TreeItem *TreeInsertItem(Widget w, TreeItem *parent, Quark *q, int row);
427 void TreeDeleteItem(Widget w, TreeItem *item);
428 void TreeSetItemOpen(Widget w, TreeItem *item, int open);
429 void TreeSetItemText(Widget w, TreeItem *item, char *text);
430 void TreeSetItemPixmap(Widget w, TreeItem *item, Pixmap pixmap);
431 Quark *TreeGetQuark(TreeItem *item);
432 void TreeGetHighlighted(Widget w, TreeItemList *items);
433 void TreeHighlightItem(Widget w, TreeItem *item);
434 void TreeClearSelection(Widget w);
435 void TreeScrollToItem(Widget w, TreeItem *item);
436 void TreeRefresh(Widget w);
438 void AddTreeContextMenuCB(Widget w, Tree_CBProc cbproc, void *anydata);
439 void AddTreeHighlightItemsCB(Widget w, Tree_CBProc cbproc, void *anydata);
440 void AddTreeDropItemsCB(Widget w, Tree_CBProc cbproc, void *anydata);
443 /* Table Widget */
444 Widget CreateTable(char *name, Widget parent, int nrows, int ncols, int nrows_visible, int ncols_visible);
445 void TableSSDInit(Widget w);
446 void TableFontInit(Widget w);
447 void TableDataSetPropInit(Widget w);
448 void TableLevalInit(Widget w);
449 void TableOptionChoiceInit(Widget w);
450 int TableGetNrows(Widget w);
451 int TableGetNcols(Widget w);
452 void TableAddRows(Widget w, int nrows);
453 void TableDeleteRows(Widget w, int nrows);
454 void TableAddCols(Widget w, int ncols);
455 void TableDeleteCols(Widget w, int ncols);
456 void TableGetCellDimentions(Widget w, int *cwidth, int *cheight);
457 void TableSetColWidths(Widget w, int *widths);
458 void TableSetDefaultRowLabelWidth(Widget w, int width);
459 void TableSetDefaultRowLabelAlignment(Widget w, int align);
460 void TableSetDefaultColWidth(Widget w, int width);
461 void TableSetDefaultColAlignment(Widget w, int align);
462 void TableSetDefaultColLabelAlignment(Widget w, int align);
463 void TableSetColMaxlengths(Widget w, int *maxlengths);
464 void TableSetRowLabels(Widget w, char **labels);
465 void TableSetColLabels(Widget w, char **labels);
466 void TableSetFixedCols(Widget w, int nfixed_cols);
467 void TableUpdateVisibleRowsCols(Widget w);
468 void TableCommitEdit(Widget w, int close);
469 void TableSetCells(Widget w, char ***cells);
470 void TableSetCell(Widget w, int row, int col, char *value);
471 char *TableGetCell(Widget w, int row, int col);
472 void TableSelectCell(Widget w, int row, int col);
473 void TableDeselectCell(Widget w, int row, int col);
474 void TableSelectRow(Widget w, int row);
475 void TableDeselectRow(Widget w, int row);
476 void TableSelectCol(Widget w, int col);
477 void TableDeselectCol(Widget w, int col);
478 void TableDeselectAllCells(Widget w);
479 int TableIsRowSelected(Widget w, int row);
480 int TableIsColSelected(Widget w, int col);
481 void TableUpdate(Widget w);
483 typedef struct {
484 int type;
485 int button;
486 int modifiers;
488 Widget w;
489 int row;
490 int col;
491 unsigned long background;
492 unsigned long foreground;
493 int value_type;
494 char *value;
495 Pixmap pixmap;
496 int row_label;
497 void *anydata;
498 void *udata;
499 } TableEvent;
501 typedef int (*Table_CBProc)(TableEvent *event);
502 typedef struct {
503 Widget w;
504 Table_CBProc cbproc;
505 void *anydata;
506 } Table_CBData;
508 void AddTableDrawCellCB(Widget w, Table_CBProc cbproc, void *anydata);
509 void AddTableEnterCellCB(Widget w, Table_CBProc cbproc, void *anydata);
510 void AddTableLeaveCellCB(Widget w, Table_CBProc cbproc, void *anydata);
511 void AddTableLabelActivateCB(Widget w, Table_CBProc cbproc, void *anydata);
513 /* ScrollBar */
514 void GetScrollBarValues(Widget w, int *value, int *maxvalue, int *slider_size, int *increment);
515 void SetScrollBarValue(Widget w, int value);
516 void SetScrollBarIncrement(Widget w, int increment);
517 Widget GetHorizontalScrollBar(Widget w);
518 Widget GetVerticalScrollBar(Widget w);
520 void AddMouseWheelSupport(Widget w);
522 #endif /* __MOTIFINC_H_ */