| 1 | /* |
| 2 | * ComboBox.h - Das schon lange schmerzlich vermisste Combo-Box- |
| 3 | * Widget -- nun endlich auf fuer Motif! |
| 4 | * |
| 5 | * Letzte Modifikation: 04.10.1995 Revisionsstand: 1.32a |
| 6 | * |
| 7 | * (c) 1993, 1994 Harald Albrecht |
| 8 | * Institut fuer Geometrie und Praktische Mathematik |
| 9 | * RWTH Aachen, Germany |
| 10 | * albrecht@igpm.rwth-aachen.de |
| 11 | * |
| 12 | * This program is free software; you can redistribute it and/or modify |
| 13 | * it under the terms of the GNU General Public License as published by |
| 14 | * the Free Software Foundation; either version 2 of the License, or |
| 15 | * (at your option) any later version. |
| 16 | * |
| 17 | * This program is distributed in the hope that it will be useful, |
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 | * GNU General Public License for more details. |
| 21 | * |
| 22 | * You should have received a copy of the GNU General Public License |
| 23 | * along with this program (see the file COPYING for more details); |
| 24 | * if not, write to the Free Software Foundation, Inc., 675 Mass Ave, |
| 25 | * Cambridge, MA 02139, USA. |
| 26 | * |
| 27 | */ |
| 28 | #ifndef __ComboBoxWidget_h |
| 29 | #define __ComboBoxWidget_h |
| 30 | |
| 31 | #include <Xm/Xm.h> |
| 32 | |
| 33 | #if defined(__cplusplus) || defined(c_plusplus) |
| 34 | extern "C" { |
| 35 | #endif |
| 36 | |
| 37 | #ifdef XmNselectionCallback |
| 38 | #undef XmNselectionCallback |
| 39 | #endif |
| 40 | |
| 41 | #define XmNselectionCallback "selectionCallback" |
| 42 | #define XmCSelectionCallback "SelectionCallback" |
| 43 | #define XmNunselectionCallback "unselectionCallback" |
| 44 | #define XmCUnselectionCallback "UnselectionCallback" |
| 45 | #define XmNdropDownCallback "dropDownCallback" |
| 46 | #define XmCDropDownCallback "DropDownCallback" |
| 47 | |
| 48 | #define XmNdropDownCursor "dropDownCursor" |
| 49 | #define XmCDropDownCursor "DropDownCursor" |
| 50 | |
| 51 | /* ICH GLAUB' ES JA EINFACH NICHT! DIESE @#$!%^ BEI DER OSF HABEN |
| 52 | * DOCH TATSAECHLICH VERGESSEN, DASS DIE EINTRAEGE IN DER LISTBOX |
| 53 | * VIELLEICHT AUCH SORTIERT SEIN SOLLEN -- MUSS MAN DENN ALLES |
| 54 | * SELBST MACHEN?! |
| 55 | */ |
| 56 | #define XmNsorted "sorted" |
| 57 | #define XmCSorted "Sorted" |
| 58 | #define XmNsortingCallback "sortingCallback" |
| 59 | #define XmCSortingCallback "SortingCallback" |
| 60 | |
| 61 | #define XmNstaticList "staticList" |
| 62 | #define XmCStaticList "StaticList" |
| 63 | |
| 64 | #define XmNsquareArrow "squareArrow" |
| 65 | #define XmCSquareArrow "SquareArrow" |
| 66 | #define XmNarrowSpacingOn "arrowSpacingOn" |
| 67 | #define XmCArrowSpacingOn "ArrowSpacingOn" |
| 68 | |
| 69 | /* |
| 70 | * Wie verhaeltsich die Liste, wenn der Focus verloren geht, sobald |
| 71 | * der Mauszeiger aus dem Dialog herausbewegt wird? |
| 72 | */ |
| 73 | #define XmNpersistentDropDown "persistentDropDown" |
| 74 | #define XmCPersistentDropDown "PersistentDropDown" |
| 75 | #define XmNtwmHandlingOn "twmHandlingOn" |
| 76 | #define XmCTwmHandlingOn "TwmHandlingOn" |
| 77 | /* |
| 78 | * alles fuer das Label... |
| 79 | */ |
| 80 | #define XmNshowLabel "showLabel" |
| 81 | #define XmCShowLabel "ShowLabel" |
| 82 | #define XmNdropDownOffset "dropDownOffset" |
| 83 | #define XmCDropDownOffset "DropDownOffset" |
| 84 | |
| 85 | #define XmNlabelMarginBottom "labelMarginBottom" |
| 86 | #define XmCLabelMarginBottom "LabelMarginBottom" |
| 87 | #define XmNlabelMarginHeight "labelMarginHeight" |
| 88 | #define XmCLabelMarginHeight "LabelMarginHeight" |
| 89 | #define XmNlabelMarginLeft "labelMarginLeft" |
| 90 | #define XmCLabelMarginLeft "LabelMarginLeft" |
| 91 | #define XmNlabelMarginRight "labelMarginRight" |
| 92 | #define XmCLabelMarginRight "LabelMarginRight" |
| 93 | #define XmNlabelMarginTop "labelMarginTop" |
| 94 | #define XmCLabelMarginTop "LabelMarginTop" |
| 95 | #define XmNlabelMarginWidth "labelMarginWidth" |
| 96 | #define XmCLabelMarginWidth "LabelMarginWidth" |
| 97 | |
| 98 | /* Callback reasons: (part. predefined) |
| 99 | * |
| 100 | * XmCR_SINGLE_SELECT user selected item in the list |
| 101 | */ |
| 102 | |
| 103 | typedef struct { |
| 104 | int reason; /* Grund */ |
| 105 | XEvent *event; /* Ausloesender Event */ |
| 106 | XmString value; /* Ausgewaehlter Eintrag */ |
| 107 | int index; /* Index dieses Eintrages */ |
| 108 | } XmComboBoxSelectionCallbackStruct,XmComboBoxDefaultActionCallbackStruct; |
| 109 | |
| 110 | typedef struct { |
| 111 | int reason; |
| 112 | XEvent *event; |
| 113 | Boolean doit; |
| 114 | Position currInsert, newInsert; |
| 115 | Position startPos, endPos; |
| 116 | XmTextBlock text; |
| 117 | } XmComboBoxTextVerifyCallbackStruct, *XmComboBoxTextVerifyPtr; |
| 118 | |
| 119 | /* Callback reasons: new |
| 120 | * |
| 121 | * XmCR_SHOW_LIST list is dropping down |
| 122 | * XmCR_HIDE_LIST list is getting hidden |
| 123 | * |
| 124 | * XmCR_UNSELECT unselecting item from list or osfDelete |
| 125 | */ |
| 126 | #define XmCR_SHOW_LIST 4200 /* ten times "42", that should */ |
| 127 | #define XmCR_HIDE_LIST 4201 /* explain everything of live... */ |
| 128 | #define XmCR_UNSELECT 4202 |
| 129 | typedef struct { |
| 130 | int reason; /* Grund */ |
| 131 | XEvent *event; /* Ausloesender Event */ |
| 132 | } XmComboBoxDropDownCallbackStruct, XmComboBoxUnselectionCallbackStruct; |
| 133 | |
| 134 | #define XmCR_SORTING 4203 |
| 135 | #define XmOP_INIT 1 |
| 136 | #define XmOP_DONE 2 |
| 137 | #define XmOP_COMPARE 3 |
| 138 | typedef struct { |
| 139 | int reason; |
| 140 | XEvent *event; /* IMMER NULL!! */ |
| 141 | int operation; |
| 142 | void *item_internal; |
| 143 | XmString item; |
| 144 | int result; |
| 145 | } XmComboBoxSortingCallbackStruct, *XmComboBoxSortingPtr; |
| 146 | |
| 147 | /* Alle Funktionen, um auf die Liste der Combo-Box zuzugreifen. |
| 148 | * Bitte immer diese Funktionen dazu benutzen und nicht direkt |
| 149 | * auf das entsprechende Widget in der Combo-Box zugreifen! |
| 150 | * Aus diesem Grunde sind auch nicht alle Funktionen einer Listbox |
| 151 | * verfuegbar, da sich einige Funktionen mit der Verwaltung der |
| 152 | * Combo-Box beissen wuerden. |
| 153 | */ |
| 154 | extern void XmComboBoxAddItem(Widget w, XmString item, int pos); |
| 155 | extern void XmComboBoxAddItems(Widget w, XmString *items, int item_count, int pos); |
| 156 | extern void XmComboBoxAddItemUnselected(Widget w, XmString item, int pos); |
| 157 | extern void XmComboBoxDeleteItem(Widget w, XmString item); |
| 158 | extern void XmComboBoxDeleteItems(Widget w, XmString *items, int item_count); |
| 159 | extern void XmComboBoxDeletePos(Widget w, int pos); |
| 160 | extern void XmComboBoxDeleteItemsPos(Widget w, int item_count, int pos); |
| 161 | extern void XmComboBoxDeleteAllItems(Widget w); |
| 162 | extern void XmComboBoxReplaceItems(Widget w, XmString *old_items, int item_count, XmString *new_items); |
| 163 | extern void XmComboBoxReplaceItemsPos(Widget w, XmString *new_items, int item_count, int position); |
| 164 | extern Boolean XmComboBoxItemExists(Widget w, XmString item); |
| 165 | extern int XmComboBoxItemPos(Widget w, XmString item); |
| 166 | extern Boolean XmComboBoxGetMatchPos(Widget w, XmString item, int **pos_list, int *pos_count); |
| 167 | extern void XmComboBoxSelectPos(Widget w, int pos, Boolean notify); |
| 168 | extern void XmComboBoxSelectItem(Widget w, XmString item, Boolean notify); |
| 169 | /* Etwas anders als bei der Listbox, da es sowieso nur einen ausge- |
| 170 | * waehlten Eintrag in der Listbox geben kann! |
| 171 | * Liefert Index des ausgewaehlten Eintrages oder 0. |
| 172 | */ |
| 173 | extern int XmComboBoxGetSelectedPos(Widget w); |
| 174 | extern void XmComboBoxClearItemSelection(Widget w); |
| 175 | /* |
| 176 | * Nun alle Funktionen, die auf das Eingabefeld zugreifen... |
| 177 | * Auch hier gilt wieder, es gibt 'was auf die Finger, wenn jemand |
| 178 | * versucht, direkt auf das Eingabefeld direkt zuzugreifen! |
| 179 | */ |
| 180 | extern void XmComboBoxClearSelection(Widget w, Time time); |
| 181 | extern Boolean XmComboBoxCopy(Widget w, Time time); |
| 182 | extern Boolean XmComboBoxCut(Widget w, Time time); |
| 183 | extern XmTextPosition XmComboBoxGetInsertionPosition(Widget w); |
| 184 | extern XmTextPosition XmComboBoxGetLastPosition(Widget w); |
| 185 | extern int XmComboBoxGetMaxLength(Widget w); |
| 186 | extern char * XmComboBoxGetSelection(Widget w); |
| 187 | extern Boolean XmComboBoxGetSelectionPosition(Widget w, XmTextPosition *left, |
| 188 | XmTextPosition *right); |
| 189 | extern char * XmComboBoxGetString(Widget w); |
| 190 | extern void XmComboBoxInsert(Widget w, XmTextPosition position, char *value); |
| 191 | extern Boolean XmComboBoxPaste(Widget w); |
| 192 | extern Boolean XmComboBoxRemove(Widget w); |
| 193 | extern void XmComboBoxReplace(Widget w, XmTextPosition from_pos, |
| 194 | XmTextPosition to_pos, char *value); |
| 195 | extern void XmComboBoxSetAddMode(Widget w, Boolean state); |
| 196 | extern void XmComboBoxSetHighlight(Widget w, XmTextPosition left, |
| 197 | XmTextPosition right, XmHighlightMode mode); |
| 198 | extern void XmComboBoxSetInsertionPosition(Widget w, XmTextPosition position); |
| 199 | extern void XmComboBoxSetMaxLength(Widget w, int max_length); |
| 200 | extern void XmComboBoxSetSelection(Widget w, XmTextPosition first, |
| 201 | XmTextPosition last, Time time); |
| 202 | extern void XmComboBoxSetString(Widget w, char *value); |
| 203 | extern void XmComboBoxShowPosition(Widget w, XmTextPosition position); |
| 204 | |
| 205 | extern WidgetClass xmComboBoxWidgetClass; /* Die Klasse hoechstselbst */ |
| 206 | |
| 207 | #ifndef XmIsComboBox |
| 208 | #define XmIsComboBox(w) XtIsSubclass(w, xmComboBoxWidgetClass) |
| 209 | #endif /* XmIsComboBox */ |
| 210 | |
| 211 | typedef struct _XmComboBoxClassRec *XmComboBoxWidgetClass; |
| 212 | typedef struct _XmComboBoxRec *XmComboBoxWidget; |
| 213 | |
| 214 | extern Widget XmCreateComboBox(Widget parent, String name, ArgList arglist, |
| 215 | Cardinal argcount); |
| 216 | |
| 217 | /* PLEASE do not use this functions if you really not need to do so !!! */ |
| 218 | extern Widget XmComboBoxGetEditWidget(Widget w); |
| 219 | extern Widget XmComboBoxGetListWidget(Widget w); |
| 220 | extern Widget XmComboBoxGetLabelWidget(Widget w); |
| 221 | |
| 222 | #if defined(__cplusplus) || defined(c_plusplus) |
| 223 | } |
| 224 | #endif |
| 225 | |
| 226 | #endif /* __ComboBoxWidget_h */ |
| 227 | /* Ende von ComboBox.h */ |