Fix for SF bug #1067619: focus on raise. By default, NEdit no longer requests
[nedit.git] / util / misc.h
blob2461ae32eec86d83d357298f50f7d2df78365606
1 /* $Id: misc.h,v 1.27 2004/12/23 22:25:47 edg Exp $ */
2 /*******************************************************************************
3 * *
4 * misc.h -- Nirvana Editor Miscellaneous Header File *
5 * *
6 * Copyright 2004 The NEdit Developers *
7 * *
8 * This is free software; you can redistribute it and/or modify it under the *
9 * terms of the GNU General Public License as published by the Free Software *
10 * Foundation; either version 2 of the License, or (at your option) any later *
11 * version. In addition, you may distribute versions of this program linked to *
12 * Motif or Open Motif. See README for details. *
13 * *
14 * This software is distributed in the hope that it will be useful, but WITHOUT *
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *
17 * more details. *
18 * *
19 * You should have received a copy of the GNU General Public License along with *
20 * software; if not, write to the Free Software Foundation, Inc., 59 Temple *
21 * Place, Suite 330, Boston, MA 02111-1307 USA *
22 * *
23 * Nirvana Text Editor *
24 * July 31, 2001 *
25 * *
26 *******************************************************************************/
28 #ifndef NEDIT_MISC_H_INCLUDED
29 #define NEDIT_MISC_H_INCLUDED
31 #include <X11/Intrinsic.h>
32 #include <Xm/Xm.h>
34 #define TEXT_READ_OK 0
35 #define TEXT_IS_BLANK 1
36 #define TEXT_NOT_NUMBER 2
38 /* maximum length for a window geometry string */
39 #define MAX_GEOM_STRING_LEN 24
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
46 /* button margin width to avoid cramped buttons */
47 #define BUTTON_WIDTH_MARGIN 12
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 ManageDialogCenteredOnPointer(Widget dialogChild);
57 void SetPointerCenteredDialogs(int state);
58 void RaiseDialogWindow(Widget shell);
59 void RaiseShellWindow(Widget shell, Boolean focus);
60 void RaiseWindow(Display *display, Window w, Boolean focus);
61 void AddDialogMnemonicHandler(Widget dialog, int unmodifiedToo);
62 void RemoveDialogMnemonicHandler(Widget dialog);
63 void AccelLockBugPatch(Widget topWidget, Widget topMenuContainer);
64 void UpdateAccelLockPatch(Widget topWidget, Widget newButton);
65 char *GetXmStringText(XmString fromString);
66 XFontStruct *GetDefaultFontStruct(XmFontList font);
67 XmString* StringTable(int count, ...);
68 void FreeStringTable(XmString *table);
69 void SimulateButtonPress(Widget widget);
70 Widget AddMenuItem(Widget parent, char *name, char *label, char mnemonic,
71 char *acc, char *accText, XtCallbackProc callback, void *cbArg);
72 Widget AddMenuToggle(Widget parent, char *name, char *label, char mnemonic,
73 char *acc, char *accText, XtCallbackProc callback, void *cbArg,int set);
74 Widget AddMenuSeparator(Widget parent, char *name);
75 Widget AddSubMenu(Widget parent, char *name, char *label, char mnemonic);
76 void SetIntLabel(Widget label, int value);
77 void SetFloatLabel(Widget label, double value);
78 void SetIntText(Widget text, int value);
79 void SetFloatText(Widget text, double value);
80 int GetFloatText(Widget text, double *value);
81 int GetIntText(Widget text, int *value);
82 int GetFloatTextWarn(Widget text, double *value, const char *fieldName, int warnBlank);
83 int GetIntTextWarn(Widget text, int *value, const char *fieldName, int warnBlank);
84 int TextWidgetIsBlank(Widget textW);
85 void MakeSingleLineTextW(Widget textW);
86 void BeginWait(Widget topCursorWidget);
87 void BusyWait(Widget anyWidget);
88 void EndWait(Widget topCursorWidget);
89 void PasswordText(Widget w, char *passTxt);
90 void AddHistoryToTextWidget(Widget textW, char ***historyList, int *nItems);
91 void AddToHistoryList(char *newItem, char ***historyList, int *nItems);
92 void CreateGeometryString(char *string, int x, int y,
93 int width, int height, int bitmask);
94 Boolean FindBestVisual(Display *display, const char *appName, const char *appClass,
95 Visual **visual, int *depth, Colormap *colormap);
96 Widget CreateDialogShell(Widget parent, char *name, ArgList arglist,
97 Cardinal argcount);
98 Widget CreatePopupMenu(Widget parent, char *name, ArgList arglist,
99 Cardinal argcount);
100 Widget CreatePulldownMenu(Widget parent, char *name, ArgList arglist,
101 Cardinal argcount);
102 Widget CreatePromptDialog(Widget parent, char *name, ArgList arglist,
103 Cardinal argcount);
104 Widget CreateSelectionDialog(Widget parent, char *name, ArgList arglist,
105 Cardinal argcount);
106 Widget CreateFormDialog(Widget parent, char *name, ArgList arglist,
107 Cardinal argcount);
108 Widget CreateFileSelectionDialog(Widget parent, char *name, ArgList arglist,
109 Cardinal argcount);
110 Widget CreateQuestionDialog(Widget parent, char *name, ArgList arglist,
111 Cardinal argcount);
112 Widget CreateMessageDialog(Widget parent, char *name, ArgList arglist,
113 Cardinal argcount);
114 Widget CreateErrorDialog(Widget parent, char *name, ArgList arglist,
115 Cardinal argcount);
116 Widget CreateShellWithBestVis(String appName, String appClass,
117 WidgetClass class, Display *display, ArgList args, Cardinal nArgs);
118 Widget CreatePopupShellWithBestVis(String shellName, WidgetClass class,
119 Widget parent, ArgList arglist, Cardinal argcount);
120 Widget CreateWidget(Widget parent, const char *name, WidgetClass class,
121 ArgList arglist, Cardinal argcount);
122 Modifiers GetNumLockModMask(Display *display);
123 void InstallMouseWheelActions(XtAppContext context);
124 void AddMouseWheelSupport(Widget w);
125 void RadioButtonChangeState(Widget widget, Boolean state, Boolean notify);
126 void CloseAllPopupsFor(Widget shell);
127 long QueryCurrentDesktop(Display *display, Window rootWindow);
128 long QueryDesktop(Display *display, Widget shell);
130 #endif /* NEDIT_MISC_H_INCLUDED */