1 // This file is part of e93. 2 // 3 // e93 is free software; you can redistribute it and/or modify 4 // it under the terms of the e93 LICENSE AGREEMENT. 5 // 6 // e93 is distributed in the hope that it will be useful, 7 // but WITHOUT ANY WARRANTY; without even the implied warranty of 8 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 9 // e93 LICENSE AGREEMENT for more details. 10 // 11 // You should have received a copy of the e93 LICENSE AGREEMENT 12 // along with e93; see the file "LICENSE.TXT". 13 14 typedef struct dialogItem // item in list of items for given dialog (built during dialog creation) 15 { 16 struct dialog 17 *dialog; // pointer to the dialog this item is in 18 void 19 (*disposeProc)(struct dialogItem *item); // routine to call to get rid of item's local storage 20 void 21 (*drawProc)(struct dialogItem *item,Pixmap imageBuffer,Region updateRegion); // routine to call when drawing item 22 bool 23 (*trackProc)(struct dialogItem *item,XEvent *event); // routine to call when attempting to track the item (returns false if initial point not in item) 24 void 25 (*resizeProc)(struct dialogItem *item); // call this after the window has changed size to resize/reposition the item 26 bool 27 (*earlyKeyProc)(struct dialogItem *item,XEvent *event); // if this item wants certain control keys before the default item can get them, it defines this 28 bool 29 wantFocus; // tells the dialog manager that this item desires to be in the focus chain 30 void 31 (*focusChangeProc)(struct dialogItem *item); // called by dialog manager to tell item that focus is changing 32 void 33 (*focusKeyProc)(struct dialogItem *item,XEvent *event); // when keys come in for this focussed item, this is called 34 void 35 (*focusPeriodicProc)(struct dialogItem *item); // if this item wants to flash the cursor or whatever, it can set up this routine 36 void 37 *itemStruct; // pointer to any data this item requires (used by create routines if needed) 38 struct dialogItem 39 *previousItem, 40 *nextItem; 41 } DIALOG_ITEM; 42 43 typedef struct dialog // list of dialog items 44 { 45 EDITOR_WINDOW 46 *parentWindow; // the editor window that this dialog is in 47 EDITOR_COLOR 48 backgroundColor; // color to use when drawing background of the dialog 49 bool 50 dialogComplete; // set to true by dialog procs to tell when dialog is finished, and should be closed 51 DIALOG_ITEM 52 *firstItem, // pointer to first item in the dialog (or NULL) 53 *lastItem; // pointer to last item in the dialog (or NULL) 54 DIALOG_ITEM 55 *focusItem; // pointer to item with focus (or NULL) 56 void 57 *dialogLocal; // place for local dialog routines to hang any data they need 58 } DIALOG; 59 60 61 DIALOG_ITEM *NewDialogItem(DIALOG *dialog,bool (*createProc)(DIALOG_ITEM *item,void *itemDescriptor),void *itemDescriptor); 62 void DisposeDialogItem(DIALOG_ITEM *dialogItem); 63 void UpdateDialogWindow(EDITOR_WINDOW *window); 64 void AdjustDialogWindowForNewSize(EDITOR_WINDOW *window); 65 void DialogPeriodicProc(EDITOR_WINDOW *window); 66 void DialogTakeFocus(DIALOG_ITEM *item); 67 void DialogWindowEvent(EDITOR_WINDOW *window,XEvent *event); 68 bool OkDialog(const char *text); 69 bool OkCancelDialog(const char *text,bool *cancel); 70 bool YesNoCancelDialog(const char *text,bool *yes,bool *cancel); 71 bool GetSimpleTextDialog(const char *title,char *enteredText,UINT32 stringBytes,bool *cancel); 72 bool SearchReplaceDialog(EDITOR_BUFFER *searchBuffer,EDITOR_BUFFER *replaceBuffer,bool *backwards,bool *wrapAround,bool *selectionExpr,bool *ignoreCase,bool *limitScope,bool *replaceProc,UINT16 *searchType,bool *cancel); 73 bool SimpleListBoxDialog(const char *title,UINT32 numElements,const char **listElements,bool *selectedElements,bool *cancel); 74 bool OpenFileDialog(const char *title,char *fullPath,UINT32 stringBytes,char ***listElements,bool *cancel); 75 void FreeOpenFileDialogPaths(char **paths); 76 bool SaveFileDialog(const char *title,char *fullPath,UINT32 stringBytes,bool *cancel); 77 bool ChoosePathDialog(const char *title,char *fullPath,UINT32 stringBytes,bool *cancel); 78 bool ChooseFontDialog(const char *title,char *font,UINT32 stringBytes,bool *cancel); 79