]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/private.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Private declarations for wxMotif port
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_PRIVATE_H_
13 #define _WX_PRIVATE_H_
18 class WXDLLEXPORT wxFont
;
19 class WXDLLEXPORT wxWindow
;
20 class WXDLLEXPORT wxSize
;
22 #include "wx/x11/privx.h"
24 // Put any private declarations here: native Motif types may be used because
25 // this header is included after Xm/Xm.h
27 // ----------------------------------------------------------------------------
29 // ----------------------------------------------------------------------------
31 #define wxCHECK_MOTIF_VERSION( major, minor ) \
32 ( XmVersion >= (major) * 1000 + (minor) )
34 #define wxCHECK_LESSTIF_VERSION( major, minor ) \
35 ( LesstifVersion >= (major) * 1000 + (minor) )
37 #define wxCHECK_LESSTIF() ( defined(LesstifVersion) && LesstifVersion > 0 )
39 // ----------------------------------------------------------------------------
41 // ----------------------------------------------------------------------------
43 // All widgets should have this as their resize proc.
44 extern void wxWidgetResizeProc(Widget w
, XConfigureEvent
*event
,
45 String args
[], int *num_args
);
47 // For repainting arbitrary windows
48 void wxUniversalRepaintProc(Widget w
, XtPointer
WXUNUSED(c_data
),
49 XEvent
*event
, char *);
51 // ----------------------------------------------------------------------------
52 // we maintain a hash table which contains the mapping from Widget to wxWindow
53 // corresponding to the window for this widget
54 // ----------------------------------------------------------------------------
56 extern void wxDeleteWindowFromTable(Widget w
);
57 extern wxWindow
*wxGetWindowFromTable(Widget w
);
58 extern bool wxAddWindowToTable(Widget w
, wxWindow
*win
);
60 // ----------------------------------------------------------------------------
61 // key events related functions
62 // ----------------------------------------------------------------------------
64 extern char wxFindMnemonic(const char* s
);
66 extern char * wxFindAccelerator (const char *s
);
67 extern XmString
wxFindAcceleratorText (const char *s
);
69 // ----------------------------------------------------------------------------
70 // TranslateXXXEvent() functions - translate Motif event to wxWindow one
71 // ----------------------------------------------------------------------------
73 extern bool wxTranslateMouseEvent(wxMouseEvent
& wxevent
, wxWindow
*win
,
74 Widget widget
, XEvent
*xevent
);
75 extern bool wxTranslateKeyEvent(wxKeyEvent
& wxevent
, wxWindow
*win
,
76 Widget widget
, XEvent
*xevent
);
78 extern void wxDoChangeForegroundColour(WXWidget widget
,
79 wxColour
& foregroundColour
);
80 extern void wxDoChangeBackgroundColour(WXWidget widget
,
81 wxColour
& backgroundColour
,
82 bool changeArmColour
= FALSE
);
83 extern void wxDoChangeFont(WXWidget widget
, wxFont
& font
);
85 #define wxNO_COLORS 0x00
86 #define wxBACK_COLORS 0x01
87 #define wxFORE_COLORS 0x02
89 extern XColor itemColors
[5] ;
91 #define wxBACK_INDEX 0
92 #define wxFORE_INDEX 1
93 #define wxSELE_INDEX 2
94 #define wxTOPS_INDEX 3
95 #define wxBOTS_INDEX 4
97 // ----------------------------------------------------------------------------
99 // ----------------------------------------------------------------------------
101 wxString
wxXmStringToString( const XmString
& xmString
);
102 XmString
wxStringToXmString( const wxString
& string
);
103 XmString
wxStringToXmString( const char* string
);
105 // XmString made easy to use in wxWindows (and has an added benefit of
106 // cleaning up automatically)
110 wxXmString(const char* str
)
112 m_string
= XmStringCreateLtoR((char *)str
, XmSTRING_DEFAULT_CHARSET
);
115 wxXmString(const wxString
& str
)
117 m_string
= XmStringCreateLtoR((char *)str
.c_str(),
118 XmSTRING_DEFAULT_CHARSET
);
121 // just to avoid calling XmStringFree()
122 wxXmString(const XmString
& string
) { m_string
= string
; }
124 ~wxXmString() { XmStringFree(m_string
); }
126 // semi-implicit conversion to XmString (shouldn't rely on implicit
127 // conversion because many of Motif functions are macros)
128 XmString
operator()() const { return m_string
; }
134 // ----------------------------------------------------------------------------
135 // Routines used in both wxTextCtrl/wxListBox and nativa wxComboBox
136 // (defined in src/motif/listbox.cpp or src/motif/textctrl.cpp
137 // ----------------------------------------------------------------------------
139 int wxDoFindStringInList( Widget listWidget
, const wxString
& str
);
140 int wxDoGetSelectionInList( Widget listWidget
);
141 wxString
wxDoGetStringInList( Widget listWidget
, int n
);
142 wxSize
wxDoGetListBoxBestSize( Widget listWidget
, const wxWindow
* window
);
144 wxSize
wxDoGetSingleTextCtrlBestSize( Widget textWidget
,
145 const wxWindow
* window
);
147 // ----------------------------------------------------------------------------
148 // executes one main loop iteration (implemented in src/motif/evtloop.cpp)
149 // ----------------------------------------------------------------------------
153 // returns true if the loop should be exited
154 bool wxDoEventLoopIteration( wxEventLoop
& evtLoop
);
156 // ----------------------------------------------------------------------------
157 // macros to avoid casting WXFOO to Foo all the time
158 // ----------------------------------------------------------------------------
160 // argument is of type "wxWindow *"
161 #define GetWidget(w) ((Widget)(w)->GetHandle())
163 // ----------------------------------------------------------------------------
164 // accessors for C modules
165 // ----------------------------------------------------------------------------
167 extern "C" XtAppContext
wxGetAppContext();