]> git.saurik.com Git - wxWidgets.git/blame - include/wx/motif/private.h
compilation fix -- a better way
[wxWidgets.git] / include / wx / motif / private.h
CommitLineData
9b6dbb09
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: private.h
34636400 3// Purpose: Private declarations for wxMotif port
9b6dbb09
JS
4// Author: Julian Smart
5// Modified by:
6// Created: 17/09/98
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart
34636400 9// Licence: wxWindows licence
9b6dbb09
JS
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_PRIVATE_H_
13#define _WX_PRIVATE_H_
14
15#include "wx/defs.h"
7266b672 16#include "X11/Xlib.h"
9b6dbb09 17
34636400
VZ
18class wxMouseEvent;
19class wxKeyEvent;
dfc54541 20
34636400
VZ
21// Put any private declarations here: native Motif types may be used because
22// this header is included after Xm/Xm.h
9b6dbb09 23
34636400
VZ
24// ----------------------------------------------------------------------------
25// common callbacks
26// ----------------------------------------------------------------------------
27
28// All widgets should have this as their resize proc.
9b6dbb09
JS
29extern void wxWidgetResizeProc(Widget w, XConfigureEvent *event, String args[], int *num_args);
30
34636400
VZ
31// For repainting arbitrary windows
32void wxUniversalRepaintProc(Widget w, XtPointer WXUNUSED(c_data), XEvent *event, char *);
33
34// ----------------------------------------------------------------------------
35// we maintain a hash table which contains the mapping from Widget to wxWindow
36// corresponding to the window for this widget
37// ----------------------------------------------------------------------------
38
9b6dbb09
JS
39extern void wxDeleteWindowFromTable(Widget w);
40extern wxWindow *wxGetWindowFromTable(Widget w);
41extern bool wxAddWindowToTable(Widget w, wxWindow *win);
34636400 42
31528cd3
VZ
43// ----------------------------------------------------------------------------
44// key events related functions
45// ----------------------------------------------------------------------------
46
50414e24 47extern char wxFindMnemonic(const char* s);
31528cd3
VZ
48
49extern char * wxFindAccelerator (const char *s);
50extern XmString wxFindAcceleratorText (const char *s);
51
50414e24
JS
52extern int wxCharCodeXToWX(KeySym keySym);
53extern KeySym wxCharCodeWXToX(int id);
34636400
VZ
54
55// ----------------------------------------------------------------------------
56// TranslateXXXEvent() functions - translate Motif event to wxWindow one
57// ----------------------------------------------------------------------------
58extern bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win, Widget widget, XEvent *xevent);
59extern bool wxTranslateKeyEvent(wxKeyEvent& wxevent, wxWindow *win, Widget widget, XEvent *xevent);
60
dfc54541 61int wxGetBestMatchingPixel(Display *display, XColor *desiredColor, Colormap cmap);
a4294b78 62Pixmap XCreateInsensitivePixmap( Display *display, Pixmap pixmap );
34636400 63
0d57be45
JS
64extern XColor g_itemColors[];
65extern int wxComputeColours (Display *display, wxColour * back, wxColour * fore);
02e8b2f9 66
94b49b93
JS
67extern void wxDoChangeForegroundColour(WXWidget widget, wxColour& foregroundColour);
68extern void wxDoChangeBackgroundColour(WXWidget widget, wxColour& backgroundColour, bool changeArmColour = FALSE);
69
34636400 70#define wxNO_COLORS 0x00
02e8b2f9
JS
71#define wxBACK_COLORS 0x01
72#define wxFORE_COLORS 0x02
73
74extern XColor itemColors[5] ;
75
76#define wxBACK_INDEX 0
77#define wxFORE_INDEX 1
78#define wxSELE_INDEX 2
79#define wxTOPS_INDEX 3
80#define wxBOTS_INDEX 4
9b6dbb09 81
ee31c392
VZ
82// ----------------------------------------------------------------------------
83// utility classes
84// ----------------------------------------------------------------------------
85
86// XmString made easy to use in wxWindows (and has an added benefit of
87// cleaning up automatically)
88class wxXmString
89{
90public:
91 wxXmString(const wxString& str)
92 {
93 m_string = XmStringCreateLtoR((char *)str.c_str(),
83df96d6 94 XmSTRING_DEFAULT_CHARSET);
ee31c392 95 }
83df96d6 96
ee31c392 97 ~wxXmString() { XmStringFree(m_string); }
83df96d6 98
ee31c392
VZ
99 // semi-implicit conversion to XmString (shouldn't rely on implicit
100 // conversion because many of Motif functions are macros)
101 XmString operator()() const { return m_string; }
83df96d6 102
ee31c392
VZ
103private:
104 XmString m_string;
105};
106
107// ----------------------------------------------------------------------------
108// macros to avoid casting WXFOO to Foo all the time
109// ----------------------------------------------------------------------------
110
111// argument is of type "wxWindow *"
112#define GetWidget(w) ((Widget)(w)->GetHandle())
113
d391a345
VZ
114// ----------------------------------------------------------------------------
115// accessors for C modules
116// ----------------------------------------------------------------------------
117
118extern "C" XtAppContext wxGetAppContext();
119
7266b672
JS
120#define wxMAX_RGB 0xff
121#define wxMAX_SV 1000
122#define wxSIGN(x) ((x < 0) ? -x : x)
123#define wxH_WEIGHT 4
124#define wxS_WEIGHT 1
125#define wxV_WEIGHT 2
126
127typedef struct wx_hsv {
128 int h,s,v;
129 } wxHSV;
130
131#define wxMax3(x,y,z) ((x > y) ? ((x > z) ? x : z) : ((y > z) ? y : z))
132#define wxMin3(x,y,z) ((x < y) ? ((x < z) ? x : z) : ((y < z) ? y : z))
133
134void wxHSVToXColor(wxHSV *hsv,XColor *xcolor);
135void wxXColorToHSV(wxHSV *hsv,XColor *xcolor);
136void wxAllocNearestColor(Display *display,Colormap colormap,XColor *xcolor);
137void wxAllocColor(Display *display,Colormap colormap,XColor *xcolor);
138
9b6dbb09 139#endif
83df96d6 140// _WX_PRIVATE_H_