]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/motif/private.h
better spacing
[wxWidgets.git] / include / wx / motif / private.h
... / ...
CommitLineData
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
18class WXDLLEXPORT wxFont;
19class WXDLLEXPORT wxWindow;
20class WXDLLEXPORT wxSize;
21
22#include "wx/x11/privx.h"
23
24// Put any private declarations here: native Motif types may be used because
25// this header is included after Xm/Xm.h
26
27// ----------------------------------------------------------------------------
28// convenience macros
29// ----------------------------------------------------------------------------
30
31#define wxCHECK_MOTIF_VERSION( major, minor ) \
32 ( XmVersion >= (major) * 1000 + (minor) )
33
34#define wxCHECK_LESSTIF_VERSION( major, minor ) \
35 ( LesstifVersion >= (major) * 1000 + (minor) )
36
37#define wxCHECK_LESSTIF() ( defined(LesstifVersion) && LesstifVersion > 0 )
38
39// ----------------------------------------------------------------------------
40// common callbacks
41// ----------------------------------------------------------------------------
42
43// All widgets should have this as their resize proc.
44extern void wxWidgetResizeProc(Widget w, XConfigureEvent *event,
45 String args[], int *num_args);
46
47// For repainting arbitrary windows
48void wxUniversalRepaintProc(Widget w, XtPointer WXUNUSED(c_data),
49 XEvent *event, char *);
50
51// ----------------------------------------------------------------------------
52// we maintain a hash table which contains the mapping from Widget to wxWindow
53// corresponding to the window for this widget
54// ----------------------------------------------------------------------------
55
56extern void wxDeleteWindowFromTable(Widget w);
57extern wxWindow *wxGetWindowFromTable(Widget w);
58extern bool wxAddWindowToTable(Widget w, wxWindow *win);
59
60// ----------------------------------------------------------------------------
61// key events related functions
62// ----------------------------------------------------------------------------
63
64extern char wxFindMnemonic(const char* s);
65
66extern char * wxFindAccelerator (const char *s);
67extern XmString wxFindAcceleratorText (const char *s);
68
69// ----------------------------------------------------------------------------
70// TranslateXXXEvent() functions - translate Motif event to wxWindow one
71// ----------------------------------------------------------------------------
72
73extern bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win,
74 Widget widget, XEvent *xevent);
75extern bool wxTranslateKeyEvent(wxKeyEvent& wxevent, wxWindow *win,
76 Widget widget, XEvent *xevent);
77
78extern void wxDoChangeForegroundColour(WXWidget widget,
79 wxColour& foregroundColour);
80extern void wxDoChangeBackgroundColour(WXWidget widget,
81 wxColour& backgroundColour,
82 bool changeArmColour = FALSE);
83extern void wxDoChangeFont(WXWidget widget, wxFont& font);
84
85#define wxNO_COLORS 0x00
86#define wxBACK_COLORS 0x01
87#define wxFORE_COLORS 0x02
88
89extern XColor itemColors[5] ;
90
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
96
97// ----------------------------------------------------------------------------
98// utility classes
99// ----------------------------------------------------------------------------
100
101wxString wxXmStringToString( const XmString& xmString );
102XmString wxStringToXmString( const wxString& string );
103XmString wxStringToXmString( const char* string );
104
105// XmString made easy to use in wxWindows (and has an added benefit of
106// cleaning up automatically)
107class wxXmString
108{
109public:
110 wxXmString(const char* str)
111 {
112 m_string = XmStringCreateLtoR((char *)str, XmSTRING_DEFAULT_CHARSET);
113 }
114
115 wxXmString(const wxString& str)
116 {
117 m_string = XmStringCreateLtoR((char *)str.c_str(),
118 XmSTRING_DEFAULT_CHARSET);
119 }
120
121 // just to avoid calling XmStringFree()
122 wxXmString(const XmString& string) { m_string = string; }
123
124 ~wxXmString() { XmStringFree(m_string); }
125
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; }
129
130private:
131 XmString m_string;
132};
133
134// ----------------------------------------------------------------------------
135// Routines used in both wxTextCtrl/wxListBox and nativa wxComboBox
136// (defined in src/motif/listbox.cpp or src/motif/textctrl.cpp
137// ----------------------------------------------------------------------------
138
139int wxDoFindStringInList( Widget listWidget, const wxString& str );
140int wxDoGetSelectionInList( Widget listWidget );
141wxString wxDoGetStringInList( Widget listWidget, int n );
142wxSize wxDoGetListBoxBestSize( Widget listWidget, const wxWindow* window );
143
144wxSize wxDoGetSingleTextCtrlBestSize( Widget textWidget,
145 const wxWindow* window );
146
147// ----------------------------------------------------------------------------
148// executes one main loop iteration (implemented in src/motif/evtloop.cpp)
149// ----------------------------------------------------------------------------
150
151class wxEventLoop;
152
153// returns true if the loop should be exited
154bool wxDoEventLoopIteration( wxEventLoop& evtLoop );
155
156// ----------------------------------------------------------------------------
157// macros to avoid casting WXFOO to Foo all the time
158// ----------------------------------------------------------------------------
159
160// argument is of type "wxWindow *"
161#define GetWidget(w) ((Widget)(w)->GetHandle())
162
163// ----------------------------------------------------------------------------
164// accessors for C modules
165// ----------------------------------------------------------------------------
166
167extern "C" XtAppContext wxGetAppContext();
168
169#endif
170// _WX_PRIVATE_H_