Applied patch [ 679397 ] remove GPL code from motif build
[wxWidgets.git] / include / wx / motif / private.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: private.h
3 // Purpose: Private declarations for wxMotif port
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 17/09/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_PRIVATE_H_
13 #define _WX_PRIVATE_H_
14
15 #include "wx/defs.h"
16 #include "X11/Xlib.h"
17
18 #include "wx/x11/privx.h"
19
20 // Put any private declarations here: native Motif types may be used because
21 // this header is included after Xm/Xm.h
22
23 // ----------------------------------------------------------------------------
24 // common callbacks
25 // ----------------------------------------------------------------------------
26
27 // All widgets should have this as their resize proc.
28 extern void wxWidgetResizeProc(Widget w, XConfigureEvent *event,
29 String args[], int *num_args);
30
31 // For repainting arbitrary windows
32 void wxUniversalRepaintProc(Widget w, XtPointer WXUNUSED(c_data),
33 XEvent *event, char *);
34
35 // ----------------------------------------------------------------------------
36 // we maintain a hash table which contains the mapping from Widget to wxWindow
37 // corresponding to the window for this widget
38 // ----------------------------------------------------------------------------
39
40 extern void wxDeleteWindowFromTable(Widget w);
41 extern wxWindow *wxGetWindowFromTable(Widget w);
42 extern bool wxAddWindowToTable(Widget w, wxWindow *win);
43
44 // ----------------------------------------------------------------------------
45 // key events related functions
46 // ----------------------------------------------------------------------------
47
48 extern char wxFindMnemonic(const char* s);
49
50 extern char * wxFindAccelerator (const char *s);
51 extern XmString wxFindAcceleratorText (const char *s);
52
53 // ----------------------------------------------------------------------------
54 // TranslateXXXEvent() functions - translate Motif event to wxWindow one
55 // ----------------------------------------------------------------------------
56
57 extern bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win,
58 Widget widget, XEvent *xevent);
59 extern bool wxTranslateKeyEvent(wxKeyEvent& wxevent, wxWindow *win,
60 Widget widget, XEvent *xevent);
61
62 extern void wxDoChangeForegroundColour(WXWidget widget,
63 wxColour& foregroundColour);
64 extern void wxDoChangeBackgroundColour(WXWidget widget,
65 wxColour& backgroundColour,
66 bool changeArmColour = FALSE);
67
68 #define wxNO_COLORS 0x00
69 #define wxBACK_COLORS 0x01
70 #define wxFORE_COLORS 0x02
71
72 extern XColor itemColors[5] ;
73
74 #define wxBACK_INDEX 0
75 #define wxFORE_INDEX 1
76 #define wxSELE_INDEX 2
77 #define wxTOPS_INDEX 3
78 #define wxBOTS_INDEX 4
79
80 // ----------------------------------------------------------------------------
81 // utility classes
82 // ----------------------------------------------------------------------------
83
84 // XmString made easy to use in wxWindows (and has an added benefit of
85 // cleaning up automatically)
86 class wxXmString
87 {
88 public:
89 wxXmString(const char* str)
90 {
91 m_string = XmStringCreateLtoR((char *)str, XmSTRING_DEFAULT_CHARSET);
92 }
93
94 wxXmString(const wxString& str)
95 {
96 m_string = XmStringCreateLtoR((char *)str.c_str(),
97 XmSTRING_DEFAULT_CHARSET);
98 }
99
100 ~wxXmString() { XmStringFree(m_string); }
101
102 // semi-implicit conversion to XmString (shouldn't rely on implicit
103 // conversion because many of Motif functions are macros)
104 XmString operator()() const { return m_string; }
105
106 private:
107 XmString m_string;
108 };
109
110 // ----------------------------------------------------------------------------
111 // Routines used in both wxTextCtrl/wxListBox and nativa wxComboBox
112 // (defined in src/motif/listbox.cpp or src/motif/textctrl.cpp
113 // ----------------------------------------------------------------------------
114
115 int wxDoFindStringInList( Widget listWidget, const wxString& str );
116 int wxDoGetSelectionInList(Widget listWidget);
117
118 // ----------------------------------------------------------------------------
119 // executes one main loop iteration (implemented in src/motif/evtloop.cpp)
120 // ----------------------------------------------------------------------------
121
122 class wxEventLoop;
123
124 // returns true if the loop should be exited
125 bool wxDoEventLoopIteration( wxEventLoop& evtLoop );
126
127 // ----------------------------------------------------------------------------
128 // macros to avoid casting WXFOO to Foo all the time
129 // ----------------------------------------------------------------------------
130
131 // argument is of type "wxWindow *"
132 #define GetWidget(w) ((Widget)(w)->GetHandle())
133
134 // ----------------------------------------------------------------------------
135 // accessors for C modules
136 // ----------------------------------------------------------------------------
137
138 extern "C" XtAppContext wxGetAppContext();
139
140 #endif
141 // _WX_PRIVATE_H_