]> git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/private.h
Corrected wxlistBox, wxRadioBox, wxComboBox and
[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
17 class wxMouseEvent;
18 class wxKeyEvent;
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, String args[], int *num_args);
29
30 // For repainting arbitrary windows
31 void wxUniversalRepaintProc(Widget w, XtPointer WXUNUSED(c_data), XEvent *event, char *);
32
33 // ----------------------------------------------------------------------------
34 // we maintain a hash table which contains the mapping from Widget to wxWindow
35 // corresponding to the window for this widget
36 // ----------------------------------------------------------------------------
37
38 extern void wxDeleteWindowFromTable(Widget w);
39 extern wxWindow *wxGetWindowFromTable(Widget w);
40 extern bool wxAddWindowToTable(Widget w, wxWindow *win);
41
42 extern char wxFindMnemonic(const char* s);
43 extern char * wxFindAccelerator (char *s);
44 extern XmString wxFindAcceleratorText (char *s);
45 extern int wxCharCodeXToWX(KeySym keySym);
46 extern KeySym wxCharCodeWXToX(int id);
47
48 // ----------------------------------------------------------------------------
49 // TranslateXXXEvent() functions - translate Motif event to wxWindow one
50 // ----------------------------------------------------------------------------
51 extern bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win, Widget widget, XEvent *xevent);
52 extern bool wxTranslateKeyEvent(wxKeyEvent& wxevent, wxWindow *win, Widget widget, XEvent *xevent);
53
54 int wxGetBestMatchingPixel(Display *display, XColor *desiredColor, Colormap cmap);
55 Pixmap XCreateInsensitivePixmap( Display *display, Pixmap pixmap );
56
57 extern XColor g_itemColors[];
58 extern int wxComputeColours (Display *display, wxColour * back, wxColour * fore);
59
60 extern void wxDoChangeForegroundColour(WXWidget widget, wxColour& foregroundColour);
61 extern void wxDoChangeBackgroundColour(WXWidget widget, wxColour& backgroundColour, bool changeArmColour = FALSE);
62
63 #define wxNO_COLORS 0x00
64 #define wxBACK_COLORS 0x01
65 #define wxFORE_COLORS 0x02
66
67 extern XColor itemColors[5] ;
68
69 #define wxBACK_INDEX 0
70 #define wxFORE_INDEX 1
71 #define wxSELE_INDEX 2
72 #define wxTOPS_INDEX 3
73 #define wxBOTS_INDEX 4
74
75 // ----------------------------------------------------------------------------
76 // utility classes
77 // ----------------------------------------------------------------------------
78
79 // XmString made easy to use in wxWindows (and has an added benefit of
80 // cleaning up automatically)
81 class wxXmString
82 {
83 public:
84 wxXmString(const wxString& str)
85 {
86 m_string = XmStringCreateLtoR((char *)str.c_str(),
87 XmSTRING_DEFAULT_CHARSET);
88 }
89
90 ~wxXmString() { XmStringFree(m_string); }
91
92 // semi-implicit conversion to XmString (shouldn't rely on implicit
93 // conversion because many of Motif functions are macros)
94 XmString operator()() const { return m_string; }
95
96 private:
97 XmString m_string;
98 };
99
100 // ----------------------------------------------------------------------------
101 // macros to avoid casting WXFOO to Foo all the time
102 // ----------------------------------------------------------------------------
103
104 // argument is of type "wxWindow *"
105 #define GetWidget(w) ((Widget)(w)->GetHandle())
106
107 #endif
108 // _WX_PRIVATE_H_