UNIXworkcode

1 /******************************************************************************* 2 * * 3 * misc.h -- Nirvana Editor Miscellaneous Header File * 4 * * 5 * Copyright 2004 The NEdit Developers * 6 * * 7 * This is free software; you can redistribute it and/or modify it under the * 8 * terms of the GNU General Public License as published by the Free Software * 9 * Foundation; either version 2 of the License, or (at your option) any later * 10 * version. In addition, you may distribute versions of this program linked to * 11 * Motif or Open Motif. See README for details. * 12 * * 13 * This software is distributed in the hope that it will be useful, but WITHOUT * 14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * 15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 16 * more details. * 17 * * 18 * You should have received a copy of the GNU General Public License along with * 19 * software; if not, write to the Free Software Foundation, Inc., 59 Temple * 20 * Place, Suite 330, Boston, MA 02111-1307 USA * 21 * * 22 * Nirvana Text Editor * 23 * July 31, 2001 * 24 * * 25 *******************************************************************************/ 26 27 #ifndef NEDIT_MISC_H_INCLUDED 28 #define NEDIT_MISC_H_INCLUDED 29 30 #include <X11/Intrinsic.h> 31 #include <Xm/Xm.h> 32 #include <Xm/CutPaste.h> 33 34 #define TEXT_READ_OK 0 35 #define TEXT_IS_BLANK 1 36 #define TEXT_NOT_NUMBER 2 37 38 /* maximum length for a window geometry string */ 39 #define MAX_GEOM_STRING_LEN 24 40 41 /* Maximum length for a menu accelerator string. 42 Which e.g. can be parsed by misc.c:parseAccelString() 43 (how many modifier keys can you hold down at once?) */ 44 #define MAX_ACCEL_LEN 100 45 46 /* button margin width to avoid cramped buttons */ 47 #define BUTTON_WIDTH_MARGIN 12 48 49 50 void AddMotifCloseCallback(Widget shell, XtCallbackProc closeCB, void *arg); 51 void SuppressPassiveGrabWarnings(void); 52 void PopDownBugPatch(Widget w); 53 void RemapDeleteKey(Widget w); 54 void SetDeleteRemap(int state); 55 void RealizeWithoutForcingPosition(Widget shell); 56 void RemovePPositionHint(Widget shell); 57 void ManageDialogCenteredOnPointer(Widget dialogChild); 58 void SetPointerCenteredDialogs(int state); 59 void RaiseDialogWindow(Widget shell); 60 void RaiseShellWindow(Widget shell, Boolean focus); 61 void RaiseWindow(Display *display, Window w, Boolean focus); 62 void AddDialogMnemonicHandler(Widget dialog, int unmodifiedToo); 63 void RemoveDialogMnemonicHandler(Widget dialog); 64 void AccelLockBugPatch(Widget topWidget, Widget topMenuContainer); 65 void UpdateAccelLockPatch(Widget topWidget, Widget newButton); 66 char *GetXmStringText(XmString fromString); 67 XFontStruct *GetDefaultFontStruct(Display *d, XmFontList font); 68 XmString* StringTable(int count, ...); 69 void FreeStringTable(XmString *table); 70 void SimulateButtonPress(Widget widget); 71 Widget AddMenuItem(Widget parent, char *name, char *label, char mnemonic, 72 char *acc, char *accText, XtCallbackProc callback, void *cbArg); 73 Widget AddMenuToggle(Widget parent, char *name, char *label, char mnemonic, 74 char *acc, char *accText, XtCallbackProc callback, void *cbArg,int set); 75 Widget AddSubMenu(Widget parent, char *name, char *label, char mnemonic); 76 void SetIntText(Widget text, int value); 77 int GetFloatText(Widget text, double *value); 78 int GetIntText(Widget text, int *value); 79 int GetFloatTextWarn(Widget text, double *value, const char *fieldName, int warnBlank); 80 int GetIntTextWarn(Widget text, int *value, const char *fieldName, int warnBlank); 81 char* TextGetStringUtf8(Widget text); 82 int TextWidgetIsBlank(Widget textW); 83 void MakeSingleLineTextW(Widget textW); 84 void BeginWait(Widget topCursorWidget); 85 void BusyWait(Widget anyWidget); 86 void EndWait(Widget topCursorWidget); 87 void PasswordText(Widget w, char *passTxt); 88 void AddHistoryToTextWidget(Widget textW, char ***historyList, int *nItems); 89 void AddToHistoryList(char *newItem, char ***historyList, int *nItems); 90 void CreateGeometryString(char *string, int x, int y, 91 int width, int height, int bitmask); 92 Boolean FindBestVisual(Display *display, const char *appName, const char *appClass, 93 Visual **visual, int *depth, Colormap *colormap); 94 Widget CreateDialogShell(Widget parent, char *name, ArgList arglist, 95 Cardinal argcount); 96 Widget CreatePopupMenu(Widget parent, char *name, ArgList arglist, 97 Cardinal argcount); 98 Widget CreatePulldownMenu(Widget parent, char *name, ArgList arglist, 99 Cardinal argcount); 100 Widget CreatePromptDialog(Widget parent, char *name, ArgList arglist, 101 Cardinal argcount); 102 Widget CreateSelectionDialog(Widget parent, char *name, ArgList arglist, 103 Cardinal argcount); 104 Widget CreateFormDialog(Widget parent, char *name, ArgList arglist, 105 Cardinal argcount); 106 Widget CreateFileSelectionDialog(Widget parent, char *name, ArgList arglist, 107 Cardinal argcount); 108 Widget CreateQuestionDialog(Widget parent, char *name, ArgList arglist, 109 Cardinal argcount); 110 Widget CreateMessageDialog(Widget parent, char *name, ArgList arglist, 111 Cardinal argcount); 112 Widget CreateErrorDialog(Widget parent, char *name, ArgList arglist, 113 Cardinal argcount); 114 Widget CreateShellWithBestVis(String appName, String appClass, 115 WidgetClass class, Display *display, ArgList args, Cardinal nArgs); 116 Widget CreatePopupShellWithBestVis(String shellName, WidgetClass class, 117 Widget parent, ArgList arglist, Cardinal argcount); 118 Widget CreateWidget(Widget parent, const char *name, WidgetClass class, 119 ArgList arglist, Cardinal argcount); 120 Modifiers GetNumLockModMask(Display *display); 121 void InstallMouseWheelActions(XtAppContext context); 122 void AddMouseWheelSupport(Widget w); 123 void XmContainerAddMouseWheelSupport(Widget w); 124 void RadioButtonChangeState(Widget widget, Boolean state, Boolean notify); 125 void CloseAllPopupsFor(Widget shell); 126 long QueryCurrentDesktop(Display *display, Window rootWindow); 127 long QueryDesktop(Display *display, Widget shell); 128 int SpinClipboardStartCopy(Display *display, Window window, 129 XmString clip_label, Time timestamp, Widget widget, 130 XmCutPasteProc callback, long *item_id); 131 int SpinClipboardCopy(Display *display, Window window, long item_id, 132 char *format_name, XtPointer buffer, unsigned long length, 133 long private_id, long *data_id); 134 int SpinClipboardEndCopy(Display *display, Window window, long item_id); 135 int SpinClipboardInquireLength(Display *display, Window window, 136 char *format_name, unsigned long *length); 137 int SpinClipboardRetrieve(Display *display, Window window, char *format_name, 138 XtPointer buffer, unsigned long length, unsigned long *num_bytes, 139 long *private_id); 140 int SpinClipboardLock(Display *display, Window window); 141 int SpinClipboardUnlock(Display *display, Window window); 142 void WmClientMsg(Display *disp, Window win, const char *msg, 143 unsigned long data0, unsigned long data1, 144 unsigned long data2, unsigned long data3, 145 unsigned long data4); 146 char* ConvertEncoding(const char *string, const char *to, const char *from); 147 char* ConvertEncodingLen(const char *string, size_t len, const char *to, const char *from); 148 char* GetLocaleEncoding(void); 149 int IsUtf8Locale(void); 150 void SetWindowGtkThemeVariant(Display *dp, Window window, int theme); 151 152 #endif /* NEDIT_MISC_H_INCLUDED */ 153