2002-02-05 11:34:33 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: private.h
|
2002-02-08 07:00:11 -05:00
|
|
|
// Purpose: Private declarations for X11 port
|
2002-02-05 11:34:33 -05:00
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 17/09/98
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) Julian Smart
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_PRIVATE_H_
|
|
|
|
#define _WX_PRIVATE_H_
|
|
|
|
|
|
|
|
#include "wx/defs.h"
|
2002-02-10 11:42:42 -05:00
|
|
|
#include "wx/utils.h"
|
2002-02-08 12:44:23 -05:00
|
|
|
#include "X11/Xlib.h"
|
2002-02-05 11:34:33 -05:00
|
|
|
|
|
|
|
class wxMouseEvent;
|
|
|
|
class wxKeyEvent;
|
2002-02-10 11:42:42 -05:00
|
|
|
class wxWindow;
|
2002-02-05 11:34:33 -05:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// common callbacks
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2002-02-08 07:00:11 -05:00
|
|
|
#if 0
|
2002-02-05 11:34:33 -05:00
|
|
|
// All widgets should have this as their resize proc.
|
|
|
|
extern void wxWidgetResizeProc(Widget w, XConfigureEvent *event, String args[], int *num_args);
|
|
|
|
|
|
|
|
// For repainting arbitrary windows
|
|
|
|
void wxUniversalRepaintProc(Widget w, XtPointer WXUNUSED(c_data), XEvent *event, char *);
|
2002-02-08 07:00:11 -05:00
|
|
|
#endif
|
2002-02-05 11:34:33 -05:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// we maintain a hash table which contains the mapping from Widget to wxWindow
|
|
|
|
// corresponding to the window for this widget
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2002-02-08 07:00:11 -05:00
|
|
|
extern void wxDeleteWindowFromTable(Window w);
|
|
|
|
extern wxWindow *wxGetWindowFromTable(Window w);
|
|
|
|
extern bool wxAddWindowToTable(Window w, wxWindow *win);
|
2002-02-05 11:34:33 -05:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// key events related functions
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
extern char wxFindMnemonic(const char* s);
|
|
|
|
|
|
|
|
extern char * wxFindAccelerator (const char *s);
|
2002-02-08 07:00:11 -05:00
|
|
|
//extern XmString wxFindAcceleratorText (const char *s);
|
2002-02-05 11:34:33 -05:00
|
|
|
|
|
|
|
extern int wxCharCodeXToWX(KeySym keySym);
|
|
|
|
extern KeySym wxCharCodeWXToX(int id);
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// TranslateXXXEvent() functions - translate Motif event to wxWindow one
|
|
|
|
// ----------------------------------------------------------------------------
|
2002-02-08 07:00:11 -05:00
|
|
|
extern bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win, Window window, XEvent *xevent);
|
|
|
|
extern bool wxTranslateKeyEvent(wxKeyEvent& wxevent, wxWindow *win, Window window, XEvent *xevent);
|
2002-02-05 11:34:33 -05:00
|
|
|
|
|
|
|
int wxGetBestMatchingPixel(Display *display, XColor *desiredColor, Colormap cmap);
|
|
|
|
Pixmap XCreateInsensitivePixmap( Display *display, Pixmap pixmap );
|
|
|
|
|
|
|
|
extern XColor g_itemColors[];
|
|
|
|
extern int wxComputeColours (Display *display, wxColour * back, wxColour * fore);
|
|
|
|
|
2002-02-09 20:03:45 -05:00
|
|
|
extern Window wxGetWindowParent(Window window);
|
|
|
|
|
2002-02-11 06:06:50 -05:00
|
|
|
// Set the window manager decorations according to the
|
|
|
|
// given wxWindows style
|
|
|
|
bool wxSetWMDecorations(Window w, long style);
|
|
|
|
bool wxMWMIsRunning(Window w);
|
|
|
|
|
2002-02-09 20:03:45 -05:00
|
|
|
// For convenience
|
|
|
|
inline Display* wxGlobalDisplay() { return (Display*) wxGetDisplay(); }
|
|
|
|
|
2002-02-05 11:34:33 -05:00
|
|
|
#define wxNO_COLORS 0x00
|
|
|
|
#define wxBACK_COLORS 0x01
|
|
|
|
#define wxFORE_COLORS 0x02
|
|
|
|
|
|
|
|
extern XColor itemColors[5] ;
|
|
|
|
|
|
|
|
#define wxBACK_INDEX 0
|
|
|
|
#define wxFORE_INDEX 1
|
|
|
|
#define wxSELE_INDEX 2
|
|
|
|
#define wxTOPS_INDEX 3
|
|
|
|
#define wxBOTS_INDEX 4
|
|
|
|
|
2002-02-08 12:44:23 -05:00
|
|
|
#define wxMAX_RGB 0xff
|
|
|
|
#define wxMAX_SV 1000
|
|
|
|
#define wxSIGN(x) ((x < 0) ? -x : x)
|
|
|
|
#define wxH_WEIGHT 4
|
|
|
|
#define wxS_WEIGHT 1
|
|
|
|
#define wxV_WEIGHT 2
|
|
|
|
|
|
|
|
typedef struct wx_hsv {
|
|
|
|
int h,s,v;
|
|
|
|
} wxHSV;
|
|
|
|
|
|
|
|
#define wxMax3(x,y,z) ((x > y) ? ((x > z) ? x : z) : ((y > z) ? y : z))
|
|
|
|
#define wxMin3(x,y,z) ((x < y) ? ((x < z) ? x : z) : ((y < z) ? y : z))
|
|
|
|
|
|
|
|
void wxHSVToXColor(wxHSV *hsv,XColor *xcolor);
|
|
|
|
void wxXColorToHSV(wxHSV *hsv,XColor *xcolor);
|
|
|
|
void wxAllocNearestColor(Display *display,Colormap colormap,XColor *xcolor);
|
|
|
|
void wxAllocColor(Display *display,Colormap colormap,XColor *xcolor);
|
|
|
|
|
2002-02-05 11:34:33 -05:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// accessors for C modules
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2002-02-08 07:00:11 -05:00
|
|
|
// extern "C" XtAppContext wxGetAppContext();
|
2002-02-05 11:34:33 -05:00
|
|
|
|
|
|
|
#endif
|
|
|
|
// _WX_PRIVATE_H_
|