| 1 |
#ifndef _Gui_h_ |
| 2 |
#define _Gui_h_ |
| 3 |
/* Gui.h |
| 4 |
* |
| 5 |
* Copyright (C) 1993-2026 Paul Boersma, 2013 Tom Naughton |
| 6 |
* |
| 7 |
* This code is free software; you can redistribute it and/or modify |
| 8 |
* it under the terms of the GNU General Public License as published by |
| 9 |
* the Free Software Foundation; either version 3 of the License, or (at |
| 10 |
* your option) any later version. |
| 11 |
* |
| 12 |
* This code is distributed in the hope that it will be useful, but |
| 13 |
* WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 15 |
* See the GNU General Public License for more details. |
| 16 |
* |
| 17 |
* You should have received a copy of the GNU General Public License |
| 18 |
* along with this work. If not, see <http://www.gnu.org/licenses/>. |
| 19 |
*/ |
| 20 |
|
| 21 |
/* |
| 22 |
Determine the widget set, honouring the compiler switch NO_GUI |
| 23 |
and/or the compiler switch NO_GRAPHICS, which entails NO_GUI. |
| 24 |
*/ |
| 25 |
#if defined (NO_GRAPHICS) && ! defined (NO_GUI) |
| 26 |
#define NO_GUI |
| 27 |
#endif |
| 28 |
#if defined (NO_GUI) |
| 29 |
#define gtk 0 |
| 30 |
#define motif 0 |
| 31 |
#define cocoa 0 |
| 32 |
#elif defined (UNIX) |
| 33 |
#define gtk 1 |
| 34 |
#define motif 0 |
| 35 |
#define cocoa 0 |
| 36 |
#elif defined (_WIN32) |
| 37 |
#define gtk 0 |
| 38 |
#define motif 1 |
| 39 |
#define cocoa 0 |
| 40 |
#elif defined (macintosh) |
| 41 |
#define gtk 0 |
| 42 |
#define motif 0 |
| 43 |
#define cocoa 1 |
| 44 |
#else |
| 45 |
/* |
| 46 |
Unknown platforms have no GUI. |
| 47 |
*/ |
| 48 |
#define gtk 0 |
| 49 |
#define motif 0 |
| 50 |
#define cocoa 0 |
| 51 |
#endif |
| 52 |
|
| 53 |
constexpr bool theCommandKeyIsToTheLeftOfTheOptionKey = |
| 54 |
#if defined (macintosh) |
| 55 |
false; |
| 56 |
#else |
| 57 |
true; |
| 58 |
#endif |
| 59 |
|
| 60 |
#include "Collection.h" |
| 61 |
|
| 62 |
#if defined (UNIX) |
| 63 |
#if gtk |
| 64 |
#include <gtk/gtk.h> |
| 65 |
#include <gdk/gdk.h> |
| 66 |
#endif |
| 67 |
#if ! defined (NO_GRAPHICS) |
| 68 |
#include <cairo/cairo.h> |
| 69 |
#include <pango/pango.h> |
| 70 |
#include <pango/pangocairo.h> |
| 71 |
#endif |
| 72 |
#elif defined (macintosh) |
| 73 |
#include "macport_on.h" |
| 74 |
#include <Cocoa/Cocoa.h> |
| 75 |
#include "macport_off.h" |
| 76 |
#elif defined (_WIN32) |
| 77 |
#include "winport_on.h" |
| 78 |
#include <windows.h> |
| 79 |
#include <windowsx.h> |
| 80 |
#include "winport_off.h" |
| 81 |
#endif |
| 82 |
|
| 83 |
#include "machine.h" |
| 84 |
|
| 85 |
#define Gui_LEFT_DIALOG_SPACING 20 |
| 86 |
#define Gui_RIGHT_DIALOG_SPACING 20 |
| 87 |
#if defined (chrome) |
| 88 |
#define Gui_TOP_DIALOG_SPACING 34 |
| 89 |
#else |
| 90 |
#define Gui_TOP_DIALOG_SPACING 14 |
| 91 |
#endif |
| 92 |
#define Gui_BOTTOM_DIALOG_SPACING 20 |
| 93 |
#define Gui_HORIZONTAL_DIALOG_SPACING 12 |
| 94 |
#define Gui_VERTICAL_DIALOG_SPACING_SAME 12 |
| 95 |
#define Gui_VERTICAL_DIALOG_SPACING_DIFFERENT 20 |
| 96 |
#define Gui_TEXTFIELD_HEIGHT Machine_getTextHeight () |
| 97 |
#define Gui_LABEL_HEIGHT 16 |
| 98 |
#define Gui_RADIOBUTTON_HEIGHT 18 |
| 99 |
#define Gui_RADIOBUTTON_SPACING 8 |
| 100 |
#define Gui_CHECKBUTTON_HEIGHT 20 |
| 101 |
#define Gui_LABEL_SPACING 8 |
| 102 |
#define Gui_OPTIONMENU_HEIGHT 20 |
| 103 |
#define Gui_PUSHBUTTON_HEIGHT Machine_getButtonHeight () |
| 104 |
#define Gui_OK_BUTTON_WIDTH 69 |
| 105 |
#define Gui_CANCEL_BUTTON_WIDTH 69 |
| 106 |
#define Gui_APPLY_BUTTON_WIDTH 69 |
| 107 |
|
| 108 |
#define Gui_HOMOGENEOUS 1 |
| 109 |
|
| 110 |
#if gtk |
| 111 |
typedef void *GuiObject; |
| 112 |
#elif cocoa |
| 113 |
Thing_declare (GuiThing); |
| 114 |
@protocol GuiCocoaAny |
| 115 |
- (GuiThing) getUserData; |
| 116 |
- (void) setUserData: (GuiThing) userData; |
| 117 |
@end |
| 118 |
typedef NSObject <GuiCocoaAny> *GuiObject; |
| 119 |
@interface GuiCocoaApplication : NSApplication @end |
| 120 |
@interface GuiCocoaButton : NSButton <GuiCocoaAny> @end |
| 121 |
@interface GuiCocoaCheckButton : NSButton <GuiCocoaAny> @end |
| 122 |
@interface GuiCocoaDrawingArea : NSView <GuiCocoaAny> @end |
| 123 |
@interface GuiCocoaLabel : NSTextField <GuiCocoaAny> @end |
| 124 |
@interface GuiCocoaList : NSView <GuiCocoaAny, NSTableViewDataSource, NSTableViewDelegate> @end |
| 125 |
@interface GuiCocoaMenu : NSMenu <GuiCocoaAny> @end |
| 126 |
@interface GuiCocoaMenuButton : NSPopUpButton <GuiCocoaAny> @end |
| 127 |
@interface GuiCocoaMenuItem : NSMenuItem <GuiCocoaAny> @end |
| 128 |
@interface GuiCocoaOptionMenu : NSPopUpButton <GuiCocoaAny> @end |
| 129 |
@interface GuiCocoaProgressBar : NSProgressIndicator <GuiCocoaAny> @end |
| 130 |
@interface GuiCocoaRadioButton : NSButton <GuiCocoaAny> @end |
| 131 |
@interface GuiCocoaScale : NSProgressIndicator <GuiCocoaAny> @end |
| 132 |
@interface GuiCocoaScrollBar : NSScroller <GuiCocoaAny> |
| 133 |
- (void) scrollBy: (double) step; |
| 134 |
- (void) magnifyBy: (double) step; |
| 135 |
@end |
| 136 |
@interface GuiCocoaScrolledWindow : NSScrollView <GuiCocoaAny> @end |
| 137 |
@interface GuiCocoaShell : NSWindow <GuiCocoaAny> |
| 138 |
- (void) setDistinctiveBackGround; // slightly darker than Tahoe's background, in order to still see text widgets |
| 139 |
@end |
| 140 |
@interface GuiCocoaShellDelegate : NSObject <NSWindowDelegate> |
| 141 |
@end |
| 142 |
@interface GuiCocoaTextField : NSTextField <GuiCocoaAny> @end |
| 143 |
@interface GuiCocoaTextView : NSTextView <GuiCocoaAny, NSTextViewDelegate> @end |
| 144 |
#elif motif |
| 145 |
typedef class structGuiObject *GuiObject; // opaque |
| 146 |
|
| 147 |
/* |
| 148 |
* Definitions of X11 types. |
| 149 |
*/ |
| 150 |
typedef MSG XEvent; |
| 151 |
typedef unsigned char Boolean; |
| 152 |
typedef integer Cardinal; |
| 153 |
typedef unsigned int Dimension; |
| 154 |
typedef int Position; |
| 155 |
typedef void *Window; |
| 156 |
typedef char *String; |
| 157 |
typedef struct Display Display; |
| 158 |
/*typedef integer Time;*/ |
| 159 |
typedef integer Atom; |
| 160 |
typedef struct { int /* elsewhere: char* */ name; integer value; } Arg, *ArgList; |
| 161 |
|
| 162 |
/* |
| 163 |
* Declarations of X11 functions. |
| 164 |
*/ |
| 165 |
void XMapRaised (int displayDummy, Window window); |
| 166 |
#define DefaultScreenOfDisplay(d) 0 |
| 167 |
int WidthOfScreen (int screen); |
| 168 |
int HeightOfScreen (int screen); |
| 169 |
|
| 170 |
/* |
| 171 |
* Definitions of Xt types. |
| 172 |
*/ |
| 173 |
typedef void *XtPointer; |
| 174 |
typedef GuiObject *GuiObjectList; |
| 175 |
typedef integer XtWorkProcId, XtIntervalId; |
| 176 |
typedef void (*XtCallbackProc) (GuiObject w, XtPointer client_data, XtPointer call_data); |
| 177 |
typedef bool (*XtWorkProc) (void *client_data); |
| 178 |
typedef void (*XtTimerCallbackProc) (XtPointer, XtIntervalId *); |
| 179 |
typedef uinteger WidgetClass; |
| 180 |
#define False 0 |
| 181 |
#define True 1 |
| 182 |
|
| 183 |
/* |
| 184 |
* Declarations of Xt functions. |
| 185 |
*/ |
| 186 |
void XtAddCallback (GuiObject w, int kind, XtCallbackProc proc, XtPointer closure); |
| 187 |
XtIntervalId XtAddTimeOut (uinteger interval, |
| 188 |
XtTimerCallbackProc timerProc, XtPointer closure); |
| 189 |
XtWorkProcId XtAddWorkProc (XtWorkProc workProc, XtPointer closure); |
| 190 |
void GuiMainLoop (); |
| 191 |
void GuiNextEvent (XEvent *event); |
| 192 |
#define XtCalloc Melder_calloc |
| 193 |
#define XtClass(w) (w) -> widgetClass |
| 194 |
void XtDestroyWidget (GuiObject w); |
| 195 |
void XtDispatchEvent (XEvent *event); |
| 196 |
#define XtDisplay(w) 0 |
| 197 |
Boolean XtIsManaged (GuiObject w); |
| 198 |
Boolean XtIsShell (GuiObject w); |
| 199 |
void XtManageChild (GuiObject w); |
| 200 |
void XtManageChildren (GuiObjectList children, Cardinal num_children); |
| 201 |
void XtMapWidget (GuiObject w); |
| 202 |
void XtNextEvent (XEvent *event); |
| 203 |
void XtRemoveTimeOut (XtIntervalId id); |
| 204 |
void XtRemoveWorkProc (XtWorkProcId id); |
| 205 |
void XtSetKeyboardFocus (GuiObject tree, GuiObject descendant); |
| 206 |
void XtSetSensitive (GuiObject w, Boolean value); |
| 207 |
void XtUnmanageChild (GuiObject self); |
| 208 |
void XtUnmanageChildren (GuiObjectList children, Cardinal num_children); |
| 209 |
void * GuiWin_initialize1 (conststring32 name); |
| 210 |
void GuiWin_initialize2 (unsigned int argc, char **argv); |
| 211 |
void GuiApp_setApplicationShell (GuiObject shell); |
| 212 |
GuiObject XtVaCreateWidget (const char *name, int widgetClass, GuiObject parent, ...); |
| 213 |
GuiObject XtVaCreateManagedWidget (const char *name, int widgetClass, GuiObject parent, ...); |
| 214 |
void XtVaGetValues (GuiObject w, ...); |
| 215 |
void XtVaSetValues (GuiObject w, ...); |
| 216 |
Window XtWindow (GuiObject w); |
| 217 |
integer Gui_getNumberOfMotifWidgets (); |
| 218 |
|
| 219 |
/* |
| 220 |
* Xm widget classes. |
| 221 |
*/ |
| 222 |
#define xmBulletinBoardWidgetClass 0x0000'0001 |
| 223 |
#define xmDrawingAreaWidgetClass 0x0000'0002 |
| 224 |
#define xmFormWidgetClass 0x0000'0004 |
| 225 |
#define xmFrameWidgetClass 0x0000'0008 |
| 226 |
#define xmLabelWidgetClass 0x0000'0010 |
| 227 |
#define xmListWidgetClass 0x0000'0020 |
| 228 |
#define xmMenuBarWidgetClass 0x0000'0040 |
| 229 |
#define xmPulldownMenuWidgetClass 0x0000'0100 |
| 230 |
#define xmPushButtonWidgetClass 0x0000'0200 |
| 231 |
#define xmRowColumnWidgetClass 0x0000'0400 |
| 232 |
#define xmScaleWidgetClass 0x0000'0800 |
| 233 |
#define xmScrollBarWidgetClass 0x0000'1000 |
| 234 |
#define xmScrolledWindowWidgetClass 0x0000'2000 |
| 235 |
#define xmSeparatorWidgetClass 0x0000'4000 |
| 236 |
#define xmShellWidgetClass 0x0000'8000 |
| 237 |
#define xmTextWidgetClass 0x0001'0000 |
| 238 |
#define xmToggleButtonWidgetClass 0x0002'0000 |
| 239 |
#define xmCascadeButtonWidgetClass 0x0004'0000 |
| 240 |
#define xmPushButtonGadgetClass xmPushButtonWidgetClass |
| 241 |
#define xmCascadeButtonGadgetClass xmCascadeButtonWidgetClass |
| 242 |
#define xmSeparatorGadgetClass xmSeparatorWidgetClass |
| 243 |
#define xmToggleButtonGadgetClass xmToggleButtonWidgetClass |
| 244 |
|
| 245 |
/* |
| 246 |
* Xm resource names. |
| 247 |
*/ |
| 248 |
enum { |
| 249 |
XmNnull, |
| 250 |
#define motif_RESOURCE(xxx) xxx, |
| 251 |
#include "motifEmulator_resources.h" |
| 252 |
#undef motif_RESOURCE |
| 253 |
XmNend |
| 254 |
}; |
| 255 |
|
| 256 |
/* |
| 257 |
* Xm enumerated types. |
| 258 |
* All start at 1, because we have to reserve zero for the dynamic default value. |
| 259 |
* This is important for the resources set during creation. |
| 260 |
*/ |
| 261 |
enum /* dialog styles */ { XmDIALOG_MODELESS = 1, XmDIALOG_FULL_APPLICATION_MODAL }; |
| 262 |
enum /* orientation */ { XmVERTICAL = 1, XmHORIZONTAL }; |
| 263 |
enum /* attachment */ { XmATTACH_NONE = 1, XmATTACH_FORM, XmATTACH_POSITION }; |
| 264 |
enum /* rowColumn types */ { XmWORK_AREA = 1, XmMENU_BAR }; |
| 265 |
enum /* delete responses */ { XmDESTROY = 1, XmUNMAP, XmDO_NOTHING }; |
| 266 |
enum /* indicator types */ { XmONE_OF_MANY = 1, XmN_OF_MANY }; |
| 267 |
|
| 268 |
/* |
| 269 |
* Declarations of Xm functions. |
| 270 |
*/ |
| 271 |
void XmAddWMProtocolCallback (GuiObject shell, Atom protocol, XtCallbackProc callback, char *closure); |
| 272 |
GuiObject XmCreateBulletinBoard (GuiObject, const char *, ArgList, int); |
| 273 |
GuiObject XmCreateBulletinBoardDialog (GuiObject, const char *, ArgList, int); |
| 274 |
GuiObject XmCreateCascadeButton (GuiObject, const char *, ArgList, int); |
| 275 |
GuiObject XmCreateCascadeButtonGadget (GuiObject, const char *, ArgList, int); |
| 276 |
GuiObject XmCreateDialogShell (GuiObject, const char *, ArgList, int); |
| 277 |
GuiObject XmCreateForm (GuiObject, const char *, ArgList, int); |
| 278 |
GuiObject XmCreateFormDialog (GuiObject, const char *, ArgList, int); |
| 279 |
GuiObject XmCreateMenuBar (GuiObject, const char *, ArgList, int); |
| 280 |
GuiObject XmCreatePulldownMenu (GuiObject, const char *, ArgList, int); |
| 281 |
GuiObject XmCreateRadioBox (GuiObject, const char *, ArgList, int); |
| 282 |
GuiObject XmCreateRowColumn (GuiObject, const char *, ArgList, int); |
| 283 |
GuiObject XmCreateScale (GuiObject, const char *, ArgList, int); |
| 284 |
GuiObject XmCreateScrolledWindow (GuiObject, const char *, ArgList, int); |
| 285 |
GuiObject XmCreateScrollBar (GuiObject, const char *, ArgList, int); |
| 286 |
GuiObject XmCreateSeparator (GuiObject, const char *, ArgList, int); |
| 287 |
GuiObject XmCreateSeparatorGadget (GuiObject, const char *, ArgList, int); |
| 288 |
GuiObject XmCreateShell (GuiObject, const char *, ArgList, int); |
| 289 |
GuiObject XmCreateToggleButton (GuiObject, const char *, ArgList, int); |
| 290 |
GuiObject XmCreateToggleButtonGadget (GuiObject, const char *, ArgList, int); |
| 291 |
void XmScaleGetValue (GuiObject widget, int *value_return); |
| 292 |
void XmScaleSetValue (GuiObject widget, int value); |
| 293 |
void XmScrollBarGetValues (GuiObject me, int *value, int *sliderSize, int *increment, int *pageIncrement); |
| 294 |
void XmScrollBarSetValues (GuiObject me, int value, int sliderSize, int increment, int pageIncrement, Boolean notify); |
| 295 |
Boolean XmToggleButtonGadgetGetState (GuiObject widget); |
| 296 |
#define XmToggleButtonGetState XmToggleButtonGadgetGetState |
| 297 |
void XmToggleButtonGadgetSetState (GuiObject widget, Boolean value, Boolean notify); |
| 298 |
#define XmToggleButtonSetState XmToggleButtonGadgetSetState |
| 299 |
|
| 300 |
void motif_win_setUserMessageCallback (int (*userMessageCallback) (void)); |
| 301 |
|
| 302 |
constexpr UINT WM_APP_WORK_PROC = WM_APP + 0x5C; // like "script" |
| 303 |
struct GuiWinWorkProcWrapper_base { |
| 304 |
virtual void run () = 0; |
| 305 |
virtual ~GuiWinWorkProcWrapper_base () { } |
| 306 |
}; |
| 307 |
template <typename F> |
| 308 |
struct GuiWinWorkProcWrapper_derived : GuiWinWorkProcWrapper_base { |
| 309 |
F function; |
| 310 |
GuiWinWorkProcWrapper_derived (F&& f): function (std::move (f)) { } |
| 311 |
void run () override { |
| 312 |
function (); |
| 313 |
} |
| 314 |
}; |
| 315 |
#else |
| 316 |
typedef void *GuiObject; |
| 317 |
#endif |
| 318 |
|
| 319 |
/* |
| 320 |
`Gui_addWorkProc` can post any lambda to be scheduled during an idle moment in the main event loop. |
| 321 |
|
| 322 |
Example of usage: |
| 323 |
autostring32 clickedText = ...; |
| 324 |
Gui_addWorkProc ( |
| 325 |
[clickedText = std::move (clickedText)] () mutable { // transfer ownership of clickedText to the lambda |
| 326 |
try { |
| 327 |
autoPraatBackground background; |
| 328 |
Interpreter_resume (thePauseForm_interpreterReference); |
| 329 |
} catch (MelderError) { |
| 330 |
if (thePauseForm_clicked == theCancelContinueButton) |
| 331 |
Melder_throw (U"This happened after you cancelled the pause form."); |
| 332 |
else |
| 333 |
Melder_throw (U"This happened after you clicked “", clickedText.get(), U"” in the pause form."); |
| 334 |
} |
| 335 |
} |
| 336 |
); |
| 337 |
*/ |
| 338 |
template <typename F> |
| 339 |
static void Gui_addWorkProc (F&& function) { |
| 340 |
#if gtk |
| 341 |
auto *functionOnTheHeap = new std::decay_t <F> (std::forward <F> (function)); |
| 342 |
g_idle_add ( |
| 343 |
[] (gpointer closure) -> gboolean { |
| 344 |
auto *functionOnTheHeapFromClosure = static_cast <std::decay_t <F>*> (closure); |
| 345 |
try { |
| 346 |
(*functionOnTheHeapFromClosure) (); |
| 347 |
} catch (MelderError) { |
| 348 |
Melder_flushError (); // no error message should leave the event loop |
| 349 |
} |
| 350 |
delete functionOnTheHeapFromClosure; // called even if there was an exception |
| 351 |
return G_SOURCE_REMOVE; |
| 352 |
}, |
| 353 |
functionOnTheHeap |
| 354 |
); |
| 355 |
#elif cocoa |
| 356 |
auto *functionOnTheHeap = new std::decay_t <F> (std::forward <F> (function)); |
| 357 |
CFRunLoopPerformBlock ( |
| 358 |
CFRunLoopGetMain (), |
| 359 |
kCFRunLoopCommonModes, |
| 360 |
^{ |
| 361 |
try { |
| 362 |
(*functionOnTheHeap) (); |
| 363 |
} catch (MelderError) { |
| 364 |
Melder_flushError (); // no error message should leave the event loop |
| 365 |
} |
| 366 |
delete functionOnTheHeap; // called even if there was an exception |
| 367 |
} |
| 368 |
); |
| 369 |
CFRunLoopWakeUp (CFRunLoopGetMain ()); |
| 370 |
#elif motif |
| 371 |
auto *functionWrapper = new GuiWinWorkProcWrapper_derived <F> (std::forward <F> (function)); |
| 372 |
PostMessage (HWND (nullptr), WM_APP_WORK_PROC, 0, reinterpret_cast <LPARAM> (functionWrapper)); |
| 373 |
#elif defined (NO_GUI) |
| 374 |
#else |
| 375 |
#error The function `Gui_addWorkProc`() is not implemented for this platform. |
| 376 |
#endif |
| 377 |
} |
| 378 |
|
| 379 |
int Gui_getResolution (GuiObject widget); |
| 380 |
void Gui_getWindowPositioningBounds (double *x, double *y, double *width, double *height); |
| 381 |
|
| 382 |
Thing_declare (GuiDrawingArea); |
| 383 |
Thing_declare (GuiForm); |
| 384 |
Thing_declare (GuiMenu); |
| 385 |
Thing_declare (GuiScrolledWindow); |
| 386 |
Thing_declare (GuiShell); |
| 387 |
Thing_declare (GuiWindow); |
| 388 |
|
| 389 |
Thing_define (GuiThing, Thing) { |
| 390 |
GuiShell d_shell; |
| 391 |
GuiThing d_parent; |
| 392 |
GuiObject d_widget; |
| 393 |
|
| 394 |
virtual void v_show (); |
| 395 |
virtual void v_hide (); |
| 396 |
virtual void v_setSensitive (bool sensitive); |
| 397 |
}; |
| 398 |
|
| 399 |
void GuiThing_show (GuiThing me); |
| 400 |
void GuiThing_hide (GuiThing me); |
| 401 |
void GuiThing_setSensitive (GuiThing me, bool sensitive); |
| 402 |
|
| 403 |
Thing_define (GuiControl, GuiThing) { |
| 404 |
int d_left, d_right, d_top, d_bottom; |
| 405 |
bool d_blockValueChangedCallbacks; |
| 406 |
|
| 407 |
virtual void v_positionInForm (GuiObject widget, int left, int right, int top, int bottom, GuiForm parent); |
| 408 |
virtual void v_positionInScrolledWindow (GuiObject widget, int width, int height, GuiScrolledWindow parent); |
| 409 |
}; |
| 410 |
|
| 411 |
int GuiControl_getX (GuiControl me); |
| 412 |
int GuiControl_getY (GuiControl me); |
| 413 |
int GuiControl_getWidth (GuiControl me); |
| 414 |
int GuiControl_getHeight (GuiControl me); |
| 415 |
void GuiControl_move (GuiControl me, int x, int y); |
| 416 |
void GuiControl_setSize (GuiControl me, int width, int height); |
| 417 |
|
| 418 |
Thing_define (GuiForm, GuiControl) { |
| 419 |
}; |
| 420 |
|
| 421 |
using GuiShell_GoAwayCallback = MelderCallback <void, structThing /* boss */>; |
| 422 |
|
| 423 |
Thing_define (GuiShell, GuiForm) { |
| 424 |
int d_width, d_height; |
| 425 |
#if gtk |
| 426 |
GtkWindow *d_gtkWindow; |
| 427 |
#if defined (chrome) |
| 428 |
GtkWidget *chrome_surrogateShellTitleLabelWidget; |
| 429 |
#endif |
| 430 |
#elif cocoa |
| 431 |
GuiCocoaShell *d_cocoaShell; |
| 432 |
#elif motif |
| 433 |
GuiObject d_xmShell; |
| 434 |
#endif |
| 435 |
GuiShell_GoAwayCallback d_goAwayCallback; |
| 436 |
Thing d_goAwayBoss; |
| 437 |
GuiDrawingArea drawingArea; |
| 438 |
|
| 439 |
void v9_destroy () noexcept |
| 440 |
override; |
| 441 |
}; |
| 442 |
|
| 443 |
int GuiShell_getShellWidth (GuiShell me); // needed because GuiControl_getWidth yields the width of the inner form |
| 444 |
int GuiShell_getShellHeight (GuiShell me); |
| 445 |
void GuiShell_setTitle (GuiShell me, conststring32 title /* cattable */); |
| 446 |
void GuiShell_drain (GuiShell me, bool waitUntilItHasHappened, bool allowOtherEvents); // force display of update regions (forces the handling of an expose event) |
| 447 |
|
| 448 |
/********** GuiButton **********/ |
| 449 |
|
| 450 |
Thing_declare (GuiButton); |
| 451 |
|
| 452 |
typedef struct structGuiButtonEvent { |
| 453 |
GuiButton button; |
| 454 |
bool shiftKeyPressed, commandKeyPressed, optionKeyPressed; |
| 455 |
} *GuiButtonEvent; |
| 456 |
|
| 457 |
using GuiButton_ActivateCallback = MelderCallback <void, structThing /* boss */, GuiButtonEvent>; |
| 458 |
|
| 459 |
Thing_define (GuiButton, GuiControl) { |
| 460 |
GuiButton_ActivateCallback d_activateCallback; |
| 461 |
Thing d_activateBoss; |
| 462 |
GuiMenu d_menu; // for cascade buttons |
| 463 |
integer d_sequentalIdInDialog; |
| 464 |
}; |
| 465 |
|
| 466 |
/* GuiButton creation flags: */ |
| 467 |
#define GuiButton_DEFAULT 1 |
| 468 |
#define GuiButton_CANCEL 2 |
| 469 |
#define GuiButton_INSENSITIVE 4 |
| 470 |
#define GuiButton_ATTRACTIVE 8 |
| 471 |
#define GuiButton_MULTILINE 16 |
| 472 |
GuiButton GuiButton_create (GuiForm parent, |
| 473 |
int left, int right, int top, int bottom, |
| 474 |
conststring32 text, |
| 475 |
GuiButton_ActivateCallback activateCallback, Thing boss, |
| 476 |
uint32 flags |
| 477 |
); |
| 478 |
GuiButton GuiButton_createShown (GuiForm parent, |
| 479 |
int left, int right, int top, int bottom, |
| 480 |
conststring32 text, |
| 481 |
GuiButton_ActivateCallback activateCallback, Thing boss, |
| 482 |
uint32 flags |
| 483 |
); |
| 484 |
|
| 485 |
void GuiButton_setText (GuiButton me, conststring32 text /* cattable */); |
| 486 |
|
| 487 |
/********** GuiCheckButton **********/ |
| 488 |
|
| 489 |
Thing_declare (GuiCheckButton); |
| 490 |
|
| 491 |
typedef struct structGuiCheckButtonEvent { |
| 492 |
GuiCheckButton toggle; |
| 493 |
} *GuiCheckButtonEvent; |
| 494 |
|
| 495 |
using GuiCheckButton_ValueChangedCallback = MelderCallback <void, structThing /* boss */, GuiCheckButtonEvent>; |
| 496 |
|
| 497 |
Thing_define (GuiCheckButton, GuiControl) { |
| 498 |
GuiCheckButton_ValueChangedCallback d_valueChangedCallback; |
| 499 |
Thing d_valueChangedBoss; |
| 500 |
}; |
| 501 |
|
| 502 |
/* GuiCheckButton creation flags: */ |
| 503 |
#define GuiCheckButton_SET 1 |
| 504 |
#define GuiCheckButton_INSENSITIVE 2 |
| 505 |
GuiCheckButton GuiCheckButton_create (GuiForm parent, |
| 506 |
int left, int right, int top, int bottom, |
| 507 |
conststring32 text, |
| 508 |
GuiCheckButton_ValueChangedCallback valueChangedCallback, Thing boss, |
| 509 |
uint32 flags |
| 510 |
); |
| 511 |
GuiCheckButton GuiCheckButton_createShown (GuiForm parent, |
| 512 |
int left, int right, int top, int bottom, |
| 513 |
conststring32 text, |
| 514 |
GuiCheckButton_ValueChangedCallback valueChangedCallback, Thing boss, |
| 515 |
uint32 flags |
| 516 |
); |
| 517 |
|
| 518 |
bool GuiCheckButton_getValue (GuiCheckButton me); |
| 519 |
void GuiCheckButton_setValue (GuiCheckButton me, bool value); |
| 520 |
|
| 521 |
/********** GuiDialog **********/ |
| 522 |
|
| 523 |
using GuiDialog_DefaultCallback = MelderCallback <void, structThing /* boss */>; |
| 524 |
|
| 525 |
Thing_define (GuiDialog, GuiShell) { |
| 526 |
GuiDialog_DefaultCallback d_defaultCallback; |
| 527 |
Thing d_defaultBoss; |
| 528 |
integer latestCreatedButtonId, clickedButtonId, defaultButtonId; // especially if the dialog is blocking |
| 529 |
GuiButton defaultButton; |
| 530 |
}; |
| 531 |
|
| 532 |
/* GuiDialog creation flags: */ |
| 533 |
enum class GuiDialog_Modality { MODELESS = 0, MODAL = 1, BLOCKING = 2 }; |
| 534 |
GuiDialog GuiDialog_create (GuiWindow parent, |
| 535 |
int x, int y, int width, int height, |
| 536 |
conststring32 title, |
| 537 |
GuiShell_GoAwayCallback goAwayCallback, Thing goAwayBoss, |
| 538 |
GuiDialog_Modality modality |
| 539 |
); |
| 540 |
|
| 541 |
void GuiDialog_setDefaultCallback (GuiDialog me, GuiDialog_DefaultCallback callback, Thing boss); |
| 542 |
|
| 543 |
integer GuiDialog_run (GuiDialog me); |
| 544 |
/* |
| 545 |
Only for blocking dialogs. |
| 546 |
Return value: |
| 547 |
- if she clicked a button (with text), the sequentual id of the clicked button (1, 2, 3...) is returned |
| 548 |
- if she clicked the Close button of the window, 0 is returned |
| 549 |
- if she typed Enter, and there was a default button, the sequentual id of the default button is returned |
| 550 |
- if she typed Enter and there was no default button, 0 is returned (i.e. this is the same as clicking the Close button) |
| 551 |
*/ |
| 552 |
|
| 553 |
/********** GuiDrawingArea **********/ |
| 554 |
|
| 555 |
Thing_declare (GuiDrawingArea); |
| 556 |
Thing_declare (GuiScrollBar); |
| 557 |
|
| 558 |
typedef struct structGuiDrawingArea_ExposeEvent { |
| 559 |
GuiDrawingArea widget; |
| 560 |
int x, y, width, height; |
| 561 |
} *GuiDrawingArea_ExposeEvent; |
| 562 |
|
| 563 |
typedef struct structGuiDrawingArea_MouseEvent { |
| 564 |
GuiDrawingArea widget; |
| 565 |
int x, y; |
| 566 |
enum class Phase { CLICK, DRAG, DROP } phase; |
| 567 |
bool isClick() const { return our phase == Phase::CLICK; } |
| 568 |
bool isDrag() const { return our phase == Phase::DRAG; } |
| 569 |
bool isDrop() const { return our phase == Phase::DROP; } |
| 570 |
bool shiftKeyPressed, commandKeyPressed, optionKeyPressed; |
| 571 |
bool isLeftBottomFunctionKeyPressed () const { |
| 572 |
return theCommandKeyIsToTheLeftOfTheOptionKey ? our commandKeyPressed : our optionKeyPressed; |
| 573 |
} |
| 574 |
bool isRightBottomFunctionKeyPressed () const { |
| 575 |
return theCommandKeyIsToTheLeftOfTheOptionKey ? our optionKeyPressed : our commandKeyPressed; |
| 576 |
} |
| 577 |
} *GuiDrawingArea_MouseEvent; |
| 578 |
|
| 579 |
typedef struct structGuiDrawingArea_KeyEvent { |
| 580 |
GuiDrawingArea widget; |
| 581 |
char32 key; |
| 582 |
bool shiftKeyPressed, commandKeyPressed, optionKeyPressed; |
| 583 |
} *GuiDrawingArea_KeyEvent; |
| 584 |
|
| 585 |
typedef struct structGuiDrawingArea_ResizeEvent { |
| 586 |
GuiDrawingArea widget; |
| 587 |
int width, height; |
| 588 |
} *GuiDrawingArea_ResizeEvent; |
| 589 |
|
| 590 |
typedef struct structGuiDrawingArea_ZoomEvent { |
| 591 |
GuiDrawingArea widget; |
| 592 |
double delta; // positive means enlarge (zoom in), negative means shrink (zoom out) |
| 593 |
} *GuiDrawingArea_ZoomEvent; |
| 594 |
|
| 595 |
using GuiDrawingArea_ExposeCallback = MelderCallback <void, structThing /* boss */, GuiDrawingArea_ExposeEvent>; |
| 596 |
using GuiDrawingArea_MouseCallback = MelderCallback <void, structThing /* boss */, GuiDrawingArea_MouseEvent >; |
| 597 |
using GuiDrawingArea_KeyCallback = MelderCallback <void, structThing /* boss */, GuiDrawingArea_KeyEvent >; |
| 598 |
using GuiDrawingArea_ResizeCallback = MelderCallback <void, structThing /* boss */, GuiDrawingArea_ResizeEvent>; |
| 599 |
using GuiDrawingArea_ZoomCallback = MelderCallback <void, structThing /* boss */, GuiDrawingArea_ZoomEvent >; |
| 600 |
|
| 601 |
Thing_define (GuiDrawingArea, GuiControl) { |
| 602 |
GuiScrollBar d_horizontalScrollBar, d_verticalScrollBar; // for swiping |
| 603 |
GuiDrawingArea_ExposeCallback d_exposeCallback; |
| 604 |
Thing d_exposeBoss; |
| 605 |
GuiDrawingArea_MouseCallback mouseCallback; |
| 606 |
Thing mouseBoss; |
| 607 |
GuiDrawingArea_KeyCallback d_keyCallback; |
| 608 |
Thing d_keyBoss; |
| 609 |
GuiDrawingArea_ResizeCallback d_resizeCallback; |
| 610 |
Thing d_resizeBoss; |
| 611 |
GuiDrawingArea_ZoomCallback d_zoomCallback; |
| 612 |
Thing d_zoomBoss; |
| 613 |
integer numberOfGraphicses; |
| 614 |
constexpr static integer MAXIMUM_NUMBER_OF_GRAPHICSES = 10; |
| 615 |
Graphics graphicses [1+MAXIMUM_NUMBER_OF_GRAPHICSES]; |
| 616 |
|
| 617 |
void v9_destroy () noexcept |
| 618 |
override; |
| 619 |
}; |
| 620 |
|
| 621 |
/* GuiDrawingArea creation flags: */ |
| 622 |
#define GuiDrawingArea_BORDER 1 |
| 623 |
GuiDrawingArea GuiDrawingArea_create (GuiForm parent, int left, int right, int top, int bottom, |
| 624 |
GuiDrawingArea_ExposeCallback exposeCallback, |
| 625 |
GuiDrawingArea_MouseCallback mouseCallback, |
| 626 |
GuiDrawingArea_KeyCallback keyCallback, |
| 627 |
GuiDrawingArea_ResizeCallback resizeCallback, |
| 628 |
GuiDrawingArea_ZoomCallback zoomCallback, Thing boss, |
| 629 |
uint32 flags); |
| 630 |
GuiDrawingArea GuiDrawingArea_createShown (GuiForm parent, int left, int right, int top, int bottom, |
| 631 |
GuiDrawingArea_ExposeCallback exposeCallback, |
| 632 |
GuiDrawingArea_MouseCallback mouseCallback, |
| 633 |
GuiDrawingArea_KeyCallback keyCallback, |
| 634 |
GuiDrawingArea_ResizeCallback resizeCallback, |
| 635 |
GuiDrawingArea_ZoomCallback zoomCallback, Thing boss, |
| 636 |
uint32 flags); |
| 637 |
GuiDrawingArea GuiDrawingArea_create (GuiScrolledWindow parent, int width, int height, |
| 638 |
GuiDrawingArea_ExposeCallback exposeCallback, |
| 639 |
GuiDrawingArea_MouseCallback mouseCallback, |
| 640 |
GuiDrawingArea_KeyCallback keyCallback, |
| 641 |
GuiDrawingArea_ResizeCallback resizeCallback, |
| 642 |
GuiDrawingArea_ZoomCallback zoomCallback, Thing boss, |
| 643 |
uint32 flags); |
| 644 |
GuiDrawingArea GuiDrawingArea_createShown (GuiScrolledWindow parent, int width, int height, |
| 645 |
GuiDrawingArea_ExposeCallback exposeCallback, |
| 646 |
GuiDrawingArea_MouseCallback mouseCallback, |
| 647 |
GuiDrawingArea_KeyCallback keyCallback, |
| 648 |
GuiDrawingArea_ResizeCallback resizeCallback, |
| 649 |
GuiDrawingArea_ZoomCallback zoomCallback, Thing boss, |
| 650 |
uint32 flags); |
| 651 |
|
| 652 |
void GuiDrawingArea_setSwipable (GuiDrawingArea me, GuiScrollBar horizontalScrollBar, GuiScrollBar verticalScrollBar); |
| 653 |
void GuiDrawingArea_setExposeCallback (GuiDrawingArea me, GuiDrawingArea_ExposeCallback callback, Thing boss); |
| 654 |
void GuiDrawingArea_setMouseCallback (GuiDrawingArea me, GuiDrawingArea_MouseCallback callback, Thing boss); |
| 655 |
void GuiDrawingArea_setResizeCallback (GuiDrawingArea me, GuiDrawingArea_ResizeCallback callback, Thing boss); |
| 656 |
void GuiDrawingArea_setZoomCallback (GuiDrawingArea me, GuiDrawingArea_ZoomCallback callback, Thing boss); |
| 657 |
|
| 658 |
/********** GuiFileSelect **********/ |
| 659 |
|
| 660 |
autoStringSet GuiFileSelect_getInfileNames (GuiWindow optionalParent, conststring32 title, bool allowMultipleFiles); |
| 661 |
autostring32 GuiFileSelect_getOutfileName (GuiWindow optionalParent, conststring32 title, conststring32 defaultName); |
| 662 |
autostring32 GuiFileSelect_getFolderName (GuiWindow optionalParent, conststring32 title); |
| 663 |
|
| 664 |
/********** GuiForm **********/ |
| 665 |
|
| 666 |
GuiForm GuiForm_createInScrolledWindow (GuiScrolledWindow parent); |
| 667 |
|
| 668 |
/********** GuiLabel **********/ |
| 669 |
|
| 670 |
//Thing_declare (GuiLabel); |
| 671 |
|
| 672 |
Thing_define (GuiLabel, GuiControl) { |
| 673 |
}; |
| 674 |
|
| 675 |
/* GuiLabel creation flags: */ |
| 676 |
#define GuiLabel_CENTRE 1 |
| 677 |
#define GuiLabel_RIGHT 2 |
| 678 |
#define GuiLabel_BOLD 4 |
| 679 |
#define GuiLabel_MULTILINE 8 |
| 680 |
GuiLabel GuiLabel_create (GuiForm parent, int left, int right, int top, int bottom, |
| 681 |
conststring32 text, uint32 flags); |
| 682 |
GuiLabel GuiLabel_createShown (GuiForm parent, int left, int right, int top, int bottom, |
| 683 |
conststring32 text, uint32 flags); |
| 684 |
|
| 685 |
void GuiLabel_setText (GuiLabel me, conststring32 text /* cattable */); |
| 686 |
|
| 687 |
/********** GuiList **********/ |
| 688 |
|
| 689 |
Thing_declare (GuiList); |
| 690 |
Thing_declare (GuiScrolledWindow); |
| 691 |
|
| 692 |
typedef struct structGuiList_SelectionChangedEvent { |
| 693 |
GuiList list; |
| 694 |
} *GuiList_SelectionChangedEvent; |
| 695 |
using GuiList_SelectionChangedCallback = MelderCallback <void, structThing /* boss */, GuiList_SelectionChangedEvent>; |
| 696 |
|
| 697 |
typedef struct structGuiList_DoubleClickEvent { |
| 698 |
GuiList list; |
| 699 |
} *GuiList_DoubleClickEvent; |
| 700 |
using GuiList_DoubleClickCallback = MelderCallback <void, structThing /* boss */, GuiList_DoubleClickEvent>; |
| 701 |
|
| 702 |
typedef struct structGuiList_ScrollEvent { |
| 703 |
GuiList list; |
| 704 |
} *GuiList_ScrollEvent; |
| 705 |
using GuiList_ScrollCallback = MelderCallback <void, structThing /* boss */, GuiList_ScrollEvent>; |
| 706 |
|
| 707 |
Thing_define (GuiList, GuiControl) { |
| 708 |
bool d_allowMultipleSelection; |
| 709 |
GuiList_SelectionChangedCallback d_selectionChangedCallback; |
| 710 |
Thing d_selectionChangedBoss; |
| 711 |
GuiList_DoubleClickCallback d_doubleClickCallback; |
| 712 |
Thing d_doubleClickBoss; |
| 713 |
GuiList_ScrollCallback d_scrollCallback; |
| 714 |
Thing d_scrollBoss; |
| 715 |
#if gtk |
| 716 |
GtkListStore *d_liststore; |
| 717 |
#endif |
| 718 |
}; |
| 719 |
|
| 720 |
GuiList GuiList_create (GuiForm parent, int left, int right, int top, int bottom, bool allowMultipleSelection, conststring32 header); |
| 721 |
GuiList GuiList_createShown (GuiForm parent, int left, int right, int top, int bottom, bool allowMultipleSelection, conststring32 header); |
| 722 |
|
| 723 |
void GuiList_deleteAllItems (GuiList me); |
| 724 |
void GuiList_deleteItem (GuiList me, integer position); |
| 725 |
void GuiList_deselectAllItems (GuiList me); |
| 726 |
void GuiList_deselectItem (GuiList me, integer position); |
| 727 |
integer GuiList_getBottomPosition (GuiList me); |
| 728 |
integer GuiList_getNumberOfItems (GuiList me); |
| 729 |
autoINTVEC GuiList_getSelectedPositions (GuiList me); |
| 730 |
integer GuiList_getTopPosition (GuiList me); |
| 731 |
|
| 732 |
/** |
| 733 |
Inserts a new item into a GuiList at a given position. |
| 734 |
@param me |
| 735 |
The GuiList into which the new item is inserted. |
| 736 |
@param itemText |
| 737 |
The text of the new item. Cattable. |
| 738 |
@param position |
| 739 |
The position of the new item in the list after insertion. |
| 740 |
A value of 1 therefore puts the new item at the top of the list. |
| 741 |
A value of 0 is special: the item is put at the bottom of the list. |
| 742 |
*/ |
| 743 |
void GuiList_insertItem (GuiList me, conststring32 itemText /* cattable */, integer position); |
| 744 |
|
| 745 |
void GuiList_replaceItem (GuiList me, conststring32 itemText /* cattable */, integer position); |
| 746 |
void GuiList_setTopPosition (GuiList me, integer topPosition); |
| 747 |
void GuiList_selectItem (GuiList me, integer position); |
| 748 |
void GuiList_setSelectionChangedCallback (GuiList me, GuiList_SelectionChangedCallback callback, Thing boss); |
| 749 |
void GuiList_setDoubleClickCallback (GuiList me, GuiList_DoubleClickCallback callback, Thing boss); |
| 750 |
void GuiList_setScrollCallback (GuiList me, GuiList_ScrollCallback callback, Thing boss); |
| 751 |
|
| 752 |
/********** GuiMenu **********/ |
| 753 |
|
| 754 |
Thing_declare (GuiMenuItem); |
| 755 |
|
| 756 |
Thing_define (GuiMenu, GuiThing) { |
| 757 |
autoGuiMenuItem d_menuItem; |
| 758 |
autoGuiButton d_cascadeButton; |
| 759 |
#if gtk |
| 760 |
GtkMenuItem *d_gtkMenuTitle; |
| 761 |
#elif cocoa |
| 762 |
GuiCocoaMenu *d_cocoaMenu; |
| 763 |
GuiCocoaMenuItem *d_cocoaMenuItem; |
| 764 |
GuiCocoaMenuButton *d_cocoaMenuButton; |
| 765 |
#elif motif |
| 766 |
GuiObject d_xmMenuTitle; // in case the menu is in a menu bar |
| 767 |
GuiObject d_xmMenuBar; // in case the menu is in a form |
| 768 |
#endif |
| 769 |
|
| 770 |
void v_show () |
| 771 |
override; |
| 772 |
void v_hide () |
| 773 |
override; |
| 774 |
void v_setSensitive (bool sensitive) |
| 775 |
override; |
| 776 |
}; |
| 777 |
|
| 778 |
GuiMenu GuiMenu_createInWindow (GuiWindow window, conststring32 title, uint32 flags); |
| 779 |
GuiMenu GuiMenu_createInMenu (GuiMenu supermenu, conststring32 title, uint32 flags); |
| 780 |
GuiMenu GuiMenu_createInForm (GuiForm form, int left, int right, int top, int bottom, conststring32 title, uint32 flags); |
| 781 |
|
| 782 |
void GuiMenu_empty (GuiMenu me); |
| 783 |
|
| 784 |
/********** GuiMenuItem **********/ |
| 785 |
|
| 786 |
Thing_declare (GuiMenuItem); |
| 787 |
|
| 788 |
typedef struct structGuiMenuItemEvent { |
| 789 |
GuiMenuItem menuItem; |
| 790 |
bool shiftKeyPressed, commandKeyPressed, optionKeyPressed; |
| 791 |
} *GuiMenuItemEvent; |
| 792 |
|
| 793 |
using GuiMenuItemCallback = MelderCallback <void, structThing /* boss */, GuiMenuItemEvent>; |
| 794 |
|
| 795 |
#if cocoa |
| 796 |
extern GuiMenuItemCallback theGuiEscapeMenuItemCallback; |
| 797 |
extern Thing theGuiEscapeMenuItemBoss; |
| 798 |
#endif |
| 799 |
|
| 800 |
Thing_define (GuiMenuItem, GuiThing) { |
| 801 |
GuiMenu d_menu; |
| 802 |
GuiMenuItemCallback d_callback; |
| 803 |
Thing d_boss; |
| 804 |
#if gtk |
| 805 |
bool d_callbackBlocked; |
| 806 |
#endif |
| 807 |
}; |
| 808 |
|
| 809 |
/* Accelerators understood by GuiMenuItem: */ |
| 810 |
#define GuiMenu_OPTION (1 << 24) |
| 811 |
#define GuiMenu_SHIFT (1 << 25) |
| 812 |
#define GuiMenu_COMMAND (1 << 26) |
| 813 |
#if cocoa |
| 814 |
#define GuiMenu_COMMAND_EXTRA (GuiMenu_OPTION | GuiMenu_COMMAND) /* standard on the Mac (where the keys are next to each other) */ |
| 815 |
#else |
| 816 |
#define GuiMenu_COMMAND_EXTRA (GuiMenu_SHIFT | GuiMenu_COMMAND) /* standard on Windows (where the keys are next to each other, *and* Ctrl-Alt can mean Alt-GR) */ |
| 817 |
#endif |
| 818 |
// 1 is the short form of GuiMenu_DEPTH_1 |
| 819 |
// 2 is the short form of GuiMenu_DEPTH_2 |
| 820 |
// 3 is the short form of GuiMenu_DEPTH_3 |
| 821 |
#define GuiMenu_LEFT_ARROW 4 |
| 822 |
#define GuiMenu_RIGHT_ARROW 5 |
| 823 |
#define GuiMenu_UP_ARROW 6 |
| 824 |
#define GuiMenu_DOWN_ARROW 7 |
| 825 |
#define GuiMenu_PAUSE 8 |
| 826 |
#define GuiMenu_DELETE 9 |
| 827 |
#define GuiMenu_INSERT 10 |
| 828 |
#define GuiMenu_BACKSPACE 11 |
| 829 |
#define GuiMenu_TAB 12 |
| 830 |
#define GuiMenu_LINEFEED 13 |
| 831 |
#define GuiMenu_HOME 14 |
| 832 |
#define GuiMenu_END 15 |
| 833 |
#define GuiMenu_ENTER 16 |
| 834 |
#define GuiMenu_PAGE_UP 17 |
| 835 |
#define GuiMenu_PAGE_DOWN 18 |
| 836 |
#define GuiMenu_ESCAPE 19 |
| 837 |
#define GuiMenu_F1 20 |
| 838 |
#define GuiMenu_F2 21 |
| 839 |
#define GuiMenu_F3 22 |
| 840 |
#define GuiMenu_F4 23 |
| 841 |
#define GuiMenu_F5 24 |
| 842 |
#define GuiMenu_F6 25 |
| 843 |
#define GuiMenu_F7 26 |
| 844 |
#define GuiMenu_F8 27 |
| 845 |
#define GuiMenu_F9 28 |
| 846 |
#define GuiMenu_F10 29 |
| 847 |
#define GuiMenu_F11 30 |
| 848 |
#define GuiMenu_F12 31 |
| 849 |
// or any ASCII character (preferably a letter or digit) between 32 and 126 |
| 850 |
|
| 851 |
/* Button layout and state understood by GuiMenuItem: */ |
| 852 |
#define GuiMenu_INSENSITIVE (1 << 8) |
| 853 |
#define GuiMenu_CHECKBUTTON (1 << 9) |
| 854 |
#define GuiMenu_TOGGLE_ON (1 << 10) |
| 855 |
#define GuiMenu_ATTRACTIVE (1 << 11) |
| 856 |
#define GuiMenu_UNDERLINED (1 << 12) |
| 857 |
#define GuiMenu_RADIO_FIRST (1 << 13) |
| 858 |
#define GuiMenu_RADIO_NEXT (1 << 14) |
| 859 |
#define GuiMenu_BUTTON_STATE_MASK (GuiMenu_INSENSITIVE|GuiMenu_CHECKBUTTON|GuiMenu_TOGGLE_ON|GuiMenu_ATTRACTIVE|GuiMenu_UNDERLINED|GuiMenu_RADIO_FIRST|GuiMenu_RADIO_NEXT) |
| 860 |
|
| 861 |
/* These are ingored by GuiMenu_addItem, but can be used by higher-level command logic: */ |
| 862 |
#define GuiMenu_DEPTH_1 0x0001'0000 /* 1<<16 */ |
| 863 |
#define GuiMenu_DEPTH_2 0x0002'0000 /* 1<<17 */ |
| 864 |
#define GuiMenu_DEPTH_3 0x0003'0000 |
| 865 |
#define GuiMenu_DEPTH_4 0x0004'0000 /* 1<<18 */ |
| 866 |
#define GuiMenu_DEPTH_5 0x0005'0000 |
| 867 |
#define GuiMenu_DEPTH_6 0x0006'0000 |
| 868 |
#define GuiMenu_DEPTH_7 0x0007'0000 |
| 869 |
#define GuiMenu_HIDDEN 0x0008'0000 /* 1<<19 */ |
| 870 |
#define GuiMenu_UNHIDABLE 0x0010'0000 /* 1<<20 */ |
| 871 |
#define GuiMenu_NO_API 0x0020'0000 /* 1<<21 */ |
| 872 |
#define GuiMenu_FORCE_API 0x0040'0000 /* 1<<22 */ |
| 873 |
#define GuiMenu_DEPRECATED (0x0080'0000 /* 1<<23 */ | GuiMenu_HIDDEN) |
| 874 |
#define GuiMenu_DEPRECATED_2004 (0x0400'0000 | GuiMenu_DEPRECATED) |
| 875 |
#define GuiMenu_DEPRECATED_2005 (0x0500'0000 | GuiMenu_DEPRECATED) |
| 876 |
#define GuiMenu_DEPRECATED_2006 (0x0600'0000 | GuiMenu_DEPRECATED) |
| 877 |
#define GuiMenu_DEPRECATED_2007 (0x0700'0000 | GuiMenu_DEPRECATED) |
| 878 |
#define GuiMenu_DEPRECATED_2008 (0x0800'0000 | GuiMenu_DEPRECATED) |
| 879 |
#define GuiMenu_DEPRECATED_2009 (0x0900'0000 | GuiMenu_DEPRECATED) |
| 880 |
#define GuiMenu_DEPRECATED_2010 (0x0A00'0000 | GuiMenu_DEPRECATED) |
| 881 |
#define GuiMenu_DEPRECATED_2011 (0x0B00'0000 | GuiMenu_DEPRECATED) |
| 882 |
#define GuiMenu_DEPRECATED_2012 (0x0C00'0000 | GuiMenu_DEPRECATED) |
| 883 |
#define GuiMenu_DEPRECATED_2013 (0x0D00'0000 | GuiMenu_DEPRECATED) |
| 884 |
#define GuiMenu_DEPRECATED_2014 (0x0E00'0000 | GuiMenu_DEPRECATED) |
| 885 |
#define GuiMenu_DEPRECATED_2015 (0x0F00'0000 | GuiMenu_DEPRECATED) |
| 886 |
#define GuiMenu_DEPRECATED_2016 (0x1000'0000 | GuiMenu_DEPRECATED) |
| 887 |
#define GuiMenu_DEPRECATED_2017 (0x1100'0000 | GuiMenu_DEPRECATED) |
| 888 |
#define GuiMenu_DEPRECATED_2018 (0x1200'0000 | GuiMenu_DEPRECATED) |
| 889 |
#define GuiMenu_DEPRECATED_2019 (0x1300'0000 | GuiMenu_DEPRECATED) |
| 890 |
#define GuiMenu_DEPRECATED_2020 (0x1400'0000 | GuiMenu_DEPRECATED) |
| 891 |
#define GuiMenu_DEPRECATED_2021 (0x1500'0000 | GuiMenu_DEPRECATED) |
| 892 |
#define GuiMenu_DEPRECATED_2022 (0x1600'0000 | GuiMenu_DEPRECATED) |
| 893 |
#define GuiMenu_DEPRECATED_2023 (0x1700'0000 | GuiMenu_DEPRECATED) |
| 894 |
#define GuiMenu_DEPRECATED_2024 (0x1800'0000 | GuiMenu_DEPRECATED) |
| 895 |
#define GuiMenu_DEPRECATED_2025 (0x1900'0000 | GuiMenu_DEPRECATED) |
| 896 |
#define GuiMenu_DEPRECATED_2026 (0x1A00'0000 | GuiMenu_DEPRECATED) |
| 897 |
#define GuiMenu_DEPRECATED_2027 (0x1B00'0000 | GuiMenu_DEPRECATED) |
| 898 |
#define GuiMenu_DEPRECATED_2028 (0x1C00'0000 | GuiMenu_DEPRECATED) |
| 899 |
#define GuiMenu_DEPRECATED_2029 (0x1D00'0000 | GuiMenu_DEPRECATED) |
| 900 |
#define GuiMenu_DEPRECATED_2030 (0x1E00'0000 | GuiMenu_DEPRECATED) |
| 901 |
#define GuiMenu_DEPRECATED_2031 (0x1F00'0000 | GuiMenu_DEPRECATED) |
| 902 |
#define GuiMenu_DEPRECATED_2032 (0x2000'0000 | GuiMenu_DEPRECATED) |
| 903 |
#define GuiMenu_DEPRECATED_2033 (0x2100'0000 | GuiMenu_DEPRECATED) |
| 904 |
#define GuiMenu_DEPRECATED_2034 (0x2200'0000 | GuiMenu_DEPRECATED) |
| 905 |
#define GuiMenu_DEPRECATED_2035 (0x2300'0000 | GuiMenu_DEPRECATED) |
| 906 |
#define GuiMenu_DEPRECATED_2036 (0x2400'0000 | GuiMenu_DEPRECATED) |
| 907 |
#define GuiMenu_DEPRECATED_2037 (0x2500'0000 | GuiMenu_DEPRECATED) |
| 908 |
#define GuiMenu_DEPRECATED_2038 (0x2600'0000 | GuiMenu_DEPRECATED) |
| 909 |
#define GuiMenu_DEPRECATED_2039 (0x2700'0000 | GuiMenu_DEPRECATED) |
| 910 |
#define GuiMenu_DEPRECATED_2040 (0x2800'0000 | GuiMenu_DEPRECATED) |
| 911 |
#define GuiMenu_DEPRECATED_2041 (0x2900'0000 | GuiMenu_DEPRECATED) |
| 912 |
#define GuiMenu_DEPRECATED_2042 (0x2A00'0000 | GuiMenu_DEPRECATED) |
| 913 |
#define GuiMenu_DEPRECATED_2043 (0x2B00'0000 | GuiMenu_DEPRECATED) |
| 914 |
#define GuiMenu_DEPRECATED_2044 (0x2C00'0000 | GuiMenu_DEPRECATED) |
| 915 |
#define GuiMenu_DEPRECATED_2045 (0x2D00'0000 | GuiMenu_DEPRECATED) |
| 916 |
#define GuiMenu_DEPRECATED_2046 (0x2E00'0000 | GuiMenu_DEPRECATED) |
| 917 |
#define GuiMenu_DEPRECATED_2047 (0x2F00'0000 | GuiMenu_DEPRECATED) |
| 918 |
#define GuiMenu_DEPRECATED_2048 (0x3000'0000 | GuiMenu_DEPRECATED) |
| 919 |
#define GuiMenu_DEPRECATED_2049 (0x3100'0000 | GuiMenu_DEPRECATED) |
| 920 |
#define GuiMenu_DEPRECATED_2050 (0x3200'0000 | GuiMenu_DEPRECATED) |
| 921 |
#define GuiMenu_DEPRECATED_2051 (0x3300'0000 | GuiMenu_DEPRECATED) |
| 922 |
#define GuiMenu_DEPRECATED_2052 (0x3400'0000 | GuiMenu_DEPRECATED) |
| 923 |
#define GuiMenu_DEPRECATED_2053 (0x3500'0000 | GuiMenu_DEPRECATED) |
| 924 |
#define GuiMenu_DEPRECATED_2054 (0x3600'0000 | GuiMenu_DEPRECATED) |
| 925 |
#define GuiMenu_DEPRECATED_2055 (0x3700'0000 | GuiMenu_DEPRECATED) |
| 926 |
#define GuiMenu_DEPRECATED_2056 (0x3800'0000 | GuiMenu_DEPRECATED) |
| 927 |
#define GuiMenu_DEPRECATED_2057 (0x3900'0000 | GuiMenu_DEPRECATED) |
| 928 |
#define GuiMenu_DEPRECATED_2058 (0x3A00'0000 | GuiMenu_DEPRECATED) |
| 929 |
#define GuiMenu_DEPRECATED_2059 (0x3B00'0000 | GuiMenu_DEPRECATED) |
| 930 |
#define GuiMenu_DEPRECATED_2060 (0x3C00'0000 | GuiMenu_DEPRECATED) |
| 931 |
#define GuiMenu_DEPRECATED_2061 (0x3D00'0000 | GuiMenu_DEPRECATED) |
| 932 |
#define GuiMenu_DEPRECATED_2062 (0x3E00'0000 | GuiMenu_DEPRECATED) |
| 933 |
#define GuiMenu_DEPRECATED_2063 (0x3F00'0000 | GuiMenu_DEPRECATED) |
| 934 |
#define GuiMenu_DEPRECATED_2064 (0x4000'0000 | GuiMenu_DEPRECATED) |
| 935 |
#define GuiMenu_DEPRECATED_2065 (0x4100'0000 | GuiMenu_DEPRECATED) |
| 936 |
#define GuiMenu_DEPRECATED_2066 (0x4200'0000 | GuiMenu_DEPRECATED) |
| 937 |
|
| 938 |
GuiMenuItem GuiMenu_addItem (GuiMenu menu, conststring32 title, uint32 flags, |
| 939 |
GuiMenuItemCallback callback, Thing boss); |
| 940 |
/* Flags is a combination of the above defines (both layout and accelerators). */ |
| 941 |
GuiMenuItem GuiMenu_addSeparator (GuiMenu menu); |
| 942 |
|
| 943 |
void GuiMenuItem_check (GuiMenuItem me, bool check); |
| 944 |
void GuiMenuItem_setText (GuiMenuItem me, conststring32 text); |
| 945 |
|
| 946 |
/********** GuiOptionMenu **********/ |
| 947 |
|
| 948 |
Thing_define (GuiOptionMenu, GuiControl) { |
| 949 |
int d_value; |
| 950 |
OrderedOf<structGuiMenuItem> d_options; |
| 951 |
#if gtk |
| 952 |
//GtkComboBox *d_gtkCascadeButton; |
| 953 |
#elif cocoa |
| 954 |
#elif motif |
| 955 |
GuiObject d_xmMenuBar, d_xmCascadeButton; |
| 956 |
#endif |
| 957 |
|
| 958 |
void v_show () |
| 959 |
override; |
| 960 |
}; |
| 961 |
|
| 962 |
void GuiOptionMenu_init (GuiOptionMenu me, GuiForm parent, int left, int right, int top, int bottom, uint32 flags); |
| 963 |
GuiOptionMenu GuiOptionMenu_create (GuiForm parent, int left, int right, int top, int bottom, uint32 flags); |
| 964 |
GuiOptionMenu GuiOptionMenu_createShown (GuiForm parent, int left, int right, int top, int bottom, uint32 flags); |
| 965 |
|
| 966 |
void GuiOptionMenu_addOption (GuiOptionMenu me, conststring32 text); |
| 967 |
int GuiOptionMenu_getValue (GuiOptionMenu me); |
| 968 |
void GuiOptionMenu_setValue (GuiOptionMenu me, int value); |
| 969 |
|
| 970 |
/********** GuiProgressBar **********/ |
| 971 |
|
| 972 |
Thing_declare (GuiProgressBar); |
| 973 |
|
| 974 |
Thing_define (GuiProgressBar, GuiControl) { |
| 975 |
#if cocoa |
| 976 |
GuiCocoaProgressBar *d_cocoaProgressBar; |
| 977 |
#endif |
| 978 |
}; |
| 979 |
|
| 980 |
GuiProgressBar GuiProgressBar_create (GuiForm parent, int left, int right, int top, int bottom, uint32 flags); |
| 981 |
GuiProgressBar GuiProgressBar_createShown (GuiForm parent, int left, int right, int top, int bottom, uint32 flags); |
| 982 |
|
| 983 |
void GuiProgressBar_setValue (GuiProgressBar me, double value); // between 0.0 and 1.0 |
| 984 |
|
| 985 |
/********** GuiRadioButton **********/ |
| 986 |
|
| 987 |
Thing_declare (GuiRadioButton); |
| 988 |
|
| 989 |
typedef struct structGuiRadioButtonEvent { |
| 990 |
GuiRadioButton toggle; |
| 991 |
int position; |
| 992 |
} *GuiRadioButtonEvent; |
| 993 |
|
| 994 |
using GuiRadioButtonCallback = MelderCallback <void, structThing /* boss */, GuiRadioButtonEvent>; |
| 995 |
|
| 996 |
Thing_define (GuiRadioButton, GuiControl) { |
| 997 |
GuiRadioButton d_previous, d_next; // there's a linked list of grouped radio buttons |
| 998 |
GuiRadioButtonCallback d_valueChangedCallback; |
| 999 |
Thing d_valueChangedBoss; |
| 1000 |
#if cocoa |
| 1001 |
GuiCocoaRadioButton *d_cocoaRadioButton; |
| 1002 |
#endif |
| 1003 |
}; |
| 1004 |
|
| 1005 |
/* GuiRadioButton creation flags: */ |
| 1006 |
#define GuiRadioButton_SET 1 |
| 1007 |
#define GuiRadioButton_INSENSITIVE 2 |
| 1008 |
GuiRadioButton GuiRadioButton_create (GuiForm parent, int left, int right, int top, int bottom, |
| 1009 |
conststring32 buttonText, GuiRadioButtonCallback valueChangedCallback, Thing valueChangedBoss, uint32 flags); |
| 1010 |
GuiRadioButton GuiRadioButton_createShown (GuiForm parent, int left, int right, int top, int bottom, |
| 1011 |
conststring32 buttonText, GuiRadioButtonCallback valueChangedCallback, Thing valueChangedBoss, uint32 flags); |
| 1012 |
|
| 1013 |
void GuiRadioGroup_begin (); |
| 1014 |
void GuiRadioGroup_end (); |
| 1015 |
|
| 1016 |
bool GuiRadioButton_getValue (GuiRadioButton me); |
| 1017 |
void GuiRadioButton_set (GuiRadioButton me); |
| 1018 |
|
| 1019 |
/********** GuiScale **********/ |
| 1020 |
|
| 1021 |
Thing_declare (GuiScale); |
| 1022 |
|
| 1023 |
Thing_define (GuiScale, GuiControl) { public: |
| 1024 |
#if cocoa |
| 1025 |
GuiCocoaScale *d_cocoaScale; |
| 1026 |
#endif |
| 1027 |
}; |
| 1028 |
|
| 1029 |
GuiScale GuiScale_create (GuiForm parent, int left, int right, int top, int bottom, |
| 1030 |
int minimum, int maximum, int value, uint32 flags); |
| 1031 |
GuiScale GuiScale_createShown (GuiForm parent, int left, int right, int top, int bottom, |
| 1032 |
int minimum, int maximum, int value, uint32 flags); |
| 1033 |
|
| 1034 |
int GuiScale_getValue (GuiScale me); |
| 1035 |
void GuiScale_setValue (GuiScale me, int value); |
| 1036 |
|
| 1037 |
/********** GuiScrollBar **********/ |
| 1038 |
|
| 1039 |
Thing_declare (GuiScrollBar); |
| 1040 |
|
| 1041 |
typedef struct structGuiScrollBarEvent { |
| 1042 |
GuiScrollBar scrollBar; |
| 1043 |
} *GuiScrollBarEvent; |
| 1044 |
|
| 1045 |
using GuiScrollBarCallback = MelderCallback <void, structThing /* boss */, GuiScrollBarEvent>; |
| 1046 |
|
| 1047 |
Thing_define (GuiScrollBar, GuiControl) { |
| 1048 |
GuiScrollBarCallback d_valueChangedCallback; |
| 1049 |
Thing d_valueChangedBoss; |
| 1050 |
}; |
| 1051 |
|
| 1052 |
/* GuiScrollBar creation flags: */ |
| 1053 |
#define GuiScrollBar_HORIZONTAL 1 |
| 1054 |
GuiScrollBar GuiScrollBar_create (GuiForm parent, int left, int right, int top, int bottom, |
| 1055 |
double minimum, double maximum, double value, double sliderSize, double increment, double pageIncrement, |
| 1056 |
GuiScrollBarCallback valueChangedCallback, Thing valueChangedBoss, uint32 flags); |
| 1057 |
GuiScrollBar GuiScrollBar_createShown (GuiForm parent, int left, int right, int top, int bottom, |
| 1058 |
double minimum, double maximum, double value, double sliderSize, double increment, double pageIncrement, |
| 1059 |
GuiScrollBarCallback valueChangedCallback, Thing valueChangedBoss, uint32 flags); |
| 1060 |
|
| 1061 |
double GuiScrollBar_getValue (GuiScrollBar me); |
| 1062 |
double GuiScrollBar_getSliderSize (GuiScrollBar me); |
| 1063 |
void GuiScrollBar_set (GuiScrollBar me, double minimum, double maximum, double value, |
| 1064 |
double sliderSize, double increment, double pageIncrement); |
| 1065 |
|
| 1066 |
/********** GuiScrolledWindow **********/ |
| 1067 |
|
| 1068 |
Thing_declare (GuiScrolledWindow); |
| 1069 |
|
| 1070 |
Thing_define (GuiScrolledWindow, GuiControl) { public: |
| 1071 |
}; |
| 1072 |
|
| 1073 |
GuiScrolledWindow GuiScrolledWindow_create (GuiForm parent, int left, int right, int top, int bottom, |
| 1074 |
int horizontalScrollbarPersistence, int verticalScrollbarPersistence, uint32 flags); |
| 1075 |
GuiScrolledWindow GuiScrolledWindow_createShown (GuiForm parent, int left, int right, int top, int bottom, |
| 1076 |
int horizontalScrollbarPersistence, int verticalScrollbarPersistence, uint32 flags); |
| 1077 |
|
| 1078 |
/********** GuiText **********/ |
| 1079 |
|
| 1080 |
Thing_declare (GuiText); |
| 1081 |
|
| 1082 |
typedef struct structGuiTextEvent { |
| 1083 |
GuiText text; |
| 1084 |
} *GuiTextEvent; |
| 1085 |
|
| 1086 |
using GuiText_ChangedCallback = MelderCallback <void, structThing /* boss */, GuiTextEvent>; |
| 1087 |
|
| 1088 |
#if gtk |
| 1089 |
typedef gchar * history_data; |
| 1090 |
#else |
| 1091 |
typedef char * history_data; |
| 1092 |
#endif |
| 1093 |
|
| 1094 |
struct history_entry { |
| 1095 |
history_entry *prev, *next; |
| 1096 |
integer first, last; |
| 1097 |
history_data text; |
| 1098 |
bool type_del : 1; |
| 1099 |
}; |
| 1100 |
|
| 1101 |
Thing_define (GuiText, GuiControl) { |
| 1102 |
GuiText_ChangedCallback d_changedCallback; |
| 1103 |
Thing d_changedBoss; |
| 1104 |
uint32 flags; |
| 1105 |
#if cocoa |
| 1106 |
GuiCocoaScrolledWindow *d_cocoaScrollView; |
| 1107 |
GuiCocoaTextView *d_cocoaTextView; |
| 1108 |
double d_macFontSize; |
| 1109 |
#elif defined (macintosh) |
| 1110 |
TXNObject d_macMlteObject; |
| 1111 |
TXNFrameID d_macMlteFrameId; |
| 1112 |
#else |
| 1113 |
history_entry *d_prev, *d_next; |
| 1114 |
GuiMenuItem d_undo_item, d_redo_item; |
| 1115 |
bool d_history_change : 1; |
| 1116 |
#endif |
| 1117 |
#if motif |
| 1118 |
bool d_editable; |
| 1119 |
#endif |
| 1120 |
}; |
| 1121 |
|
| 1122 |
/* GuiText creation flags: */ |
| 1123 |
#define GuiText_SCROLLED 1 |
| 1124 |
#define GuiText_CHARWRAP 2 |
| 1125 |
#define GuiText_INKWRAP 4 |
| 1126 |
#define GuiText_ANYWRAP (GuiText_CHARWRAP | GuiText_INKWRAP) |
| 1127 |
#define GuiText_NONEDITABLE 8 |
| 1128 |
GuiText GuiText_create (GuiForm parent, int left, int right, int top, int bottom, uint32 flags); |
| 1129 |
GuiText GuiText_createShown (GuiForm parent, int left, int right, int top, int bottom, uint32 flags); |
| 1130 |
|
| 1131 |
void GuiText_copy (GuiText me); |
| 1132 |
void GuiText_cut (GuiText me); |
| 1133 |
autostring32 GuiText_getSelection (GuiText me); |
| 1134 |
autostring32 GuiText_getString (GuiText me); |
| 1135 |
autostring32 GuiText_getStringAndSelectionPosition (GuiText me, integer *first, integer *last); |
| 1136 |
void GuiText_paste (GuiText me); |
| 1137 |
void GuiText_redo (GuiText me); |
| 1138 |
void GuiText_remove (GuiText me); |
| 1139 |
void GuiText_replace (GuiText me, integer from_pos, integer to_pos, conststring32 value); |
| 1140 |
void GuiText_scrollToSelection (GuiText me); |
| 1141 |
void GuiText_setChangedCallback (GuiText me, GuiText_ChangedCallback changedCallback, Thing changedBoss); |
| 1142 |
void GuiText_setFontSize (GuiText me, double size); |
| 1143 |
void GuiText_setRedoItem (GuiText me, GuiMenuItem item); |
| 1144 |
void GuiText_setSelection (GuiText me, integer first, integer last); |
| 1145 |
void GuiText_setString (GuiText me, conststring32 text, bool undoable = true); |
| 1146 |
void GuiText_setUndoItem (GuiText me, GuiMenuItem item); |
| 1147 |
void GuiText_undo (GuiText me); |
| 1148 |
|
| 1149 |
/********** GuiWindow **********/ |
| 1150 |
|
| 1151 |
Thing_define (GuiWindow, GuiShell) { |
| 1152 |
#if gtk |
| 1153 |
GtkMenuBar *d_gtkMenuBar; |
| 1154 |
#elif cocoa |
| 1155 |
int d_menuBarWidth; |
| 1156 |
GuiMenuItemCallback d_tabCallback; |
| 1157 |
Thing d_tabBoss; |
| 1158 |
GuiMenuItemCallback d_shiftTabCallback; |
| 1159 |
Thing d_shiftTabBoss; |
| 1160 |
GuiMenuItemCallback d_enterCallback; |
| 1161 |
Thing d_enterBoss; |
| 1162 |
GuiMenuItemCallback d_optionBackspaceCallback; |
| 1163 |
Thing d_optionBackspaceBoss; |
| 1164 |
GuiMenuItemCallback d_escapeCallback; |
| 1165 |
Thing d_escapeBoss; |
| 1166 |
#elif motif |
| 1167 |
GuiObject d_xmMenuBar; |
| 1168 |
#endif |
| 1169 |
}; |
| 1170 |
|
| 1171 |
/* GuiWindow creation flags: */ |
| 1172 |
#define GuiWindow_FULLSCREEN 1 |
| 1173 |
GuiWindow GuiWindow_create (int x, int y, int width, int height, int minimumWidth, int minimumHeight, |
| 1174 |
conststring32 title /* cattable */, GuiShell_GoAwayCallback goAwayCallback, Thing goAwayBoss, uint32 flags); |
| 1175 |
// returns a Form widget that has a new Shell parent. |
| 1176 |
|
| 1177 |
void GuiWindow_addMenuBar (GuiWindow me); |
| 1178 |
bool GuiWindow_setDirty (GuiWindow me, bool dirty); |
| 1179 |
/* |
| 1180 |
Purpose: on OSX you get a little dot in the red close button, |
| 1181 |
and the window proxy icon dims. |
| 1182 |
Return value: |
| 1183 |
`true` if the system supports this feature, `false` if not; |
| 1184 |
the point of this is that you can use a different user feedback strategy, like appending |
| 1185 |
the text "(modified)" to the window title, if this feature is not supported. |
| 1186 |
*/ |
| 1187 |
void GuiWindow_setFile (GuiWindow me, MelderFile file); |
| 1188 |
/* |
| 1189 |
Purpose: set the window title, and (on MacOS X) the window proxy icon and the window path menu. |
| 1190 |
*/ |
| 1191 |
|
| 1192 |
void GuiObject_destroy (GuiObject me); |
| 1193 |
|
| 1194 |
/********** EVENTS **********/ |
| 1195 |
|
| 1196 |
#if defined (macintosh) |
| 1197 |
void Gui_setOpenDocumentCallback (void (*openDocumentCallback) (MelderFile file), void (*finishedOpeningDocumentsCallback) ()); |
| 1198 |
#endif |
| 1199 |
|
| 1200 |
void Gui_setQuitApplicationCallback (void (*quitApplicationCallback) ()); |
| 1201 |
void Gui_runQuitApplicationCallback (); |
| 1202 |
|
| 1203 |
extern uinteger theGuiTopLowAccelerators [8]; |
| 1204 |
|
| 1205 |
/* |
| 1206 |
'parent' is the top-level widget. |
| 1207 |
*/ |
| 1208 |
void Gui_injectMessageProcs (GuiWindow parent); |
| 1209 |
|
| 1210 |
/* End of file Gui.h */ |
| 1211 |
#endif |