1 /* $Id: misc.h,v 1.25 2004/08/01 10:06:12 yooden Exp $ */
2 /*******************************************************************************
4 * misc.h -- Nirvana Editor Miscellaneous Header File *
6 * Copyright 2004 The NEdit Developers *
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 version of this program linked to *
12 * Motif or Open Motif. See README for details. *
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 Lesser General Public License *
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 *
23 * Nirvana Text Editor *
26 *******************************************************************************/
28 #ifndef NEDIT_MISC_H_INCLUDED
29 #define NEDIT_MISC_H_INCLUDED
31 #include <X11/Intrinsic.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 RaiseShellWindow(Widget shell
);
59 void RaiseWindow(Display
*display
, Window w
);
60 void AddDialogMnemonicHandler(Widget dialog
, int unmodifiedToo
);
61 void RemoveDialogMnemonicHandler(Widget dialog
);
62 void AccelLockBugPatch(Widget topWidget
, Widget topMenuContainer
);
63 void UpdateAccelLockPatch(Widget topWidget
, Widget newButton
);
64 char *GetXmStringText(XmString fromString
);
65 XFontStruct
*GetDefaultFontStruct(XmFontList font
);
66 XmString
* StringTable(int count
, ...);
67 void FreeStringTable(XmString
*table
);
68 void SimulateButtonPress(Widget widget
);
69 Widget
AddMenuItem(Widget parent
, char *name
, char *label
, char mnemonic
,
70 char *acc
, char *accText
, XtCallbackProc callback
, void *cbArg
);
71 Widget
AddMenuToggle(Widget parent
, char *name
, char *label
, char mnemonic
,
72 char *acc
, char *accText
, XtCallbackProc callback
, void *cbArg
,int set
);
73 Widget
AddMenuSeparator(Widget parent
, char *name
);
74 Widget
AddSubMenu(Widget parent
, char *name
, char *label
, char mnemonic
);
75 void SetIntLabel(Widget label
, int value
);
76 void SetFloatLabel(Widget label
, double value
);
77 void SetIntText(Widget text
, int value
);
78 void SetFloatText(Widget text
, double value
);
79 int GetFloatText(Widget text
, double *value
);
80 int GetIntText(Widget text
, int *value
);
81 int GetFloatTextWarn(Widget text
, double *value
, const char *fieldName
, int warnBlank
);
82 int GetIntTextWarn(Widget text
, int *value
, const char *fieldName
, int warnBlank
);
83 int TextWidgetIsBlank(Widget textW
);
84 void MakeSingleLineTextW(Widget textW
);
85 void BeginWait(Widget topCursorWidget
);
86 void BusyWait(Widget anyWidget
);
87 void EndWait(Widget topCursorWidget
);
88 void PasswordText(Widget w
, char *passTxt
);
89 void AddHistoryToTextWidget(Widget textW
, char ***historyList
, int *nItems
);
90 void AddToHistoryList(char *newItem
, char ***historyList
, int *nItems
);
91 void CreateGeometryString(char *string
, int x
, int y
,
92 int width
, int height
, int bitmask
);
93 Boolean
FindBestVisual(Display
*display
, const char *appName
, const char *appClass
,
94 Visual
**visual
, int *depth
, Colormap
*colormap
);
95 Widget
CreateDialogShell(Widget parent
, char *name
, ArgList arglist
,
97 Widget
CreatePopupMenu(Widget parent
, char *name
, ArgList arglist
,
99 Widget
CreatePulldownMenu(Widget parent
, char *name
, ArgList arglist
,
101 Widget
CreatePromptDialog(Widget parent
, char *name
, ArgList arglist
,
103 Widget
CreateSelectionDialog(Widget parent
, char *name
, ArgList arglist
,
105 Widget
CreateFormDialog(Widget parent
, char *name
, ArgList arglist
,
107 Widget
CreateFileSelectionDialog(Widget parent
, char *name
, ArgList arglist
,
109 Widget
CreateQuestionDialog(Widget parent
, char *name
, ArgList arglist
,
111 Widget
CreateMessageDialog(Widget parent
, char *name
, ArgList arglist
,
113 Widget
CreateErrorDialog(Widget parent
, char *name
, ArgList arglist
,
115 Widget
CreateShellWithBestVis(String appName
, String appClass
,
116 WidgetClass
class, Display
*display
, ArgList args
, Cardinal nArgs
);
117 Widget
CreatePopupShellWithBestVis(String shellName
, WidgetClass
class,
118 Widget parent
, ArgList arglist
, Cardinal argcount
);
119 Widget
CreateWidget(Widget parent
, const char *name
, WidgetClass
class,
120 ArgList arglist
, Cardinal argcount
);
121 Modifiers
GetNumLockModMask(Display
*display
);
122 void InstallMouseWheelActions(XtAppContext context
);
123 void AddMouseWheelSupport(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
);
129 #endif /* NEDIT_MISC_H_INCLUDED */