Motif additions
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@868 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -142,7 +142,7 @@ public:
|
|||||||
wxBitmap(const char bits[], int width, int height, int depth = 1);
|
wxBitmap(const char bits[], int width, int height, int depth = 1);
|
||||||
|
|
||||||
// Initialize with XPM data
|
// Initialize with XPM data
|
||||||
wxBitmap(const char **data, wxControl* control = NULL);
|
wxBitmap(char **data, wxControl* control = NULL);
|
||||||
|
|
||||||
// Load a file or resource
|
// Load a file or resource
|
||||||
wxBitmap(const wxString& name, long type = wxBITMAP_TYPE_XBM);
|
wxBitmap(const wxString& name, long type = wxBITMAP_TYPE_XBM);
|
||||||
|
@@ -26,7 +26,8 @@ class WXDLLEXPORT wxBitmapButton: public wxButton
|
|||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxBitmapButton)
|
DECLARE_DYNAMIC_CLASS(wxBitmapButton)
|
||||||
public:
|
public:
|
||||||
inline wxBitmapButton() { m_marginX = wxDEFAULT_BUTTON_MARGIN; m_marginY = wxDEFAULT_BUTTON_MARGIN; }
|
wxBitmapButton();
|
||||||
|
~wxBitmapButton();
|
||||||
inline wxBitmapButton(wxWindow *parent, wxWindowID id, const wxBitmap& bitmap,
|
inline wxBitmapButton(wxWindow *parent, wxWindowID id, const wxBitmap& bitmap,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxSize& size = wxDefaultSize, long style = wxBU_AUTODRAW,
|
const wxSize& size = wxDefaultSize, long style = wxBU_AUTODRAW,
|
||||||
@@ -54,29 +55,24 @@ class WXDLLEXPORT wxBitmapButton: public wxButton
|
|||||||
inline wxBitmap& GetBitmapFocus() const { return (wxBitmap&) m_buttonBitmapFocus; }
|
inline wxBitmap& GetBitmapFocus() const { return (wxBitmap&) m_buttonBitmapFocus; }
|
||||||
inline wxBitmap& GetBitmapDisabled() const { return (wxBitmap&) m_buttonBitmapDisabled; }
|
inline wxBitmap& GetBitmapDisabled() const { return (wxBitmap&) m_buttonBitmapDisabled; }
|
||||||
|
|
||||||
inline void SetBitmapSelected(const wxBitmap& sel) { m_buttonBitmapSelected = sel; };
|
void SetBitmapSelected(const wxBitmap& sel);
|
||||||
inline void SetBitmapFocus(const wxBitmap& focus) { m_buttonBitmapFocus = focus; };
|
void SetBitmapFocus(const wxBitmap& focus);
|
||||||
inline void SetBitmapDisabled(const wxBitmap& disabled) { m_buttonBitmapDisabled = disabled; };
|
void SetBitmapDisabled(const wxBitmap& disabled);
|
||||||
|
|
||||||
inline void SetMargins(int x, int y) { m_marginX = x; m_marginY = y; }
|
inline void SetMargins(int x, int y) { m_marginX = x; m_marginY = y; }
|
||||||
inline int GetMarginX() { return m_marginX; }
|
inline int GetMarginX() { return m_marginX; }
|
||||||
inline int GetMarginY() { return m_marginY; }
|
inline int GetMarginY() { return m_marginY; }
|
||||||
|
|
||||||
/*
|
|
||||||
// TODO: Implementation
|
|
||||||
virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item);
|
|
||||||
virtual void DrawFace( WXHDC dc, int left, int top, int right, int bottom, bool sel );
|
|
||||||
virtual void DrawButtonFocus( WXHDC dc, int left, int top, int right, int bottom, bool sel );
|
|
||||||
virtual void DrawButtonDisable( WXHDC dc, int left, int top, int right, int bottom, bool with_marg );
|
|
||||||
*/
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
wxBitmap m_buttonBitmap;
|
wxBitmap m_buttonBitmap;
|
||||||
wxBitmap m_buttonBitmapSelected;
|
wxBitmap m_buttonBitmapSelected;
|
||||||
wxBitmap m_buttonBitmapFocus;
|
wxBitmap m_buttonBitmapFocus;
|
||||||
wxBitmap m_buttonBitmapDisabled;
|
wxBitmap m_buttonBitmapDisabled;
|
||||||
|
|
||||||
int m_marginX;
|
int m_marginX;
|
||||||
int m_marginY;
|
int m_marginY;
|
||||||
|
|
||||||
|
WXPixmap m_insensPixmap;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -77,8 +77,6 @@ protected:
|
|||||||
WXWidget* m_widgetList ;
|
WXWidget* m_widgetList ;
|
||||||
WXWidget m_formWidget;
|
WXWidget m_formWidget;
|
||||||
wxStringList m_stringList;
|
wxStringList m_stringList;
|
||||||
public:
|
|
||||||
bool m_inSetValue;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -40,9 +40,13 @@ public:
|
|||||||
|
|
||||||
inline wxFunction GetCallback() { return m_callback; }
|
inline wxFunction GetCallback() { return m_callback; }
|
||||||
|
|
||||||
|
inline bool InSetValue() const { return m_inSetValue; }
|
||||||
protected:
|
protected:
|
||||||
wxFunction m_callback; // Callback associated with the window
|
wxFunction m_callback; // Callback associated with the window
|
||||||
|
|
||||||
|
bool m_inSetValue; // Motif: prevent callbacks being called while
|
||||||
|
// in SetValue
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -97,6 +97,7 @@ class WXDLLEXPORT wxWindowDC: public wxDC
|
|||||||
void SetDCClipping (); // Helper function for setting clipping
|
void SetDCClipping (); // Helper function for setting clipping
|
||||||
|
|
||||||
inline WXGC GetGC() const { return m_gc; }
|
inline WXGC GetGC() const { return m_gc; }
|
||||||
|
inline WXDisplay* GetDisplay() const { return m_display; }
|
||||||
inline bool GetAutoSetting() const { return m_autoSetting; }
|
inline bool GetAutoSetting() const { return m_autoSetting; }
|
||||||
inline void SetAutoSetting(bool flag) { m_autoSetting = flag; }
|
inline void SetAutoSetting(bool flag) { m_autoSetting = flag; }
|
||||||
|
|
||||||
|
@@ -49,7 +49,7 @@ public:
|
|||||||
wxIcon(const char bits[], int width, int height);
|
wxIcon(const char bits[], int width, int height);
|
||||||
|
|
||||||
// Initialize with XPM data
|
// Initialize with XPM data
|
||||||
wxIcon(const char **data);
|
wxIcon(char **data);
|
||||||
|
|
||||||
wxIcon(const wxString& name, long flags = wxBITMAP_TYPE_ICO_RESOURCE,
|
wxIcon(const wxString& name, long flags = wxBITMAP_TYPE_ICO_RESOURCE,
|
||||||
int desiredWidth = -1, int desiredHeight = -1);
|
int desiredWidth = -1, int desiredHeight = -1);
|
||||||
|
@@ -97,9 +97,6 @@ protected:
|
|||||||
|
|
||||||
// List mapping positions->client data
|
// List mapping positions->client data
|
||||||
wxList m_clientDataList;
|
wxList m_clientDataList;
|
||||||
|
|
||||||
public:
|
|
||||||
bool m_inSetValue;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -34,6 +34,7 @@ extern KeySym wxCharCodeWXToX(int id);
|
|||||||
bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win, Widget widget, XEvent *xevent);
|
bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win, Widget widget, XEvent *xevent);
|
||||||
bool wxTranslateKeyEvent(wxKeyEvent& wxevent, wxWindow *win, Widget widget, XEvent *xevent);
|
bool wxTranslateKeyEvent(wxKeyEvent& wxevent, wxWindow *win, Widget widget, XEvent *xevent);
|
||||||
int wxGetBestMatchingPixel(Display *display, XColor *desiredColor, Colormap cmap);
|
int wxGetBestMatchingPixel(Display *display, XColor *desiredColor, Colormap cmap);
|
||||||
|
Pixmap XCreateInsensitivePixmap( Display *display, Pixmap pixmap );
|
||||||
|
|
||||||
#define wxNO_COLORS 0x00
|
#define wxNO_COLORS 0x00
|
||||||
#define wxBACK_COLORS 0x01
|
#define wxBACK_COLORS 0x01
|
||||||
|
@@ -51,19 +51,14 @@ public:
|
|||||||
int GetSelection() const;
|
int GetSelection() const;
|
||||||
wxString GetString(int N) const;
|
wxString GetString(int N) const;
|
||||||
void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
|
void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
|
||||||
void GetSize(int *x, int *y) const;
|
void SetLabel(const wxString& label) { wxControl::SetLabel(label); };
|
||||||
void GetPosition(int *x, int *y) const;
|
|
||||||
wxString GetLabel() const;
|
|
||||||
void SetLabel(const wxString& label);
|
|
||||||
void SetLabel(int item, const wxString& label) ;
|
void SetLabel(int item, const wxString& label) ;
|
||||||
wxString GetLabel(int item) const;
|
wxString GetLabel(int item) const;
|
||||||
bool Show(bool show);
|
wxString GetLabel() const { return wxControl::GetLabel(); };
|
||||||
void SetFocus();
|
|
||||||
void Enable(bool enable);
|
void Enable(bool enable);
|
||||||
void Enable(int item, bool enable);
|
void Enable(int item, bool enable);
|
||||||
void Show(int item, bool show) ;
|
void Show(int item, bool show) ;
|
||||||
inline void SetLabelFont(const wxFont& WXUNUSED(font)) {};
|
bool Show(bool show) { return wxControl::Show(show); };
|
||||||
inline void SetButtonFont(const wxFont& font) { SetFont(font); }
|
|
||||||
|
|
||||||
virtual wxString GetStringSelection() const;
|
virtual wxString GetStringSelection() const;
|
||||||
virtual bool SetStringSelection(const wxString& s);
|
virtual bool SetStringSelection(const wxString& s);
|
||||||
@@ -73,15 +68,21 @@ public:
|
|||||||
inline int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; }
|
inline int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; }
|
||||||
inline void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; }
|
inline void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; }
|
||||||
|
|
||||||
|
WXWidget GetTopWidget() const { return m_formWidget; }
|
||||||
|
WXWidget GetLabelWidget() const { return m_labelWidget; }
|
||||||
|
inline WXWidget* GetRadioButtons() const { return m_radioButtons; }
|
||||||
|
inline void SetSel(int i) { m_selectedButton = i; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/* TODO: implementation
|
|
||||||
WXHWND * m_radioButtons;
|
|
||||||
*/
|
|
||||||
int m_majorDim ;
|
int m_majorDim ;
|
||||||
int m_noItems;
|
int m_noItems;
|
||||||
int m_noRowsOrCols;
|
int m_noRowsOrCols;
|
||||||
int m_selectedButton;
|
int m_selectedButton;
|
||||||
|
|
||||||
|
WXWidget m_formWidget;
|
||||||
|
WXWidget m_labelWidget;
|
||||||
|
WXWidget* m_radioButtons;
|
||||||
|
wxString* m_radioButtonLabels;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -25,7 +25,7 @@ class WXDLLEXPORT wxRadioButton: public wxControl
|
|||||||
DECLARE_DYNAMIC_CLASS(wxRadioButton)
|
DECLARE_DYNAMIC_CLASS(wxRadioButton)
|
||||||
protected:
|
protected:
|
||||||
public:
|
public:
|
||||||
inline wxRadioButton() {}
|
wxRadioButton();
|
||||||
inline wxRadioButton(wxWindow *parent, wxWindowID id,
|
inline wxRadioButton(wxWindow *parent, wxWindowID id,
|
||||||
const wxString& label,
|
const wxString& label,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
@@ -43,11 +43,17 @@ class WXDLLEXPORT wxRadioButton: public wxControl
|
|||||||
const wxValidator& validator = wxDefaultValidator,
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
const wxString& name = wxRadioButtonNameStr);
|
const wxString& name = wxRadioButtonNameStr);
|
||||||
|
|
||||||
virtual void SetLabel(const wxString& label);
|
|
||||||
virtual void SetValue(bool val);
|
virtual void SetValue(bool val);
|
||||||
virtual bool GetValue() const ;
|
virtual bool GetValue() const ;
|
||||||
|
|
||||||
void Command(wxCommandEvent& event);
|
void Command(wxCommandEvent& event);
|
||||||
|
|
||||||
|
WXWidget GetTopWidget() const { return m_formWidget; }
|
||||||
|
WXWidget GetLabelWidget() const { return m_labelWidget; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
WXWidget m_formWidget;
|
||||||
|
WXWidget m_labelWidget;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Not implemented
|
// Not implemented
|
||||||
|
@@ -51,6 +51,9 @@
|
|||||||
// AIAI spline code is slower, but freer of copyright issues.
|
// AIAI spline code is slower, but freer of copyright issues.
|
||||||
// 0 for no splines
|
// 0 for no splines
|
||||||
|
|
||||||
|
#define wxUSE_XPM 1
|
||||||
|
// Use XPMs
|
||||||
|
|
||||||
#define wxUSE_TOOLBAR 1
|
#define wxUSE_TOOLBAR 1
|
||||||
// Use toolbars
|
// Use toolbars
|
||||||
#define wxUSE_COMBOBOX 1
|
#define wxUSE_COMBOBOX 1
|
||||||
@@ -110,6 +113,10 @@
|
|||||||
// if enabled, compiles built-in OS independent wxConfig
|
// if enabled, compiles built-in OS independent wxConfig
|
||||||
// class and it's file (any platform) and registry (Win)
|
// class and it's file (any platform) and registry (Win)
|
||||||
// based implementations
|
// based implementations
|
||||||
|
|
||||||
|
#define wxUSE_GADGETS 0
|
||||||
|
// Use gadgets where possible
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Finer detail
|
* Finer detail
|
||||||
*
|
*
|
||||||
|
@@ -53,8 +53,6 @@ public:
|
|||||||
virtual void SetValue(int);
|
virtual void SetValue(int);
|
||||||
void GetSize(int *x, int *y) const ;
|
void GetSize(int *x, int *y) const ;
|
||||||
void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
|
void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
|
||||||
void GetPosition(int *x, int *y) const ;
|
|
||||||
bool Show(bool show);
|
|
||||||
|
|
||||||
void SetRange(int minValue, int maxValue);
|
void SetRange(int minValue, int maxValue);
|
||||||
|
|
||||||
|
@@ -25,6 +25,7 @@ class WXDLLEXPORT wxStaticBitmap: public wxControl
|
|||||||
DECLARE_DYNAMIC_CLASS(wxStaticBitmap)
|
DECLARE_DYNAMIC_CLASS(wxStaticBitmap)
|
||||||
public:
|
public:
|
||||||
inline wxStaticBitmap() { }
|
inline wxStaticBitmap() { }
|
||||||
|
~wxStaticBitmap();
|
||||||
|
|
||||||
inline wxStaticBitmap(wxWindow *parent, wxWindowID id,
|
inline wxStaticBitmap(wxWindow *parent, wxWindowID id,
|
||||||
const wxBitmap& label,
|
const wxBitmap& label,
|
||||||
|
@@ -139,7 +139,6 @@ public:
|
|||||||
void* m_tempCallbackStruct;
|
void* m_tempCallbackStruct;
|
||||||
bool m_modified;
|
bool m_modified;
|
||||||
wxString m_value; // Required for password text controls
|
wxString m_value; // Required for password text controls
|
||||||
bool m_inSetValue;
|
|
||||||
bool m_processedDefault; // Did we call wxTextCtrl::OnChar?
|
bool m_processedDefault; // Did we call wxTextCtrl::OnChar?
|
||||||
// If so, generate a command event.
|
// If so, generate a command event.
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
|
@@ -465,7 +465,7 @@ public:
|
|||||||
|
|
||||||
// Get main widget for this window, e.g. a text widget
|
// Get main widget for this window, e.g. a text widget
|
||||||
virtual WXWidget GetMainWidget() const;
|
virtual WXWidget GetMainWidget() const;
|
||||||
// Get the widget that supports font setting
|
// Get the widget that corresponds to the label (for font setting, label setting etc.)
|
||||||
virtual WXWidget GetLabelWidget() const { return GetMainWidget(); }
|
virtual WXWidget GetLabelWidget() const { return GetMainWidget(); }
|
||||||
// Get the client widget for this window (something we can
|
// Get the client widget for this window (something we can
|
||||||
// create other windows on)
|
// create other windows on)
|
||||||
|
17
samples/config/makefile.unx
Normal file
17
samples/config/makefile.unx
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#
|
||||||
|
# File: makefile.unx
|
||||||
|
# Author: Julian Smart
|
||||||
|
# Created: 1998
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) 1998 Julian Smart
|
||||||
|
#
|
||||||
|
# "%W% %G%"
|
||||||
|
#
|
||||||
|
# Makefile for config example (UNIX).
|
||||||
|
|
||||||
|
PROGRAM=conftest
|
||||||
|
|
||||||
|
OBJECTS=$(PROGRAM).o
|
||||||
|
|
||||||
|
include ../../src/makeprog.env
|
||||||
|
|
17
samples/controls/makefile.unx
Normal file
17
samples/controls/makefile.unx
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#
|
||||||
|
# File: makefile.unx
|
||||||
|
# Author: Julian Smart
|
||||||
|
# Created: 1998
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) 1998 Julian Smart
|
||||||
|
#
|
||||||
|
# "%W% %G%"
|
||||||
|
#
|
||||||
|
# Makefile for controls example (UNIX).
|
||||||
|
|
||||||
|
PROGRAM=controls
|
||||||
|
|
||||||
|
OBJECTS=$(PROGRAM).o
|
||||||
|
|
||||||
|
include ../../src/makeprog.env
|
||||||
|
|
17
samples/dialogs/makefile.unx
Normal file
17
samples/dialogs/makefile.unx
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#
|
||||||
|
# File: makefile.unx
|
||||||
|
# Author: Julian Smart
|
||||||
|
# Created: 1998
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) 1998 Julian Smart
|
||||||
|
#
|
||||||
|
# "%W% %G%"
|
||||||
|
#
|
||||||
|
# Makefile for dialogs example (UNIX).
|
||||||
|
|
||||||
|
PROGRAM=dialogs
|
||||||
|
|
||||||
|
OBJECTS=$(PROGRAM).o
|
||||||
|
|
||||||
|
include ../../src/makeprog.env
|
||||||
|
|
@@ -257,6 +257,8 @@ MyCanvas *MyFrame::CreateCanvas(wxView *view, wxFrame *parent)
|
|||||||
|
|
||||||
// Give it scrollbars
|
// Give it scrollbars
|
||||||
canvas->SetScrollbars(20, 20, 50, 50);
|
canvas->SetScrollbars(20, 20, 50, 50);
|
||||||
|
canvas->SetBackgroundColour(*wxWHITE);
|
||||||
|
canvas->Clear();
|
||||||
|
|
||||||
return canvas;
|
return canvas;
|
||||||
}
|
}
|
||||||
|
17
samples/dynamic/makefile.unx
Normal file
17
samples/dynamic/makefile.unx
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#
|
||||||
|
# File: makefile.unx
|
||||||
|
# Author: Julian Smart
|
||||||
|
# Created: 1998
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) 1998 Julian Smart
|
||||||
|
#
|
||||||
|
# "%W% %G%"
|
||||||
|
#
|
||||||
|
# Makefile for dynamic example (UNIX).
|
||||||
|
|
||||||
|
PROGRAM=dynamic
|
||||||
|
|
||||||
|
OBJECTS=$(PROGRAM).o
|
||||||
|
|
||||||
|
include ../../src/makeprog.env
|
||||||
|
|
17
samples/grid/makefile.unx
Normal file
17
samples/grid/makefile.unx
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#
|
||||||
|
# File: makefile.unx
|
||||||
|
# Author: Julian Smart
|
||||||
|
# Created: 1998
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) 1998 Julian Smart
|
||||||
|
#
|
||||||
|
# "%W% %G%"
|
||||||
|
#
|
||||||
|
# Makefile for grid example (UNIX).
|
||||||
|
|
||||||
|
PROGRAM=test
|
||||||
|
|
||||||
|
OBJECTS=$(PROGRAM).o
|
||||||
|
|
||||||
|
include ../../src/makeprog.env
|
||||||
|
|
@@ -1,58 +1,17 @@
|
|||||||
#
|
#
|
||||||
# File: makefile.unx
|
# File: makefile.unx
|
||||||
# Author: Julian Smart
|
# Author: Julian Smart
|
||||||
# Created: 1993
|
# Created: 1998
|
||||||
# Updated:
|
# Updated:
|
||||||
# Copyright: (c) 1993, AIAI, University of Edinburgh
|
# Copyright: (c) 1998 Julian Smart
|
||||||
#
|
#
|
||||||
# "%W% %G%"
|
# "%W% %G%"
|
||||||
#
|
#
|
||||||
# Makefile for minimal example (UNIX).
|
# Makefile for internat example (UNIX).
|
||||||
|
|
||||||
WXDIR = ../..
|
PROGRAM=internat
|
||||||
|
|
||||||
# All common UNIX compiler flags and options are now in
|
OBJECTS=$(PROGRAM).o
|
||||||
# this central makefile.
|
|
||||||
include $(WXDIR)/src/make.env
|
|
||||||
|
|
||||||
OBJECTS = $(OBJDIR)/minimal.$(OBJSUFF)
|
include ../../src/makeprog.env
|
||||||
|
|
||||||
.SUFFIXES:
|
|
||||||
|
|
||||||
all: $(OBJDIR) minimal$(GUISUFFIX)
|
|
||||||
|
|
||||||
wx:
|
|
||||||
|
|
||||||
|
|
||||||
motif:
|
|
||||||
$(MAKE) -f makefile.unx GUISUFFIX=_motif GUI=-Dwx_motif GUISUFFIX=_motif OPT='$(OPT)' LDLIBS='$(MOTIFLDLIBS)' WXLIB=$(WXDIR)/lib/libwx_motif.a OPTIONS='$(OPTIONS)' DEBUG='$(DEBUG)' WARN='$(WARN)' XLIB='$(XLIB)' XINCLUDE='$(XINCLUDE)' XVIEW_LINK=
|
|
||||||
|
|
||||||
xview:
|
|
||||||
cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx xview
|
|
||||||
$(MAKE) -f makefile.unx GUI=-Dwx_xview GUISUFFIX=_ol CC=$(CC) OPTIONS='$(OPTIONS)' DEBUG='$(DEBUG)' WARN='$(WARN)' XLIB='$(XLIB)' XINCLUDE='$(XINCLUDE)'
|
|
||||||
|
|
||||||
hp:
|
|
||||||
cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx hp
|
|
||||||
$(MAKE) -f makefile.unx GUI=-Dwx_motif GUISUFFIX=_hp CC=CC DEBUG='$(DEBUG)' WARN='-w' \
|
|
||||||
XINCLUDE='$(HPXINCLUDE)' XLIB='$(HPXLIB)' XVIEW_LINK='' LDLIBS='$(HPLDLIBS)'
|
|
||||||
|
|
||||||
$(OBJDIR):
|
|
||||||
mkdir $(OBJDIR)
|
|
||||||
|
|
||||||
minimal$(GUISUFFIX): $(OBJDIR)/minimal.$(OBJSUFF) $(WXLIB)
|
|
||||||
$(CC) $(LDFLAGS) -o minimal$(GUISUFFIX) $(OBJDIR)/minimal.$(OBJSUFF) $(XVIEW_LINK) $(LDLIBS)
|
|
||||||
|
|
||||||
$(OBJDIR)/minimal.$(OBJSUFF): minimal.$(SRCSUFF)
|
|
||||||
$(CC) -c $(CPPFLAGS) -o $@ minimal.$(SRCSUFF)
|
|
||||||
|
|
||||||
clean_motif:
|
|
||||||
$(MAKE) -f makefile.unx GUISUFFIX=_motif cleanany
|
|
||||||
|
|
||||||
clean_ol:
|
|
||||||
$(MAKE) -f makefile.unx GUISUFFIX=_ol cleanany
|
|
||||||
|
|
||||||
clean_hp:
|
|
||||||
$(MAKE) -f makefile.unx GUISUFFIX=_hp cleanany
|
|
||||||
|
|
||||||
cleanany:
|
|
||||||
rm -f $(OBJECTS) minimal$(GUISUFFIX) core
|
|
||||||
|
@@ -1,55 +1,17 @@
|
|||||||
#
|
#
|
||||||
# File: makefile.unx
|
# File: makefile.unx
|
||||||
# Author: Julian Smart
|
# Author: Julian Smart
|
||||||
# Created: 1993
|
# Created: 1998
|
||||||
# Updated:
|
# Updated:
|
||||||
# Copyright: (c) 1993, AIAI, University of Edinburgh
|
# Copyright: (c) 1998 Julian Smart
|
||||||
#
|
#
|
||||||
# "%W% %G%"
|
# "%W% %G%"
|
||||||
#
|
#
|
||||||
# Makefile for joytest example (UNIX).
|
# Makefile for joytest example (UNIX).
|
||||||
|
|
||||||
WXDIR = ../..
|
PROGRAM=joytest
|
||||||
|
|
||||||
# All common UNIX compiler flags and options are now in
|
OBJECTS=$(PROGRAM).o
|
||||||
# this central makefile.
|
|
||||||
include $(WXDIR)/src/make.env
|
|
||||||
|
|
||||||
OBJECTS = $(OBJDIR)/joytest.$(OBJSUFF)
|
include ../../src/makeprog.env
|
||||||
|
|
||||||
.SUFFIXES:
|
|
||||||
|
|
||||||
all: $(OBJDIR) joytest$(GUISUFFIX)
|
|
||||||
|
|
||||||
wx:
|
|
||||||
# cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx
|
|
||||||
motif:
|
|
||||||
$(MAKE) -f makefile.unx GUISUFFIX=_motif GUI=-Dwx_motif GUISUFFIX=_motif OPT='$(OPT)' LDLIBS='$(MOTIFLDLIBS)' OPTIONS='$(OPTIONS)' DEBUG='$(DEBUG)' WARN='$(WARN)' XLIB='$(XLIB)' XINCLUDE='$(XINCLUDE)' XVIEW_LINK=
|
|
||||||
|
|
||||||
xview:
|
|
||||||
$(MAKE) -f makefile.unx GUI=-Dwx_xview GUISUFFIX=_ol CC=$(CC) OPTIONS='$(OPTIONS)' DEBUG='$(DEBUG)' WARN='$(WARN)' XLIB='$(XLIB)' XINCLUDE='$(XINCLUDE)'
|
|
||||||
|
|
||||||
hp:
|
|
||||||
$(MAKE) -f makefile.unx GUI=-Dwx_motif GUISUFFIX=_hp CC=CC DEBUG='$(DEBUG)' WARN='-w' \
|
|
||||||
XINCLUDE='$(HPXINCLUDE)' XLIB='$(HPXLIB)' XVIEW_LINK='' LDLIBS='$(HPLDLIBS)'
|
|
||||||
|
|
||||||
$(OBJDIR):
|
|
||||||
mkdir $(OBJDIR)
|
|
||||||
|
|
||||||
joytest$(GUISUFFIX): $(OBJDIR)/joytest.$(OBJSUFF) $(WXLIB)
|
|
||||||
$(CC) $(LDFLAGS) -o joytest$(GUISUFFIX) $(OBJDIR)/joytest.$(OBJSUFF) $(XVIEW_LINK) $(LDLIBS)
|
|
||||||
|
|
||||||
$(OBJDIR)/joytest.$(OBJSUFF): joytest.$(SRCSUFF) joytest.h
|
|
||||||
$(CC) -c $(CPPFLAGS) -o $@ joytest.$(SRCSUFF)
|
|
||||||
|
|
||||||
clean_motif:
|
|
||||||
$(MAKE) -f makefile.unx GUISUFFIX=_motif cleanany
|
|
||||||
|
|
||||||
clean_ol:
|
|
||||||
$(MAKE) -f makefile.unx GUISUFFIX=_ol cleanany
|
|
||||||
|
|
||||||
clean_hp:
|
|
||||||
$(MAKE) -f makefile.unx GUISUFFIX=_hp cleanany
|
|
||||||
|
|
||||||
cleanany:
|
|
||||||
rm -f $(OBJECTS) joytest$(GUISUFFIX) core
|
|
||||||
|
@@ -1,76 +1,17 @@
|
|||||||
#
|
#
|
||||||
# File: makefile.unx
|
# File: makefile.unx
|
||||||
# Author: Julian Smart
|
# Author: Julian Smart
|
||||||
# Created: 1993
|
# Created: 1998
|
||||||
# Updated:
|
# Updated:
|
||||||
# Copyright: (c) 1993, AIAI, University of Edinburgh
|
# Copyright: (c) 1998 Julian Smart
|
||||||
#
|
#
|
||||||
# "%W% %G%"
|
# "%W% %G%"
|
||||||
#
|
#
|
||||||
# Makefile for layout example (UNIX).
|
# Makefile for layout example (UNIX).
|
||||||
|
|
||||||
WXDIR = ../..
|
PROGRAM=layout
|
||||||
|
|
||||||
# All common UNIX compiler flags and options are now in
|
OBJECTS=$(PROGRAM).o
|
||||||
# this central makefile.
|
|
||||||
include $(WXDIR)/src/make.env
|
|
||||||
|
|
||||||
OBJECTS=$(OBJDIR)/layout.$(OBJSUFF)
|
include ../../src/makeprog.env
|
||||||
|
|
||||||
.SUFFIXES:
|
|
||||||
|
|
||||||
all: $(OBJDIR) layout$(GUISUFFIX)
|
|
||||||
|
|
||||||
wxmotif:
|
|
||||||
cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx motif
|
|
||||||
|
|
||||||
wxxview:
|
|
||||||
cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx xview
|
|
||||||
|
|
||||||
wxhp:
|
|
||||||
cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx hp
|
|
||||||
|
|
||||||
# For SGI, include -lPW on your LDLIBS
|
|
||||||
motif: wxmotif
|
|
||||||
$(MAKE) -f makefile.unx all GUISUFFIX=_motif GUI=-Dwx_motif GUISUFFIX=_motif OPT='$(OPT)' LDLIBS='$(MOTIFLDLIBS)' WXLIB=$(WXDIR)/lib/libwx_motif.a OPTIONS='$(OPTIONS)' DEBUG='$(DEBUG)' WARN='$(WARN)' XLIB='$(XLIB)' XINCLUDE='$(XINCLUDE)' XVIEW_LINK=
|
|
||||||
|
|
||||||
xview: wxxview
|
|
||||||
$(MAKE) -f makefile.unx GUI=-Dwx_xview GUISUFFIX=_ol CC=$(CC) OPTIONS='$(OPTIONS)' DEBUG='$(DEBUG)' WARN='$(WARN)' XLIB='$(XLIB)' XINCLUDE='$(XINCLUDE)' LDLIBS='$(XVIEWLDLIBS)'
|
|
||||||
|
|
||||||
hp: wxhp
|
|
||||||
$(MAKE) -f makefile.unx GUI=-Dwx_motif GUISUFFIX=_hp CC=CC OPT='' DEBUG='$(DEBUG)' WARN='-w' \
|
|
||||||
XINCLUDE='$(HPXINCLUDE)' \
|
|
||||||
XLIB='$(HPXLIB)' \
|
|
||||||
XVIEW_LINK='' \
|
|
||||||
LDLIBS='$(HPLDLIBS)'
|
|
||||||
|
|
||||||
$(OBJDIR):
|
|
||||||
mkdir $(OBJDIR)
|
|
||||||
|
|
||||||
layout$(GUISUFFIX): $(OBJDIR)/layout.$(OBJSUFF) $(WXLIB)
|
|
||||||
$(CC) $(LDFLAGS) -o layout$(GUISUFFIX) $(OBJDIR)/layout.$(OBJSUFF) $(XVIEW_LINK) $(LDLIBS)
|
|
||||||
|
|
||||||
$(OBJDIR)/layout.$(OBJSUFF): layout.$(SRCSUFF) layout.h
|
|
||||||
$(CC) -c $(CPPFLAGS) -o $@ layout.$(SRCSUFF)
|
|
||||||
|
|
||||||
clean_motif:
|
|
||||||
$(MAKE) -f makefile.unx GUISUFFIX=_motif cleanany
|
|
||||||
|
|
||||||
clean_ol:
|
|
||||||
$(MAKE) -f makefile.unx GUISUFFIX=_ol cleanany
|
|
||||||
|
|
||||||
clean_hp:
|
|
||||||
$(MAKE) -f makefile.unx GUISUFFIX=_hp cleanany
|
|
||||||
|
|
||||||
cleanany:
|
|
||||||
rm -f $(OBJECTS) layout$(GUISUFFIX) core
|
|
||||||
|
|
||||||
wxclean_ol:
|
|
||||||
cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx clean_ol
|
|
||||||
|
|
||||||
wxclean_motif:
|
|
||||||
cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx clean_motif
|
|
||||||
|
|
||||||
wxclean_hp:
|
|
||||||
cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx clean_hp
|
|
||||||
|
|
||||||
|
17
samples/listctrl/makefile.unx
Normal file
17
samples/listctrl/makefile.unx
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#
|
||||||
|
# File: makefile.unx
|
||||||
|
# Author: Julian Smart
|
||||||
|
# Created: 1998
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) 1998 Julian Smart
|
||||||
|
#
|
||||||
|
# "%W% %G%"
|
||||||
|
#
|
||||||
|
# Makefile for listctrl example (UNIX).
|
||||||
|
|
||||||
|
PROGRAM=listtest
|
||||||
|
|
||||||
|
OBJECTS=$(PROGRAM).o
|
||||||
|
|
||||||
|
include ../../src/makeprog.env
|
||||||
|
|
@@ -1,55 +1,17 @@
|
|||||||
#
|
#
|
||||||
# File: makefile.unx
|
# File: makefile.unx
|
||||||
# Author: Julian Smart
|
# Author: Julian Smart
|
||||||
# Created: 1993
|
# Created: 1998
|
||||||
# Updated:
|
# Updated:
|
||||||
# Copyright: (c) 1993, AIAI, University of Edinburgh
|
# Copyright: (c) 1998 Julian Smart
|
||||||
#
|
#
|
||||||
# "%W% %G%"
|
# "%W% %G%"
|
||||||
#
|
#
|
||||||
# Makefile for mdi example (UNIX).
|
# Makefile for mdi example (UNIX).
|
||||||
|
|
||||||
WXDIR = ../..
|
PROGRAM=mdi
|
||||||
|
|
||||||
# All common UNIX compiler flags and options are now in
|
OBJECTS=$(PROGRAM).o
|
||||||
# this central makefile.
|
|
||||||
include $(WXDIR)/src/make.env
|
|
||||||
|
|
||||||
OBJECTS = $(OBJDIR)/mdi.$(OBJSUFF)
|
include ../../src/makeprog.env
|
||||||
|
|
||||||
.SUFFIXES:
|
|
||||||
|
|
||||||
all: $(OBJDIR) mdi$(GUISUFFIX)
|
|
||||||
|
|
||||||
wx:
|
|
||||||
# cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx
|
|
||||||
motif:
|
|
||||||
$(MAKE) -f makefile.unx GUISUFFIX=_motif GUI=-Dwx_motif GUISUFFIX=_motif OPT='$(OPT)' LDLIBS='$(MOTIFLDLIBS)' OPTIONS='$(OPTIONS)' DEBUG='$(DEBUG)' WARN='$(WARN)' XLIB='$(XLIB)' XINCLUDE='$(XINCLUDE)' XVIEW_LINK=
|
|
||||||
|
|
||||||
xview:
|
|
||||||
$(MAKE) -f makefile.unx GUI=-Dwx_xview GUISUFFIX=_ol CC=$(CC) OPTIONS='$(OPTIONS)' DEBUG='$(DEBUG)' WARN='$(WARN)' XLIB='$(XLIB)' XINCLUDE='$(XINCLUDE)'
|
|
||||||
|
|
||||||
hp:
|
|
||||||
$(MAKE) -f makefile.unx GUI=-Dwx_motif GUISUFFIX=_hp CC=CC DEBUG='$(DEBUG)' WARN='-w' \
|
|
||||||
XINCLUDE='$(HPXINCLUDE)' XLIB='$(HPXLIB)' XVIEW_LINK='' LDLIBS='$(HPLDLIBS)'
|
|
||||||
|
|
||||||
$(OBJDIR):
|
|
||||||
mkdir $(OBJDIR)
|
|
||||||
|
|
||||||
mdi$(GUISUFFIX): $(OBJDIR)/mdi.$(OBJSUFF) $(WXLIB)
|
|
||||||
$(CC) $(LDFLAGS) -o mdi$(GUISUFFIX) $(OBJDIR)/mdi.$(OBJSUFF) $(XVIEW_LINK) $(LDLIBS)
|
|
||||||
|
|
||||||
$(OBJDIR)/mdi.$(OBJSUFF): mdi.$(SRCSUFF) mdi.h
|
|
||||||
$(CC) -c $(CPPFLAGS) -o $@ mdi.$(SRCSUFF)
|
|
||||||
|
|
||||||
clean_motif:
|
|
||||||
$(MAKE) -f makefile.unx GUISUFFIX=_motif cleanany
|
|
||||||
|
|
||||||
clean_ol:
|
|
||||||
$(MAKE) -f makefile.unx GUISUFFIX=_ol cleanany
|
|
||||||
|
|
||||||
clean_hp:
|
|
||||||
$(MAKE) -f makefile.unx GUISUFFIX=_hp cleanany
|
|
||||||
|
|
||||||
cleanany:
|
|
||||||
rm -f $(OBJECTS) mdi$(GUISUFFIX) core
|
|
||||||
|
@@ -1,62 +1,17 @@
|
|||||||
#
|
#
|
||||||
# File: makefile.unx
|
# File: makefile.unx
|
||||||
# Author: Julian Smart
|
# Author: Julian Smart
|
||||||
# Created: 1993
|
# Created: 1998
|
||||||
# Updated:
|
# Updated:
|
||||||
# Copyright: (c) 1993, AIAI, University of Edinburgh
|
# Copyright: (c) 1998 Julian Smart
|
||||||
#
|
#
|
||||||
# "%W% %G%"
|
# "%W% %G%"
|
||||||
#
|
#
|
||||||
# Makefile for memcheck example (UNIX).
|
# Makefile for memcheck example (UNIX).
|
||||||
|
|
||||||
WXDIR = ../..
|
PROGRAM=memcheck
|
||||||
|
|
||||||
# All common UNIX compiler flags and options are now in
|
OBJECTS=$(PROGRAM).o
|
||||||
# this central makefile.
|
|
||||||
include $(WXDIR)/src/make.env
|
|
||||||
|
|
||||||
OBJECTS = $(OBJDIR)/memcheck.$(OBJSUFF)
|
include ../../src/makeprog.env
|
||||||
|
|
||||||
.SUFFIXES:
|
|
||||||
|
|
||||||
all: $(OBJDIR) memcheck$(GUISUFFIX)
|
|
||||||
|
|
||||||
wxmotif:
|
|
||||||
cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx motif GUISUFFIX=_motif GUI=-Dwx_motif GUISUFFIX=_motif OPT='$(OPT)' LDLIBS='$(MOTIFLDLIBS)' WXLIB=$(WXDIR)/lib/libwx_motif.a OPTIONS='$(OPTIONS)'\
|
|
||||||
DEBUG='$(DEBUG)' DEBUGFLAGS='$(DEBUGFLAGS)' WARN='$(WARN)' XLIB='$(XLIB)' XINCLUDE='$(XINCLUDE)' XVIEW_LINK=
|
|
||||||
|
|
||||||
|
|
||||||
motif: wxmotif
|
|
||||||
$(MAKE) -f makefile.unx GUISUFFIX=_motif GUI=-Dwx_motif GUISUFFIX=_motif OPT='$(OPT)' LDLIBS='$(MOTIFLDLIBS)' WXLIB=$(WXDIR)/lib/libwx_motif.a OPTIONS='$(OPTIONS)'\
|
|
||||||
DEBUG='$(DEBUG)' DEBUGFLAGS='$(DEBUGFLAGS)' WARN='$(WARN)' XLIB='$(XLIB)' XINCLUDE='$(XINCLUDE)' XVIEW_LINK=
|
|
||||||
|
|
||||||
xview:
|
|
||||||
cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx xview
|
|
||||||
$(MAKE) -f makefile.unx GUI=-Dwx_xview GUISUFFIX=_ol CC=$(CC) OPTIONS='$(OPTIONS)'\
|
|
||||||
DEBUG='$(DEBUG)' DEBUGFLAGS='$(DEBUGFLAGS)' WARN='$(WARN)' XLIB='$(XLIB)' XINCLUDE='$(XINCLUDE)'
|
|
||||||
|
|
||||||
hp:
|
|
||||||
cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx hp
|
|
||||||
$(MAKE) -f makefile.unx GUI=-Dwx_motif GUISUFFIX=_hp CC=CC DEBUG='$(DEBUG)' DEBUGFLAGS='' WARN='-w' \
|
|
||||||
XINCLUDE='$(HPXINCLUDE)' XLIB='$(HPXLIB)' XVIEW_LINK='' LDLIBS='$(HPLDLIBS)'
|
|
||||||
|
|
||||||
$(OBJDIR):
|
|
||||||
mkdir $(OBJDIR)
|
|
||||||
|
|
||||||
memcheck$(GUISUFFIX): $(OBJDIR)/memcheck.$(OBJSUFF) $(WXLIB)
|
|
||||||
$(CC) $(LDFLAGS) -o memcheck$(GUISUFFIX) $(OBJDIR)/memcheck.$(OBJSUFF) $(XVIEW_LINK) $(LDLIBS)
|
|
||||||
|
|
||||||
$(OBJDIR)/memcheck.$(OBJSUFF): memcheck.$(SRCSUFF)
|
|
||||||
$(CC) -c $(CPPFLAGS) -o $@ memcheck.$(SRCSUFF)
|
|
||||||
|
|
||||||
clean_motif:
|
|
||||||
$(MAKE) -f makefile.unx GUISUFFIX=_motif cleanany
|
|
||||||
|
|
||||||
clean_ol:
|
|
||||||
$(MAKE) -f makefile.unx GUISUFFIX=_ol cleanany
|
|
||||||
|
|
||||||
clean_hp:
|
|
||||||
$(MAKE) -f makefile.unx GUISUFFIX=_hp cleanany
|
|
||||||
|
|
||||||
cleanany:
|
|
||||||
rm -f $(OBJECTS) memcheck$(GUISUFFIX) core
|
|
||||||
|
17
samples/printing/makefile.unx
Normal file
17
samples/printing/makefile.unx
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#
|
||||||
|
# File: makefile.unx
|
||||||
|
# Author: Julian Smart
|
||||||
|
# Created: 1998
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) 1998 Julian Smart
|
||||||
|
#
|
||||||
|
# "%W% %G%"
|
||||||
|
#
|
||||||
|
# Makefile for printing example (UNIX).
|
||||||
|
|
||||||
|
PROGRAM=printing
|
||||||
|
|
||||||
|
OBJECTS=$(PROGRAM).o
|
||||||
|
|
||||||
|
include ../../src/makeprog.env
|
||||||
|
|
@@ -52,7 +52,7 @@ int orientation = wxPORTRAIT;
|
|||||||
// Main proc
|
// Main proc
|
||||||
IMPLEMENT_APP(MyApp)
|
IMPLEMENT_APP(MyApp)
|
||||||
|
|
||||||
#ifdef __WXGTK__
|
#if defined(__WXGTK__) || defined(__WXMOTIF__)
|
||||||
#include "folder.xpm"
|
#include "folder.xpm"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -316,7 +316,7 @@ void MyFrame::Draw(wxDC& dc)
|
|||||||
dc.DrawLine(0, 0, 200, 200);
|
dc.DrawLine(0, 0, 200, 200);
|
||||||
dc.DrawLine(200, 0, 0, 200);
|
dc.DrawLine(200, 0, 0, 200);
|
||||||
|
|
||||||
#if defined(__WXGTK__)
|
#if defined(__WXGTK__) || defined(__WXMOTIF__)
|
||||||
wxIcon my_icon( folder_xpm );
|
wxIcon my_icon( folder_xpm );
|
||||||
#elif defined(__WXMSW__)
|
#elif defined(__WXMSW__)
|
||||||
wxIcon my_icon( "mondrian" );
|
wxIcon my_icon( "mondrian" );
|
||||||
|
@@ -1,76 +1,17 @@
|
|||||||
#
|
#
|
||||||
# File: makefile.unx
|
# File: makefile.unx
|
||||||
# Author: Julian Smart
|
# Author: Julian Smart
|
||||||
# Created: 1993
|
# Created: 1998
|
||||||
# Updated:
|
# Updated:
|
||||||
# Copyright: (c) 1993, AIAI, University of Edinburgh
|
# Copyright: (c) 1998 Julian Smart
|
||||||
#
|
#
|
||||||
# "%W% %G%"
|
# "%W% %G%"
|
||||||
#
|
#
|
||||||
# Makefile for resource example (UNIX).
|
# Makefile for resource example (UNIX).
|
||||||
|
|
||||||
WXDIR = ../..
|
PROGRAM=resource
|
||||||
|
|
||||||
# All common UNIX compiler flags and options are now in
|
OBJECTS=$(PROGRAM).o
|
||||||
# this central makefile.
|
|
||||||
include $(WXDIR)/src/make.env
|
|
||||||
|
|
||||||
OBJECTS=$(OBJDIR)/resource.$(OBJSUFF)
|
include ../../src/makeprog.env
|
||||||
|
|
||||||
.SUFFIXES:
|
|
||||||
|
|
||||||
all: $(OBJDIR) resource$(GUISUFFIX)
|
|
||||||
|
|
||||||
wxmotif:
|
|
||||||
cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx motif
|
|
||||||
|
|
||||||
wxxview:
|
|
||||||
cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx xview
|
|
||||||
|
|
||||||
wxhp:
|
|
||||||
cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx hp
|
|
||||||
|
|
||||||
# For SGI, include -lPW on your LDLIBS
|
|
||||||
motif: wxmotif
|
|
||||||
$(MAKE) -f makefile.unx all GUISUFFIX=_motif GUI=-Dwx_motif GUISUFFIX=_motif OPT='$(OPT)' LDLIBS='$(MOTIFLDLIBS)' WXLIB=$(WXDIR)/lib/libwx_motif.a OPTIONS='$(OPTIONS)' DEBUG='$(DEBUG)' WARN='$(WARN)' XLIB='$(XLIB)' XINCLUDE='$(XINCLUDE)' XVIEW_LINK=
|
|
||||||
|
|
||||||
xview: wxxview
|
|
||||||
$(MAKE) -f makefile.unx GUI=-Dwx_xview GUISUFFIX=_ol CC=$(CC) OPTIONS='$(OPTIONS)' DEBUG='$(DEBUG)' WARN='$(WARN)' XLIB='$(XLIB)' XINCLUDE='$(XINCLUDE)' LDLIBS='$(XVIEWLDLIBS)'
|
|
||||||
|
|
||||||
hp: wxhp
|
|
||||||
$(MAKE) -f makefile.unx GUI=-Dwx_motif GUISUFFIX=_hp CC=CC OPT='' DEBUG='$(DEBUG)' WARN='-w' \
|
|
||||||
XINCLUDE='$(HPXINCLUDE)' \
|
|
||||||
XLIB='$(HPXLIB)' \
|
|
||||||
XVIEW_LINK='' \
|
|
||||||
LDLIBS='$(HPLDLIBS)'
|
|
||||||
|
|
||||||
$(OBJDIR):
|
|
||||||
mkdir $(OBJDIR)
|
|
||||||
|
|
||||||
resource$(GUISUFFIX): $(OBJDIR)/resource.$(OBJSUFF) $(WXLIB)
|
|
||||||
$(CC) $(LDFLAGS) -o resource$(GUISUFFIX) $(OBJDIR)/resource.$(OBJSUFF) $(XVIEW_LINK) $(LDLIBS)
|
|
||||||
|
|
||||||
$(OBJDIR)/resource.$(OBJSUFF): resource.$(SRCSUFF) resource.h
|
|
||||||
$(CC) -c $(CPPFLAGS) -o $@ resource.$(SRCSUFF)
|
|
||||||
|
|
||||||
clean_motif:
|
|
||||||
$(MAKE) -f makefile.unx GUISUFFIX=_motif cleanany
|
|
||||||
|
|
||||||
clean_ol:
|
|
||||||
$(MAKE) -f makefile.unx GUISUFFIX=_ol cleanany
|
|
||||||
|
|
||||||
clean_hp:
|
|
||||||
$(MAKE) -f makefile.unx GUISUFFIX=_hp cleanany
|
|
||||||
|
|
||||||
cleanany:
|
|
||||||
rm -f $(OBJECTS) resource$(GUISUFFIX) core
|
|
||||||
|
|
||||||
wxclean_ol:
|
|
||||||
cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx clean_ol
|
|
||||||
|
|
||||||
wxclean_motif:
|
|
||||||
cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx clean_motif
|
|
||||||
|
|
||||||
wxclean_hp:
|
|
||||||
cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx clean_hp
|
|
||||||
|
|
||||||
|
17
samples/sashtest/makefile.unx
Normal file
17
samples/sashtest/makefile.unx
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#
|
||||||
|
# File: makefile.unx
|
||||||
|
# Author: Julian Smart
|
||||||
|
# Created: 1998
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) 1998 Julian Smart
|
||||||
|
#
|
||||||
|
# "%W% %G%"
|
||||||
|
#
|
||||||
|
# Makefile for sashtest example (UNIX).
|
||||||
|
|
||||||
|
PROGRAM=sashtest
|
||||||
|
|
||||||
|
OBJECTS=$(PROGRAM).o
|
||||||
|
|
||||||
|
include ../../src/makeprog.env
|
||||||
|
|
18
samples/splitter/makefile.unx
Normal file
18
samples/splitter/makefile.unx
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#
|
||||||
|
# File: makefile.unx
|
||||||
|
# Author: Julian Smart
|
||||||
|
# Created: 1998
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) 1998 Julian Smart
|
||||||
|
#
|
||||||
|
# "%W% %G%"
|
||||||
|
#
|
||||||
|
# Makefile for splitter example (UNIX).
|
||||||
|
|
||||||
|
PROGRAM=test
|
||||||
|
|
||||||
|
OBJECTS=$(PROGRAM).o
|
||||||
|
|
||||||
|
include ../../src/makeprog.env
|
||||||
|
|
||||||
|
|
17
samples/tab/makefile.unx
Normal file
17
samples/tab/makefile.unx
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#
|
||||||
|
# File: makefile.unx
|
||||||
|
# Author: Julian Smart
|
||||||
|
# Created: 1998
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) 1998 Julian Smart
|
||||||
|
#
|
||||||
|
# "%W% %G%"
|
||||||
|
#
|
||||||
|
# Makefile for tab example (UNIX).
|
||||||
|
|
||||||
|
PROGRAM=tab
|
||||||
|
|
||||||
|
OBJECTS=$(PROGRAM).o
|
||||||
|
|
||||||
|
include ../../src/makeprog.env
|
||||||
|
|
18
samples/toolbar/makefile.unx
Normal file
18
samples/toolbar/makefile.unx
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#
|
||||||
|
# File: makefile.unx
|
||||||
|
# Author: Julian Smart
|
||||||
|
# Created: 1998
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) 1998 Julian Smart
|
||||||
|
#
|
||||||
|
# "%W% %G%"
|
||||||
|
#
|
||||||
|
# Makefile for toolbar example (UNIX).
|
||||||
|
|
||||||
|
PROGRAM=test
|
||||||
|
|
||||||
|
OBJECTS=$(PROGRAM).o
|
||||||
|
|
||||||
|
include ../../src/makeprog.env
|
||||||
|
|
||||||
|
|
@@ -23,7 +23,7 @@
|
|||||||
#include "wx/toolbar.h"
|
#include "wx/toolbar.h"
|
||||||
#include "test.h"
|
#include "test.h"
|
||||||
|
|
||||||
#ifdef __WXGTK__
|
#if defined(__WXGTK__) || defined(__WXMOTIF__)
|
||||||
#include "mondrian.xpm"
|
#include "mondrian.xpm"
|
||||||
#include "bitmaps/new.xpm"
|
#include "bitmaps/new.xpm"
|
||||||
#include "bitmaps/open.xpm"
|
#include "bitmaps/open.xpm"
|
||||||
@@ -125,21 +125,21 @@ bool MyApp::InitToolbar(wxToolBar* toolBar)
|
|||||||
#endif
|
#endif
|
||||||
int currentX = 5;
|
int currentX = 5;
|
||||||
|
|
||||||
toolBar->AddTool(wxID_NEW, *(toolBarBitmaps[0]), wxNullBitmap, FALSE, (float)currentX, -1, (wxObject *) NULL, "New file");
|
toolBar->AddTool(wxID_NEW, *(toolBarBitmaps[0]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "New file");
|
||||||
currentX += width + 5;
|
currentX += width + 5;
|
||||||
toolBar->AddTool(wxID_OPEN, *(toolBarBitmaps[1]), wxNullBitmap, FALSE, (float)currentX, -1, (wxObject *) NULL, "Open file");
|
toolBar->AddTool(wxID_OPEN, *(toolBarBitmaps[1]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Open file");
|
||||||
currentX += width + 5;
|
currentX += width + 5;
|
||||||
toolBar->AddTool(wxID_SAVE, *(toolBarBitmaps[2]), wxNullBitmap, FALSE, (float)currentX, -1, (wxObject *) NULL, "Save file");
|
toolBar->AddTool(wxID_SAVE, *(toolBarBitmaps[2]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Save file");
|
||||||
currentX += width + 5;
|
currentX += width + 5;
|
||||||
toolBar->AddSeparator();
|
toolBar->AddSeparator();
|
||||||
toolBar->AddTool(wxID_COPY, *(toolBarBitmaps[3]), wxNullBitmap, FALSE, (float)currentX, -1, (wxObject *) NULL, "Copy");
|
toolBar->AddTool(wxID_COPY, *(toolBarBitmaps[3]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Copy");
|
||||||
currentX += width + 5;
|
currentX += width + 5;
|
||||||
toolBar->AddTool(wxID_CUT, *(toolBarBitmaps[4]), wxNullBitmap, FALSE, (float)currentX, -1, (wxObject *) NULL, "Cut");
|
toolBar->AddTool(wxID_CUT, *(toolBarBitmaps[4]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Cut");
|
||||||
currentX += width + 5;
|
currentX += width + 5;
|
||||||
toolBar->AddTool(wxID_PASTE, *(toolBarBitmaps[5]), wxNullBitmap, FALSE, (float)currentX, -1, (wxObject *) NULL, "Paste");
|
toolBar->AddTool(wxID_PASTE, *(toolBarBitmaps[5]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Paste");
|
||||||
currentX += width + 5;
|
currentX += width + 5;
|
||||||
toolBar->AddSeparator();
|
toolBar->AddSeparator();
|
||||||
toolBar->AddTool(wxID_PRINT, *(toolBarBitmaps[6]), wxNullBitmap, FALSE, (float)currentX, -1, (wxObject *) NULL, "Print");
|
toolBar->AddTool(wxID_PRINT, *(toolBarBitmaps[6]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Print");
|
||||||
currentX += width + 5;
|
currentX += width + 5;
|
||||||
toolBar->AddSeparator();
|
toolBar->AddSeparator();
|
||||||
toolBar->AddTool(wxID_HELP, *(toolBarBitmaps[7]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Help");
|
toolBar->AddTool(wxID_HELP, *(toolBarBitmaps[7]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Help");
|
||||||
|
17
samples/treectrl/makefile.unx
Normal file
17
samples/treectrl/makefile.unx
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#
|
||||||
|
# File: makefile.unx
|
||||||
|
# Author: Julian Smart
|
||||||
|
# Created: 1998
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) 1998 Julian Smart
|
||||||
|
#
|
||||||
|
# "%W% %G%"
|
||||||
|
#
|
||||||
|
# Makefile for treectrl example (UNIX).
|
||||||
|
|
||||||
|
PROGRAM=treetest
|
||||||
|
|
||||||
|
OBJECTS=$(PROGRAM).o
|
||||||
|
|
||||||
|
include ../../src/makeprog.env
|
||||||
|
|
17
samples/typetest/makefile.unx
Normal file
17
samples/typetest/makefile.unx
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#
|
||||||
|
# File: makefile.unx
|
||||||
|
# Author: Julian Smart
|
||||||
|
# Created: 1998
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) 1998 Julian Smart
|
||||||
|
#
|
||||||
|
# "%W% %G%"
|
||||||
|
#
|
||||||
|
# Makefile for typetest example (UNIX).
|
||||||
|
|
||||||
|
PROGRAM=typetest
|
||||||
|
|
||||||
|
OBJECTS=$(PROGRAM).o
|
||||||
|
|
||||||
|
include ../../src/makeprog.env
|
||||||
|
|
@@ -1155,6 +1155,9 @@ wxDocTemplate *wxDocManager::SelectDocumentPath(wxDocTemplate **templates,
|
|||||||
if (len > 0)
|
if (len > 0)
|
||||||
// Omit final "|"
|
// Omit final "|"
|
||||||
descrBuf[len-1] = 0;
|
descrBuf[len-1] = 0;
|
||||||
|
#else
|
||||||
|
char* descrBuf = copystring("*.*");
|
||||||
|
#endif
|
||||||
|
|
||||||
char *pathTmp = wxFileSelector(_("Select a file"), "", "", "", descrBuf, 0, wxTheApp->GetTopWindow());
|
char *pathTmp = wxFileSelector(_("Select a file"), "", "", "", descrBuf, 0, wxTheApp->GetTopWindow());
|
||||||
delete[] descrBuf;
|
delete[] descrBuf;
|
||||||
@@ -1177,7 +1180,7 @@ wxDocTemplate *wxDocManager::SelectDocumentPath(wxDocTemplate **templates,
|
|||||||
path = "";
|
path = "";
|
||||||
return (wxDocTemplate *) NULL;
|
return (wxDocTemplate *) NULL;
|
||||||
}
|
}
|
||||||
#else
|
#if 0
|
||||||
// In all other windowing systems, until we have more advanced
|
// In all other windowing systems, until we have more advanced
|
||||||
// file selectors, we must select the document type (template) first, and
|
// file selectors, we must select the document type (template) first, and
|
||||||
// _then_ pop up the file selector.
|
// _then_ pop up the file selector.
|
||||||
|
@@ -134,6 +134,11 @@ wxMouseEvent::wxMouseEvent(wxEventType commandType)
|
|||||||
m_altDown = FALSE;
|
m_altDown = FALSE;
|
||||||
m_controlDown = FALSE;
|
m_controlDown = FALSE;
|
||||||
m_shiftDown = FALSE;
|
m_shiftDown = FALSE;
|
||||||
|
m_leftDown = FALSE;
|
||||||
|
m_rightDown = FALSE;
|
||||||
|
m_middleDown = FALSE;
|
||||||
|
m_x = 0;
|
||||||
|
m_y = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// True if was a button dclick event (1 = left, 2 = middle, 3 = right)
|
// True if was a button dclick event (1 = left, 2 = middle, 3 = right)
|
||||||
|
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include "wx/defs.h"
|
#include "wx/defs.h"
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
#ifndef __WXGTK__
|
||||||
#define __GOOD_COMPILER__
|
#define __GOOD_COMPILER__
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -324,7 +324,7 @@ void wxPreviewControlBar::CreateButtons()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
wxFont buttonFont(fontSize, wxSWISS, wxNORMAL, wxBOLD);
|
wxFont buttonFont(fontSize, wxSWISS, wxNORMAL, wxBOLD);
|
||||||
SetButtonFont(buttonFont);
|
SetFont(buttonFont);
|
||||||
|
|
||||||
int buttonWidth = 65;
|
int buttonWidth = 65;
|
||||||
int buttonHeight = 24;
|
int buttonHeight = 24;
|
||||||
@@ -359,7 +359,8 @@ void wxPreviewControlBar::CreateButtons()
|
|||||||
x += gap + buttonWidth;
|
x += gap + buttonWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
static wxString choices[] = { "10%", "20%", "25%", "30%", "35%", "40%", "45%", "50%", "55%", "60%",
|
// Can't be static because gcc bails out
|
||||||
|
wxString choices[] = { "10%", "20%", "25%", "30%", "35%", "40%", "45%", "50%", "55%", "60%",
|
||||||
"65%", "70%", "75%", "80%", "85%", "90%", "95%", "100%", "110%", "120%", "150%", "200%" };
|
"65%", "70%", "75%", "80%", "85%", "90%", "95%", "100%", "110%", "120%", "150%", "200%" };
|
||||||
int n = 22;
|
int n = 22;
|
||||||
if (m_buttonFlags & wxPREVIEW_ZOOM)
|
if (m_buttonFlags & wxPREVIEW_ZOOM)
|
||||||
@@ -730,14 +731,14 @@ bool wxPrintPreviewBase::DrawBlankPage(wxWindow *canvas, wxDC& dc)
|
|||||||
int shadowOffset = 4;
|
int shadowOffset = 4;
|
||||||
dc.SetPen(*wxBLACK_PEN);
|
dc.SetPen(*wxBLACK_PEN);
|
||||||
dc.SetBrush(*wxBLACK_BRUSH);
|
dc.SetBrush(*wxBLACK_BRUSH);
|
||||||
dc.DrawRectangle(x-1 + shadowOffset, y-1 + shadowOffset, actualWidth+2, actualHeight+2);
|
dc.DrawRectangle((int)(x-1 + shadowOffset), (int)(y-1 + shadowOffset), (int)(actualWidth+2), (int)(actualHeight+2));
|
||||||
|
|
||||||
// Draw blank page allowing for 1-pixel border AROUND the actual page
|
// Draw blank page allowing for 1-pixel border AROUND the actual page
|
||||||
dc.SetPen(*wxBLACK_PEN);
|
dc.SetPen(*wxBLACK_PEN);
|
||||||
dc.SetBrush(*wxWHITE_BRUSH);
|
dc.SetBrush(*wxWHITE_BRUSH);
|
||||||
|
|
||||||
|
|
||||||
dc.DrawRectangle(x-1, y-1, actualWidth+2, actualHeight+2);
|
dc.DrawRectangle((int)(x-1), (int)(y-1), (int)(actualWidth+2), (int)(actualHeight+2));
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -447,8 +447,8 @@ long wxTreeCtrl::InsertItem( long parent, const wxString& label, int image,
|
|||||||
|
|
||||||
if (!p->HasChildren()) p->m_hasChildren = TRUE;
|
if (!p->HasChildren()) p->m_hasChildren = TRUE;
|
||||||
|
|
||||||
int ch = 0;
|
int cw = 0, ch = 0;
|
||||||
GetClientSize( (int *) NULL, &ch );
|
GetClientSize( &cw, &ch );
|
||||||
|
|
||||||
PrepareDC( dc );
|
PrepareDC( dc );
|
||||||
|
|
||||||
|
@@ -54,7 +54,7 @@ XLIB = -L/usr/local/X11/lib -L/usr/openwin/lib -L/usr/X11/lib -L/usr/X11R
|
|||||||
############################ Libraries ################################
|
############################ Libraries ################################
|
||||||
|
|
||||||
COMPLIBS = -lstdc++
|
COMPLIBS = -lstdc++
|
||||||
GUILDLIBS = -lwx_stubs $(COMPLIBS) -lXm -lXmu -lXt -lX11 -lm
|
GUILDLIBS = -lwx_stubs $(COMPLIBS) -lXm -lXmu -lXt -lXpm -lX11 -lm
|
||||||
|
|
||||||
############################# Suffixes ################################
|
############################# Suffixes ################################
|
||||||
|
|
||||||
@@ -97,10 +97,10 @@ stubs:
|
|||||||
make -f makefile.unx all GUI='-D__WXSTUBS__ -D__LINUX__ -D__UNIX__' GUISUFFIX='_stubs' GUILDLIBS='-lwx_stubs $(COMPLIBS) -lXm -lXmu -lXt -lX11 -lm'
|
make -f makefile.unx all GUI='-D__WXSTUBS__ -D__LINUX__ -D__UNIX__' GUISUFFIX='_stubs' GUILDLIBS='-lwx_stubs $(COMPLIBS) -lXm -lXmu -lXt -lX11 -lm'
|
||||||
|
|
||||||
motif:
|
motif:
|
||||||
make -f makefile.unx all GUI='-D__WXMOTIF__ -D__LINUX__ -D__UNIX__' GUISUFFIX='_motif' GUILDLIBS='-lwx_motif $(COMPLIBS) -lXm -lXmu -lXt -lX11 -lm'
|
make -f makefile.unx all GUI='-D__WXMOTIF__ -D__LINUX__ -D__UNIX__' GUISUFFIX='_motif' GUILDLIBS='-lwx_motif $(COMPLIBS) -lXm -lXmu -lXt -lXpm -lX11 -lm'
|
||||||
|
|
||||||
gtk:
|
gtk:
|
||||||
make -f makefile.unx all GUI='-D__WXGTK__ -D__LINUX__ -D__UNIX__' GUISUFFIX='_gtk' GUILDLIBS='-lwx_gtk $(COMPLIBS) -lXm -lXmu -lX11 -lm'
|
make -f makefile.unx all GUI='-D__WXGTK__ -D__LINUX__ -D__UNIX__' GUISUFFIX='_gtk' GUILDLIBS='-lwx_gtk $(COMPLIBS) -lXm -lXmu -lXpm -lX11 -lm'
|
||||||
|
|
||||||
cleanstubs:
|
cleanstubs:
|
||||||
make -f makefile.unx clean GUI='-D__WXSTUBS__ -D__LINUX__ -D__UNIX__' GUISUFFIX='_stubs' GUILDLIBS='-lwx_stubs $(COMPLIBS) -lXm -lXmu -lXt -lX11 -lm'
|
make -f makefile.unx clean GUI='-D__WXSTUBS__ -D__LINUX__ -D__UNIX__' GUISUFFIX='_stubs' GUILDLIBS='-lwx_stubs $(COMPLIBS) -lXm -lXmu -lXt -lX11 -lm'
|
||||||
|
@@ -19,13 +19,14 @@
|
|||||||
#include "wx/bitmap.h"
|
#include "wx/bitmap.h"
|
||||||
#include "wx/icon.h"
|
#include "wx/icon.h"
|
||||||
#include "wx/log.h"
|
#include "wx/log.h"
|
||||||
|
#include "wx/control.h"
|
||||||
|
|
||||||
#include <Xm/Xm.h>
|
#include <Xm/Xm.h>
|
||||||
|
|
||||||
#include "wx/motif/private.h"
|
#include "wx/motif/private.h"
|
||||||
|
|
||||||
// TODO: correct symbol, path?
|
// TODO: correct symbol, path?
|
||||||
#if USE_XPM
|
#if wxUSE_XPM
|
||||||
#include <X11/xpm.h>
|
#include <X11/xpm.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -152,7 +153,7 @@ wxBitmap::wxBitmap(const wxString& filename, long type)
|
|||||||
|
|
||||||
// Create from XPM data
|
// Create from XPM data
|
||||||
static wxControl* sg_Control = NULL;
|
static wxControl* sg_Control = NULL;
|
||||||
wxBitmap::wxBitmap(const char **data, wxControl* control)
|
wxBitmap::wxBitmap(char **data, wxControl* control)
|
||||||
{
|
{
|
||||||
// Pass the control to the Create function using a global
|
// Pass the control to the Create function using a global
|
||||||
sg_Control = control;
|
sg_Control = control;
|
||||||
@@ -573,7 +574,7 @@ bool wxXBMDataHandler::Create(wxBitmap *bitmap, void *data, long flags, int widt
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if USE_XPM
|
#if wxUSE_XPM
|
||||||
class WXDLLEXPORT wxXPMFileHandler: public wxBitmapHandler
|
class WXDLLEXPORT wxXPMFileHandler: public wxBitmapHandler
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxXPMFileHandler)
|
DECLARE_DYNAMIC_CLASS(wxXPMFileHandler)
|
||||||
@@ -595,7 +596,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxXPMFileHandler, wxBitmapHandler)
|
|||||||
bool wxXPMFileHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
|
bool wxXPMFileHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
|
||||||
int desiredWidth, int desiredHeight)
|
int desiredWidth, int desiredHeight)
|
||||||
{
|
{
|
||||||
Display *dpy = wxGetDisplay();
|
Display *dpy = (Display*) wxGetDisplay();
|
||||||
M_BITMAPHANDLERDATA->m_display = (WXDisplay*) dpy;
|
M_BITMAPHANDLERDATA->m_display = (WXDisplay*) dpy;
|
||||||
|
|
||||||
XpmAttributes xpmAttr;
|
XpmAttributes xpmAttr;
|
||||||
@@ -633,6 +634,7 @@ bool wxXPMFileHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long fla
|
|||||||
XpmFreeAttributes(&xpmAttr);
|
XpmFreeAttributes(&xpmAttr);
|
||||||
|
|
||||||
M_BITMAPHANDLERDATA->m_ok = TRUE;
|
M_BITMAPHANDLERDATA->m_ok = TRUE;
|
||||||
|
return TRUE;
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
// XpmDebugError(errorStatus, name);
|
// XpmDebugError(errorStatus, name);
|
||||||
@@ -663,7 +665,7 @@ class WXDLLEXPORT wxXPMDataHandler: public wxBitmapHandler
|
|||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxXPMDataHandler)
|
DECLARE_DYNAMIC_CLASS(wxXPMDataHandler)
|
||||||
public:
|
public:
|
||||||
inline wxXBMDataHandler()
|
inline wxXPMDataHandler()
|
||||||
{
|
{
|
||||||
m_name = "XPM data";
|
m_name = "XPM data";
|
||||||
m_extension = "xpm";
|
m_extension = "xpm";
|
||||||
@@ -681,7 +683,7 @@ bool wxXPMDataHandler::Create(wxBitmap *bitmap, void *data, long flags, int widt
|
|||||||
M_BITMAPHANDLERDATA->m_depth = 1;
|
M_BITMAPHANDLERDATA->m_depth = 1;
|
||||||
M_BITMAPHANDLERDATA->m_freePixmap = TRUE;
|
M_BITMAPHANDLERDATA->m_freePixmap = TRUE;
|
||||||
|
|
||||||
Display *dpy = wxGetDisplay();
|
Display *dpy = (Display*) wxGetDisplay();
|
||||||
M_BITMAPHANDLERDATA->m_display = (WXDisplay*) dpy;
|
M_BITMAPHANDLERDATA->m_display = (WXDisplay*) dpy;
|
||||||
|
|
||||||
XpmAttributes xpmAttr;
|
XpmAttributes xpmAttr;
|
||||||
@@ -760,7 +762,7 @@ void wxBitmap::InitStandardHandlers()
|
|||||||
|
|
||||||
// XPM is considered standard for Moif, although it can be omitted if absolutely
|
// XPM is considered standard for Moif, although it can be omitted if absolutely
|
||||||
// necessary.
|
// necessary.
|
||||||
#if USE_XPM
|
#if wxUSE_XPM
|
||||||
AddHandler(new wxXPMFileHandler);
|
AddHandler(new wxXPMFileHandler);
|
||||||
AddHandler(new wxXPMDataHandler);
|
AddHandler(new wxXPMDataHandler);
|
||||||
#endif
|
#endif
|
||||||
|
@@ -15,10 +15,26 @@
|
|||||||
|
|
||||||
#include "wx/bmpbuttn.h"
|
#include "wx/bmpbuttn.h"
|
||||||
|
|
||||||
|
#include <Xm/PushBG.h>
|
||||||
|
#include <Xm/PushB.h>
|
||||||
|
|
||||||
|
#include "wx/motif/private.h"
|
||||||
|
|
||||||
|
// Implemented in button.cpp
|
||||||
|
void wxButtonCallback (Widget w, XtPointer clientData, XtPointer ptr);
|
||||||
|
|
||||||
|
Pixmap XCreateInsensitivePixmap( Display *display, Pixmap pixmap );
|
||||||
|
|
||||||
#if !USE_SHARED_LIBRARY
|
#if !USE_SHARED_LIBRARY
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton, wxButton)
|
IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton, wxButton)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
wxBitmapButton::wxBitmapButton()
|
||||||
|
{
|
||||||
|
m_marginX = wxDEFAULT_BUTTON_MARGIN; m_marginY = wxDEFAULT_BUTTON_MARGIN;
|
||||||
|
m_insensPixmap = (WXPixmap) 0;
|
||||||
|
}
|
||||||
|
|
||||||
bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bitmap,
|
bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bitmap,
|
||||||
const wxPoint& pos,
|
const wxPoint& pos,
|
||||||
const wxSize& size, long style,
|
const wxSize& size, long style,
|
||||||
@@ -46,20 +62,134 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit
|
|||||||
else
|
else
|
||||||
m_windowId = id;
|
m_windowId = id;
|
||||||
|
|
||||||
if ( width == -1 && bitmap.Ok())
|
Widget parentWidget = (Widget) parent->GetClientWidget();
|
||||||
width = bitmap.GetWidth() + 2*m_marginX;
|
|
||||||
|
|
||||||
if ( height == -1 && bitmap.Ok())
|
/*
|
||||||
height = bitmap.GetHeight() + 2*m_marginY;
|
* Patch Note (important)
|
||||||
|
* There is no major reason to put a defaultButtonThickness here.
|
||||||
/* TODO: create bitmap button
|
* Not requesting it give the ability to put wxButton with a spacing
|
||||||
|
* as small as requested. However, if some button become a DefaultButton,
|
||||||
|
* other buttons are no more aligned -- This is why we set
|
||||||
|
* defaultButtonThickness of ALL buttons belonging to the same wxPanel,
|
||||||
|
* in the ::SetDefaultButton method.
|
||||||
*/
|
*/
|
||||||
|
Widget buttonWidget = XtVaCreateManagedWidget ("button",
|
||||||
|
|
||||||
return FALSE;
|
// Gadget causes problems for default button operation.
|
||||||
|
#if wxUSE_GADGETS
|
||||||
|
xmPushButtonGadgetClass, parentWidget,
|
||||||
|
#else
|
||||||
|
xmPushButtonWidgetClass, parentWidget,
|
||||||
|
#endif
|
||||||
|
// XmNdefaultButtonShadowThickness, 1, // See comment for wxButton::SetDefault
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
m_mainWidget = (WXWidget) buttonWidget;
|
||||||
|
|
||||||
|
if (bitmap.Ok())
|
||||||
|
{
|
||||||
|
Pixmap p1, p2;
|
||||||
|
|
||||||
|
p1 = (Pixmap) ((wxBitmap&)bitmap).GetLabelPixmap(m_mainWidget);
|
||||||
|
p2 = (Pixmap) ((wxBitmap&)bitmap).GetInsensPixmap(m_mainWidget);
|
||||||
|
|
||||||
|
if(p1 == p2) // <- the Get...Pixmap()-functions return the same pixmap!
|
||||||
|
{
|
||||||
|
p2 =
|
||||||
|
XCreateInsensitivePixmap(DisplayOfScreen(XtScreen(buttonWidget)), p1);
|
||||||
|
m_insensPixmap = (WXPixmap) p2;
|
||||||
|
}
|
||||||
|
|
||||||
|
XtVaSetValues (buttonWidget,
|
||||||
|
XmNlabelPixmap, p1,
|
||||||
|
XmNlabelInsensitivePixmap, p2,
|
||||||
|
XmNarmPixmap, (Pixmap) ((wxBitmap&)bitmap).GetArmPixmap (m_mainWidget),
|
||||||
|
XmNlabelType, XmPIXMAP,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
XtAddCallback (buttonWidget, XmNactivateCallback, (XtCallbackProc) wxButtonCallback,
|
||||||
|
(XtPointer) this);
|
||||||
|
|
||||||
|
SetCanAddEventHandler(TRUE);
|
||||||
|
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
|
||||||
|
|
||||||
|
SetFont(* parent->GetFont());
|
||||||
|
|
||||||
|
ChangeColour (m_mainWidget);
|
||||||
|
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxBitmapButton::~wxBitmapButton()
|
||||||
|
{
|
||||||
|
SetBitmapLabel(wxNullBitmap);
|
||||||
|
|
||||||
|
if (m_insensPixmap)
|
||||||
|
XmDestroyPixmap (DefaultScreenOfDisplay ((Display*) GetXDisplay()), (Pixmap) m_insensPixmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxBitmapButton::SetBitmapLabel(const wxBitmap& bitmap)
|
void wxBitmapButton::SetBitmapLabel(const wxBitmap& bitmap)
|
||||||
{
|
{
|
||||||
m_buttonBitmap = bitmap;
|
m_buttonBitmap = bitmap;
|
||||||
|
|
||||||
|
if (bitmap.Ok())
|
||||||
|
{
|
||||||
|
Pixmap labelPixmap, insensPixmap, armPixmap;
|
||||||
|
|
||||||
|
labelPixmap = (Pixmap) ((wxBitmap&)bitmap).GetLabelPixmap(m_mainWidget);
|
||||||
|
|
||||||
|
if (m_buttonBitmapSelected.Ok())
|
||||||
|
armPixmap = (Pixmap) m_buttonBitmapSelected.GetLabelPixmap(m_mainWidget);
|
||||||
|
else
|
||||||
|
armPixmap = (Pixmap) ((wxBitmap&)bitmap).GetArmPixmap(m_mainWidget);
|
||||||
|
|
||||||
|
if (m_buttonBitmapDisabled.Ok())
|
||||||
|
insensPixmap = (Pixmap) m_buttonBitmapDisabled.GetLabelPixmap(m_mainWidget);
|
||||||
|
else
|
||||||
|
insensPixmap = (Pixmap) ((wxBitmap&)bitmap).GetInsensPixmap(m_mainWidget);
|
||||||
|
|
||||||
|
if (!insensPixmap || (insensPixmap == labelPixmap)) // <- the Get...Pixmap()-functions return the same pixmap!
|
||||||
|
{
|
||||||
|
insensPixmap = XCreateInsensitivePixmap(DisplayOfScreen(XtScreen((Widget) m_mainWidget)), labelPixmap);
|
||||||
|
m_insensPixmap = (WXPixmap) insensPixmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
XtVaSetValues ((Widget) m_mainWidget,
|
||||||
|
XmNlabelPixmap, labelPixmap,
|
||||||
|
XmNlabelInsensitivePixmap, insensPixmap,
|
||||||
|
XmNarmPixmap, armPixmap,
|
||||||
|
XmNlabelType, XmPIXMAP,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Null bitmap: must not use current pixmap
|
||||||
|
// since it is no longer valid.
|
||||||
|
XtVaSetValues ((Widget) m_mainWidget,
|
||||||
|
XmNlabelType, XmSTRING,
|
||||||
|
XmNlabelPixmap, NULL, // TODO: Does this work?
|
||||||
|
XmNlabelInsensitivePixmap, NULL,
|
||||||
|
XmNarmPixmap, NULL,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxBitmapButton::SetBitmapSelected(const wxBitmap& sel)
|
||||||
|
{
|
||||||
|
m_buttonBitmapSelected = sel;
|
||||||
|
};
|
||||||
|
|
||||||
|
void wxBitmapButton::SetBitmapFocus(const wxBitmap& focus)
|
||||||
|
{
|
||||||
|
m_buttonBitmapFocus = focus;
|
||||||
|
// Not used in Motif
|
||||||
|
};
|
||||||
|
|
||||||
|
void wxBitmapButton::SetBitmapDisabled(const wxBitmap& disabled)
|
||||||
|
{
|
||||||
|
m_buttonBitmapDisabled = disabled;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -75,10 +75,9 @@ bool wxCheckBox::Create(wxWindow *parent, wxWindowID id, const wxString& label,
|
|||||||
|
|
||||||
void wxCheckBox::SetValue(bool val)
|
void wxCheckBox::SetValue(bool val)
|
||||||
{
|
{
|
||||||
// TODO: m_inSetValue
|
m_inSetValue = TRUE;
|
||||||
// inSetValue = TRUE;
|
|
||||||
XmToggleButtonSetState ((Widget) m_mainWidget, (Boolean) val, TRUE);
|
XmToggleButtonSetState ((Widget) m_mainWidget, (Boolean) val, TRUE);
|
||||||
// inSetValue = FALSE;
|
m_inSetValue = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxCheckBox::GetValue() const
|
bool wxCheckBox::GetValue() const
|
||||||
@@ -140,9 +139,9 @@ void wxCheckBoxCallback (Widget w, XtPointer clientData,
|
|||||||
XtPointer ptr)
|
XtPointer ptr)
|
||||||
{
|
{
|
||||||
wxCheckBox *item = (wxCheckBox *) clientData;
|
wxCheckBox *item = (wxCheckBox *) clientData;
|
||||||
// TODO
|
|
||||||
// if (item->inSetValue)
|
if (item->InSetValue())
|
||||||
// return;
|
return;
|
||||||
|
|
||||||
wxCommandEvent event (wxEVT_COMMAND_CHECKBOX_CLICKED, item->GetId());
|
wxCommandEvent event (wxEVT_COMMAND_CHECKBOX_CLICKED, item->GetId());
|
||||||
event.SetInt((int) item->GetValue ());
|
event.SetInt((int) item->GetValue ());
|
||||||
|
@@ -38,7 +38,6 @@ wxChoice::wxChoice()
|
|||||||
m_menuWidget = (WXWidget) 0;
|
m_menuWidget = (WXWidget) 0;
|
||||||
m_widgetList = (WXWidget*) 0;
|
m_widgetList = (WXWidget*) 0;
|
||||||
m_formWidget = (WXWidget) 0;
|
m_formWidget = (WXWidget) 0;
|
||||||
m_inSetValue = FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxChoice::Create(wxWindow *parent, wxWindowID id,
|
bool wxChoice::Create(wxWindow *parent, wxWindowID id,
|
||||||
@@ -57,7 +56,6 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id,
|
|||||||
m_menuWidget = (WXWidget) 0;
|
m_menuWidget = (WXWidget) 0;
|
||||||
m_widgetList = (WXWidget*) 0;
|
m_widgetList = (WXWidget*) 0;
|
||||||
m_formWidget = (WXWidget) 0;
|
m_formWidget = (WXWidget) 0;
|
||||||
m_inSetValue = FALSE;
|
|
||||||
|
|
||||||
if (parent) parent->AddChild(this);
|
if (parent) parent->AddChild(this);
|
||||||
|
|
||||||
@@ -402,7 +400,7 @@ void wxChoiceCallback (Widget w, XtPointer clientData,
|
|||||||
wxChoice *item = (wxChoice *) clientData;
|
wxChoice *item = (wxChoice *) clientData;
|
||||||
if (item)
|
if (item)
|
||||||
{
|
{
|
||||||
if (item->m_inSetValue)
|
if (item->InSetValue())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
char *s = NULL;
|
char *s = NULL;
|
||||||
|
@@ -31,6 +31,7 @@ wxControl::wxControl()
|
|||||||
m_backgroundColour = *wxWHITE;
|
m_backgroundColour = *wxWHITE;
|
||||||
m_foregroundColour = *wxBLACK;
|
m_foregroundColour = *wxBLACK;
|
||||||
m_callback = 0;
|
m_callback = 0;
|
||||||
|
m_inSetValue = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxControl::~wxControl()
|
wxControl::~wxControl()
|
||||||
@@ -47,13 +48,14 @@ wxControl::~wxControl()
|
|||||||
|
|
||||||
void wxControl::SetLabel(const wxString& label)
|
void wxControl::SetLabel(const wxString& label)
|
||||||
{
|
{
|
||||||
if (!GetMainWidget())
|
Widget widget = (Widget) GetLabelWidget() ;
|
||||||
|
if (!widget)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxStripMenuCodes((char*) (const char*) label, wxBuffer);
|
wxStripMenuCodes((char*) (const char*) label, wxBuffer);
|
||||||
|
|
||||||
XmString text = XmStringCreateSimple (wxBuffer);
|
XmString text = XmStringCreateSimple (wxBuffer);
|
||||||
XtVaSetValues ((Widget) GetMainWidget(),
|
XtVaSetValues (widget,
|
||||||
XmNlabelString, text,
|
XmNlabelString, text,
|
||||||
XmNlabelType, XmSTRING,
|
XmNlabelType, XmSTRING,
|
||||||
NULL);
|
NULL);
|
||||||
@@ -62,12 +64,13 @@ void wxControl::SetLabel(const wxString& label)
|
|||||||
|
|
||||||
wxString wxControl::GetLabel() const
|
wxString wxControl::GetLabel() const
|
||||||
{
|
{
|
||||||
if (!GetMainWidget())
|
Widget widget = (Widget) GetLabelWidget() ;
|
||||||
|
if (!widget)
|
||||||
return wxEmptyString;
|
return wxEmptyString;
|
||||||
|
|
||||||
XmString text;
|
XmString text;
|
||||||
char *s;
|
char *s;
|
||||||
XtVaGetValues ((Widget) GetMainWidget(),
|
XtVaGetValues (widget,
|
||||||
XmNlabelString, &text,
|
XmNlabelString, &text,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
@@ -146,7 +146,7 @@ wxWindowDC::wxWindowDC( wxWindow *window )
|
|||||||
|
|
||||||
wxWindowDC::~wxWindowDC(void)
|
wxWindowDC::~wxWindowDC(void)
|
||||||
{
|
{
|
||||||
if ((m_oldFont != (WXFont) 0) && ((long) m_oldFont != -1))
|
if (m_gc && (m_oldFont != (WXFont) 0) && ((long) m_oldFont != -1))
|
||||||
{
|
{
|
||||||
XSetFont ((Display*) m_display, (GC) m_gc, (Font) m_oldFont);
|
XSetFont ((Display*) m_display, (GC) m_gc, (Font) m_oldFont);
|
||||||
|
|
||||||
|
@@ -14,6 +14,11 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/dcmemory.h"
|
#include "wx/dcmemory.h"
|
||||||
|
#include "wx/utils.h"
|
||||||
|
|
||||||
|
#include <Xm/Xm.h>
|
||||||
|
|
||||||
|
#include "wx/motif/private.h"
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxMemoryDC
|
// wxMemoryDC
|
||||||
@@ -23,12 +28,57 @@ IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC, wxWindowDC)
|
|||||||
|
|
||||||
wxMemoryDC::wxMemoryDC(void)
|
wxMemoryDC::wxMemoryDC(void)
|
||||||
{
|
{
|
||||||
m_ok = FALSE;
|
m_ok = TRUE;
|
||||||
|
m_display = wxGetDisplay();
|
||||||
|
|
||||||
|
Display* display = (Display*) m_display;
|
||||||
|
|
||||||
|
XGCValues gcvalues;
|
||||||
|
gcvalues.foreground = BlackPixel (display, DefaultScreen (display));
|
||||||
|
gcvalues.background = WhitePixel (display, DefaultScreen (display));
|
||||||
|
gcvalues.graphics_exposures = False;
|
||||||
|
gcvalues.line_width = 1;
|
||||||
|
m_gc = (WXGC) XCreateGC (display, RootWindow (display, DefaultScreen (display)),
|
||||||
|
GCForeground | GCBackground | GCGraphicsExposures | GCLineWidth,
|
||||||
|
&gcvalues);
|
||||||
|
|
||||||
|
m_backgroundPixel = (int) gcvalues.background;
|
||||||
|
|
||||||
|
// Get the current Font so we can set it back later
|
||||||
|
XGCValues valReturn;
|
||||||
|
XGetGCValues((Display*) m_display, (GC) m_gc, GCFont, &valReturn);
|
||||||
|
m_oldFont = (WXFont) valReturn.font;
|
||||||
|
SetBrush (wxWHITE_BRUSH);
|
||||||
|
SetPen (wxBLACK_PEN);
|
||||||
};
|
};
|
||||||
|
|
||||||
wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) )
|
wxMemoryDC::wxMemoryDC( wxDC* dc )
|
||||||
{
|
{
|
||||||
m_ok = FALSE;
|
m_ok = TRUE;
|
||||||
|
if (dc && dc->IsKindOf(CLASSINFO(wxWindowDC)))
|
||||||
|
m_display = ((wxWindowDC*)dc)->GetDisplay();
|
||||||
|
else
|
||||||
|
m_display = wxGetDisplay();
|
||||||
|
|
||||||
|
Display* display = (Display*) m_display;
|
||||||
|
|
||||||
|
XGCValues gcvalues;
|
||||||
|
gcvalues.foreground = BlackPixel (display, DefaultScreen (display));
|
||||||
|
gcvalues.background = WhitePixel (display, DefaultScreen (display));
|
||||||
|
gcvalues.graphics_exposures = False;
|
||||||
|
gcvalues.line_width = 1;
|
||||||
|
m_gc = (WXGC) XCreateGC (display, RootWindow (display, DefaultScreen (display)),
|
||||||
|
GCForeground | GCBackground | GCGraphicsExposures | GCLineWidth,
|
||||||
|
&gcvalues);
|
||||||
|
|
||||||
|
m_backgroundPixel = (int) gcvalues.background;
|
||||||
|
|
||||||
|
// Get the current Font so we can set it back later
|
||||||
|
XGCValues valReturn;
|
||||||
|
XGetGCValues((Display*) m_display, (GC) m_gc, GCFont, &valReturn);
|
||||||
|
m_oldFont = (WXFont) valReturn.font;
|
||||||
|
SetBrush (wxWHITE_BRUSH);
|
||||||
|
SetPen (wxBLACK_PEN);
|
||||||
};
|
};
|
||||||
|
|
||||||
wxMemoryDC::~wxMemoryDC(void)
|
wxMemoryDC::~wxMemoryDC(void)
|
||||||
@@ -38,13 +88,46 @@ wxMemoryDC::~wxMemoryDC(void)
|
|||||||
void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
|
void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
|
||||||
{
|
{
|
||||||
m_bitmap = bitmap;
|
m_bitmap = bitmap;
|
||||||
if (m_bitmap.Ok())
|
|
||||||
|
if (m_gc)
|
||||||
|
XFreeGC((Display*) m_display, (GC) m_gc);
|
||||||
|
m_gc = (WXGC) NULL;
|
||||||
|
|
||||||
|
if (m_bitmap.Ok() && (bitmap.GetDisplay() == m_display))
|
||||||
{
|
{
|
||||||
m_pixmap = m_bitmap.GetPixmap();
|
m_pixmap = m_bitmap.GetPixmap();
|
||||||
|
Display* display = (Display*) m_display;
|
||||||
|
|
||||||
|
XGCValues gcvalues;
|
||||||
|
gcvalues.foreground = BlackPixel (display, DefaultScreen (display));
|
||||||
|
gcvalues.background = WhitePixel (display, DefaultScreen (display));
|
||||||
|
gcvalues.graphics_exposures = False;
|
||||||
|
gcvalues.line_width = 1;
|
||||||
|
m_gc = (WXGC) XCreateGC (display, RootWindow (display, DefaultScreen (display)),
|
||||||
|
GCForeground | GCBackground | GCGraphicsExposures | GCLineWidth,
|
||||||
|
&gcvalues);
|
||||||
|
|
||||||
|
m_backgroundPixel = (int) gcvalues.background;
|
||||||
|
|
||||||
|
// Get the current Font so we can set it back later
|
||||||
|
XGCValues valReturn;
|
||||||
|
XGetGCValues((Display*) m_display, (GC) m_gc, GCFont, &valReturn);
|
||||||
|
m_oldFont = (WXFont) valReturn.font;
|
||||||
|
|
||||||
|
bool oldOpt = GetOptimization();
|
||||||
|
SetOptimization(FALSE);
|
||||||
|
|
||||||
|
SetBrush (wxWHITE_BRUSH);
|
||||||
|
SetPen (wxBLACK_PEN);
|
||||||
|
|
||||||
|
SetOptimization(oldOpt);
|
||||||
|
|
||||||
|
m_ok = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_ok = FALSE;
|
m_ok = FALSE;
|
||||||
|
m_pixmap = (WXPixmap) 0;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -280,10 +280,16 @@ wxDialog::~wxDialog()
|
|||||||
|
|
||||||
// Now process all events, because otherwise
|
// Now process all events, because otherwise
|
||||||
// this might remain on the screen.
|
// this might remain on the screen.
|
||||||
XSync(XtDisplay(XtParent((Widget) m_mainWidget)), FALSE);
|
Display* display;
|
||||||
|
if (m_mainWidget)
|
||||||
|
display = XtDisplay((Widget) m_mainWidget);
|
||||||
|
else
|
||||||
|
display = (Display*) wxGetDisplay();
|
||||||
|
|
||||||
|
XSync(display, FALSE);
|
||||||
XEvent event;
|
XEvent event;
|
||||||
while (XtAppPending((XtAppContext) wxTheApp->GetAppContext())) {
|
while (XtAppPending((XtAppContext) wxTheApp->GetAppContext())) {
|
||||||
XFlush(XtDisplay((Widget) XtParent((Widget) m_mainWidget)));
|
XFlush(display);
|
||||||
XtAppNextEvent((XtAppContext) wxTheApp->GetAppContext(), &event);
|
XtAppNextEvent((XtAppContext) wxTheApp->GetAppContext(), &event);
|
||||||
XtDispatchEvent(&event);
|
XtDispatchEvent(&event);
|
||||||
}
|
}
|
||||||
|
@@ -348,7 +348,16 @@ void wxFrame::GetClientSize(int *x, int *y) const
|
|||||||
m_frameStatusBar->GetSize(& sbw, & sbh);
|
m_frameStatusBar->GetSize(& sbw, & sbh);
|
||||||
yy -= sbh;
|
yy -= sbh;
|
||||||
}
|
}
|
||||||
|
if (m_frameToolBar)
|
||||||
|
{
|
||||||
|
int tbw, tbh;
|
||||||
|
m_frameToolBar->GetSize(& tbw, & tbh);
|
||||||
|
if (m_frameToolBar->GetWindowStyleFlag() & wxTB_VERTICAL)
|
||||||
|
xx -= tbw;
|
||||||
|
else
|
||||||
|
yy -= tbh;
|
||||||
|
}
|
||||||
|
/*
|
||||||
if (GetMenuBar() != (wxMenuBar*) NULL)
|
if (GetMenuBar() != (wxMenuBar*) NULL)
|
||||||
{
|
{
|
||||||
// it seems that if a frame holds a panel, the menu bar size
|
// it seems that if a frame holds a panel, the menu bar size
|
||||||
@@ -368,6 +377,7 @@ void wxFrame::GetClientSize(int *x, int *y) const
|
|||||||
yy -= ys;
|
yy -= ys;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
*x = xx; *y = yy;
|
*x = xx; *y = yy;
|
||||||
}
|
}
|
||||||
@@ -384,14 +394,22 @@ void wxFrame::SetClientSize(int width, int height)
|
|||||||
|
|
||||||
if (height > -1)
|
if (height > -1)
|
||||||
{
|
{
|
||||||
/* TODO
|
if (m_frameStatusBar)
|
||||||
if (status_line_exists)
|
|
||||||
{
|
{
|
||||||
Dimension ys;
|
int sbw, sbh;
|
||||||
XtVaGetValues(statusLineWidget, XmNheight, &ys, NULL);
|
m_frameStatusBar->GetSize(& sbw, & sbh);
|
||||||
height += ys;
|
height += sbh;
|
||||||
}
|
}
|
||||||
*/
|
if (m_frameToolBar)
|
||||||
|
{
|
||||||
|
int tbw, tbh;
|
||||||
|
m_frameToolBar->GetSize(& tbw, & tbh);
|
||||||
|
if (m_frameToolBar->GetWindowStyleFlag() & wxTB_VERTICAL)
|
||||||
|
width += tbw;
|
||||||
|
else
|
||||||
|
height += tbh;
|
||||||
|
}
|
||||||
|
|
||||||
XtVaSetValues((Widget) m_workArea, XmNheight, height, NULL);
|
XtVaSetValues((Widget) m_workArea, XmNheight, height, NULL);
|
||||||
}
|
}
|
||||||
PreResize();
|
PreResize();
|
||||||
@@ -875,26 +893,15 @@ wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& nam
|
|||||||
|
|
||||||
wxToolBar* wxFrame::OnCreateToolBar(long style, wxWindowID id, const wxString& name)
|
wxToolBar* wxFrame::OnCreateToolBar(long style, wxWindowID id, const wxString& name)
|
||||||
{
|
{
|
||||||
return new wxToolBar(this, id, wxDefaultPosition, wxDefaultSize, style, name);
|
return new wxToolBar(this, id, wxPoint(0, 0), wxSize(100, 24), style, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFrame::PositionToolBar()
|
void wxFrame::PositionToolBar()
|
||||||
{
|
{
|
||||||
int cw, ch;
|
int cw, ch;
|
||||||
|
|
||||||
// TODO: we actually need to use the low-level client size, before
|
|
||||||
// the toolbar/status bar were added.
|
|
||||||
// So DEFINITELY replace the line below with something appropriate.
|
|
||||||
|
|
||||||
GetClientSize(& cw, &ch);
|
GetClientSize(& cw, &ch);
|
||||||
|
|
||||||
if ( GetStatusBar() )
|
|
||||||
{
|
|
||||||
int statusX, statusY;
|
|
||||||
GetStatusBar()->GetClientSize(&statusX, &statusY);
|
|
||||||
ch -= statusY;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GetToolBar())
|
if (GetToolBar())
|
||||||
{
|
{
|
||||||
int tw, th;
|
int tw, th;
|
||||||
@@ -905,7 +912,7 @@ void wxFrame::PositionToolBar()
|
|||||||
// Use the 'real' position. wxSIZE_NO_ADJUSTMENTS
|
// Use the 'real' position. wxSIZE_NO_ADJUSTMENTS
|
||||||
// means, pretend we don't have toolbar/status bar, so we
|
// means, pretend we don't have toolbar/status bar, so we
|
||||||
// have the original client size.
|
// have the original client size.
|
||||||
GetToolBar()->SetSize(0, 0, tw, ch, wxSIZE_NO_ADJUSTMENTS);
|
GetToolBar()->SetSize(0, 0, tw, ch + th, wxSIZE_NO_ADJUSTMENTS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1013,6 +1020,7 @@ static void wxFrameMapProc(Widget frameShell, XtPointer clientData,
|
|||||||
//// Motif-specific
|
//// Motif-specific
|
||||||
bool wxFrame::PreResize()
|
bool wxFrame::PreResize()
|
||||||
{
|
{
|
||||||
|
PositionToolBar();
|
||||||
PositionStatusBar();
|
PositionStatusBar();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@@ -40,7 +40,7 @@ wxIcon::wxIcon(const char bits[], int width, int height)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create from XPM data
|
// Create from XPM data
|
||||||
wxIcon::wxIcon(const char **data)
|
wxIcon::wxIcon(char **data)
|
||||||
{
|
{
|
||||||
(void) Create((void*) data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0);
|
(void) Create((void*) data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
@@ -40,7 +40,6 @@ wxListBox::wxListBox(): m_clientDataList(wxKEY_INTEGER)
|
|||||||
{
|
{
|
||||||
m_noItems = 0;
|
m_noItems = 0;
|
||||||
m_selected = 0;
|
m_selected = 0;
|
||||||
m_inSetValue = FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxListBox::Create(wxWindow *parent, wxWindowID id,
|
bool wxListBox::Create(wxWindow *parent, wxWindowID id,
|
||||||
@@ -51,7 +50,6 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
|
|||||||
const wxValidator& validator,
|
const wxValidator& validator,
|
||||||
const wxString& name)
|
const wxString& name)
|
||||||
{
|
{
|
||||||
m_inSetValue = FALSE;
|
|
||||||
m_windowStyle = style;
|
m_windowStyle = style;
|
||||||
m_noItems = n;
|
m_noItems = n;
|
||||||
m_selected = 0;
|
m_selected = 0;
|
||||||
@@ -86,6 +84,8 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
m_mainWidget = (WXWidget) listWidget;
|
m_mainWidget = (WXWidget) listWidget;
|
||||||
|
|
||||||
|
Set(n, choices);
|
||||||
|
|
||||||
XtManageChild (listWidget);
|
XtManageChild (listWidget);
|
||||||
|
|
||||||
long width = size.x;
|
long width = size.x;
|
||||||
@@ -434,6 +434,8 @@ void wxListBox::SetClientData(int N, char *Client_data)
|
|||||||
wxNode *node = m_clientDataList.Find ((long) N);
|
wxNode *node = m_clientDataList.Find ((long) N);
|
||||||
if (node)
|
if (node)
|
||||||
node->SetData ((wxObject *)Client_data);
|
node->SetData ((wxObject *)Client_data);
|
||||||
|
else
|
||||||
|
node = m_clientDataList.Append((long) N, (wxObject*) Client_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return number of selections and an array of selected integers
|
// Return number of selections and an array of selected integers
|
||||||
@@ -681,7 +683,7 @@ void wxListBoxCallback (Widget w, XtPointer clientData,
|
|||||||
|
|
||||||
wxListBox *item = (wxListBox *) clientData;
|
wxListBox *item = (wxListBox *) clientData;
|
||||||
|
|
||||||
if (item->m_inSetValue)
|
if (item->InSetValue())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxCommandEvent event (wxEVT_COMMAND_LISTBOX_SELECTED);
|
wxCommandEvent event (wxEVT_COMMAND_LISTBOX_SELECTED);
|
||||||
|
@@ -14,6 +14,19 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/radiobox.h"
|
#include "wx/radiobox.h"
|
||||||
|
#include "wx/utils.h"
|
||||||
|
|
||||||
|
#include <Xm/Label.h>
|
||||||
|
#include <Xm/LabelG.h>
|
||||||
|
#include <Xm/ToggleB.h>
|
||||||
|
#include <Xm/ToggleBG.h>
|
||||||
|
#include <Xm/RowColumn.h>
|
||||||
|
#include <Xm/Form.h>
|
||||||
|
|
||||||
|
#include <wx/motif/private.h>
|
||||||
|
|
||||||
|
void wxRadioBoxCallback (Widget w, XtPointer clientData,
|
||||||
|
XmToggleButtonCallbackStruct * cbs);
|
||||||
|
|
||||||
#if !USE_SHARED_LIBRARY
|
#if !USE_SHARED_LIBRARY
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl)
|
IMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl)
|
||||||
@@ -26,6 +39,11 @@ wxRadioBox::wxRadioBox()
|
|||||||
m_noItems = 0;
|
m_noItems = 0;
|
||||||
m_noRowsOrCols = 0;
|
m_noRowsOrCols = 0;
|
||||||
m_majorDim = 0 ;
|
m_majorDim = 0 ;
|
||||||
|
|
||||||
|
m_formWidget = (WXWidget) 0;
|
||||||
|
m_labelWidget = (WXWidget) 0;
|
||||||
|
m_radioButtons = (WXWidget*) NULL;
|
||||||
|
m_radioButtonLabels = (wxString*) NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
|
bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
|
||||||
@@ -36,6 +54,9 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
|
|||||||
{
|
{
|
||||||
m_selectedButton = -1;
|
m_selectedButton = -1;
|
||||||
m_noItems = n;
|
m_noItems = n;
|
||||||
|
m_labelWidget = (WXWidget) 0;
|
||||||
|
m_radioButtons = (WXWidget*) NULL;
|
||||||
|
m_radioButtonLabels = (wxString*) NULL;
|
||||||
|
|
||||||
SetName(name);
|
SetName(name);
|
||||||
SetValidator(val);
|
SetValidator(val);
|
||||||
@@ -56,31 +77,168 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
|
|||||||
else
|
else
|
||||||
m_majorDim = majorDim ;
|
m_majorDim = majorDim ;
|
||||||
|
|
||||||
|
Widget parentWidget = (Widget) parent->GetClientWidget();
|
||||||
|
|
||||||
// TODO create radiobox
|
wxString label1(wxStripMenuCodes(title));
|
||||||
return FALSE;
|
|
||||||
|
XmString text = XmStringCreateSimple ((char*) (const char*) label1);
|
||||||
|
|
||||||
|
Widget formWidget = XtVaCreateManagedWidget ((char*) (const char*) name,
|
||||||
|
xmFormWidgetClass, parentWidget,
|
||||||
|
XmNmarginHeight, 0,
|
||||||
|
XmNmarginWidth, 0,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
m_formWidget = (WXWidget) formWidget;
|
||||||
|
|
||||||
|
if (label1 != "")
|
||||||
|
{
|
||||||
|
text = XmStringCreateSimple ((char*) (const char*) label1);
|
||||||
|
Widget labelWidget = XtVaCreateManagedWidget ((char*) (const char*) label1,
|
||||||
|
#if wxUSE_GADGETS
|
||||||
|
style & wxCOLOURED ?
|
||||||
|
xmLabelWidgetClass : xmLabelGadgetClass,
|
||||||
|
formWidget,
|
||||||
|
#else
|
||||||
|
xmLabelWidgetClass, formWidget,
|
||||||
|
#endif
|
||||||
|
XmNlabelString, text,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
/* TODO: change label font
|
||||||
|
if (labelFont)
|
||||||
|
XtVaSetValues (labelWidget,
|
||||||
|
XmNfontList, labelFont->GetInternalFont (XtDisplay(formWidget)),
|
||||||
|
NULL);
|
||||||
|
*/
|
||||||
|
|
||||||
|
XmStringFree (text);
|
||||||
|
}
|
||||||
|
|
||||||
|
Arg args[3];
|
||||||
|
|
||||||
|
majorDim = (n + majorDim - 1) / majorDim;
|
||||||
|
|
||||||
|
XtSetArg (args[0], XmNorientation, ((style & wxHORIZONTAL) == wxHORIZONTAL ?
|
||||||
|
XmHORIZONTAL : XmVERTICAL));
|
||||||
|
XtSetArg (args[1], XmNnumColumns, majorDim);
|
||||||
|
|
||||||
|
Widget radioBoxWidget = XmCreateRadioBox (formWidget, "radioBoxWidget", args, 2);
|
||||||
|
m_mainWidget = (WXWidget) radioBoxWidget;
|
||||||
|
|
||||||
|
|
||||||
|
if (m_labelWidget)
|
||||||
|
XtVaSetValues ((Widget) m_labelWidget,
|
||||||
|
XmNtopAttachment, XmATTACH_FORM,
|
||||||
|
XmNleftAttachment, XmATTACH_FORM,
|
||||||
|
XmNalignment, XmALIGNMENT_BEGINNING,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
XtVaSetValues (radioBoxWidget,
|
||||||
|
XmNtopAttachment, m_labelWidget ? XmATTACH_WIDGET : XmATTACH_FORM,
|
||||||
|
XmNtopWidget, m_labelWidget ? (Widget) m_labelWidget : formWidget,
|
||||||
|
XmNbottomAttachment, XmATTACH_FORM,
|
||||||
|
XmNleftAttachment, XmATTACH_FORM,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
// if (style & wxFLAT)
|
||||||
|
// XtVaSetValues (radioBoxWidget, XmNborderWidth, 1, NULL);
|
||||||
|
|
||||||
|
m_radioButtons = new WXWidget[n];
|
||||||
|
m_radioButtonLabels = new wxString[n];
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < n; i++)
|
||||||
|
{
|
||||||
|
wxString str(wxStripMenuCodes(choices[i]));
|
||||||
|
m_radioButtonLabels[i] = str;
|
||||||
|
m_radioButtons[i] = (WXWidget) XtVaCreateManagedWidget ((char*) (const char*) str,
|
||||||
|
#if wxUSE_GADGETS
|
||||||
|
xmToggleButtonGadgetClass, radioBoxWidget,
|
||||||
|
#else
|
||||||
|
xmToggleButtonWidgetClass, radioBoxWidget,
|
||||||
|
#endif
|
||||||
|
NULL);
|
||||||
|
XtAddCallback ((Widget) m_radioButtons[i], XmNvalueChangedCallback, (XtCallbackProc) wxRadioBoxCallback,
|
||||||
|
(XtCallbackProc) this);
|
||||||
|
|
||||||
|
/* TODO: set font
|
||||||
|
if (buttonFont)
|
||||||
|
XtVaSetValues ((Widget) m_radioButtons[i],
|
||||||
|
XmNfontList, buttonFont->GetInternalFont (XtDisplay(formWidget)),
|
||||||
|
NULL);
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
SetSelection (0);
|
||||||
|
|
||||||
|
XtManageChild (radioBoxWidget);
|
||||||
|
|
||||||
|
SetCanAddEventHandler(TRUE);
|
||||||
|
AttachWidget (parent, m_mainWidget, m_formWidget, pos.x, pos.y, size.x, size.y);
|
||||||
|
|
||||||
|
SetFont(* parent->GetFont());
|
||||||
|
ChangeColour(m_mainWidget);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxRadioBox::~wxRadioBox()
|
wxRadioBox::~wxRadioBox()
|
||||||
{
|
{
|
||||||
// TODO
|
delete[] m_radioButtonLabels;
|
||||||
|
delete[] m_radioButtons;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxRadioBox::GetLabel(int item) const
|
wxString wxRadioBox::GetLabel(int item) const
|
||||||
{
|
{
|
||||||
// TODO
|
if (item < 0 || item >= m_noItems)
|
||||||
return wxString("");
|
return wxEmptyString;
|
||||||
|
|
||||||
|
Widget widget = (Widget) m_radioButtons[item];
|
||||||
|
XmString text;
|
||||||
|
char *s;
|
||||||
|
XtVaGetValues (widget,
|
||||||
|
XmNlabelString, &text,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
if (XmStringGetLtoR (text, XmSTRING_DEFAULT_CHARSET, &s))
|
||||||
|
{
|
||||||
|
// Should we free 'text'???
|
||||||
|
XmStringFree(text);
|
||||||
|
wxString str(s);
|
||||||
|
XtFree (s);
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
XmStringFree(text);
|
||||||
|
return wxEmptyString;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxRadioBox::SetLabel(int item, const wxString& label)
|
void wxRadioBox::SetLabel(int item, const wxString& label)
|
||||||
{
|
{
|
||||||
// TODO
|
if (item < 0 || item >= m_noItems)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Widget widget = (Widget) m_radioButtons[item];
|
||||||
|
if (label != "")
|
||||||
|
{
|
||||||
|
wxString label1(wxStripMenuCodes(label));
|
||||||
|
XmString text = XmStringCreateSimple ((char*) (const char*) label1);
|
||||||
|
XtVaSetValues (widget,
|
||||||
|
XmNlabelString, text,
|
||||||
|
XmNlabelType, XmSTRING,
|
||||||
|
NULL);
|
||||||
|
XmStringFree (text);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxRadioBox::FindString(const wxString& s) const
|
int wxRadioBox::FindString(const wxString& s) const
|
||||||
{
|
{
|
||||||
// TODO
|
int i;
|
||||||
|
for (i = 0; i < m_noItems; i++)
|
||||||
|
if (s == m_radioButtonLabels[i])
|
||||||
|
return i;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,9 +246,19 @@ void wxRadioBox::SetSelection(int n)
|
|||||||
{
|
{
|
||||||
if ((n < 0) || (n >= m_noItems))
|
if ((n < 0) || (n >= m_noItems))
|
||||||
return;
|
return;
|
||||||
// TODO
|
|
||||||
|
|
||||||
m_selectedButton = n;
|
m_selectedButton = n;
|
||||||
|
|
||||||
|
m_inSetValue = TRUE;
|
||||||
|
|
||||||
|
XmToggleButtonSetState ((Widget) m_radioButtons[n], TRUE, FALSE);
|
||||||
|
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < m_noItems; i++)
|
||||||
|
if (i != n)
|
||||||
|
XmToggleButtonSetState ((Widget) m_radioButtons[i], FALSE, FALSE);
|
||||||
|
|
||||||
|
m_inSetValue = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get single selection, for single choice list items
|
// Get single selection, for single choice list items
|
||||||
@@ -102,51 +270,56 @@ int wxRadioBox::GetSelection() const
|
|||||||
// Find string for position
|
// Find string for position
|
||||||
wxString wxRadioBox::GetString(int n) const
|
wxString wxRadioBox::GetString(int n) const
|
||||||
{
|
{
|
||||||
// TODO
|
if ((n < 0) || (n >= m_noItems))
|
||||||
return wxString("");
|
return wxEmptyString;
|
||||||
|
return m_radioButtonLabels[n];
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxRadioBox::SetSize(int x, int y, int width, int height, int sizeFlags)
|
void wxRadioBox::SetSize(int x, int y, int width, int height, int sizeFlags)
|
||||||
{
|
{
|
||||||
// TODO
|
bool managed = XtIsManaged((Widget) m_formWidget);
|
||||||
}
|
|
||||||
|
|
||||||
void wxRadioBox::GetSize(int *width, int *height) const
|
if (managed)
|
||||||
{
|
XtUnmanageChild ((Widget) m_formWidget);
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxRadioBox::GetPosition(int *x, int *y) const
|
int xx = x; int yy = y;
|
||||||
{
|
AdjustForParentClientOrigin(xx, yy, sizeFlags);
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
wxString wxRadioBox::GetLabel() const
|
if (x > -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
||||||
{
|
XtVaSetValues ((Widget) m_formWidget, XmNleftAttachment, XmATTACH_SELF,
|
||||||
// TODO
|
XmNx, xx, NULL);
|
||||||
return wxString("");
|
if (y > -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
||||||
}
|
XtVaSetValues ((Widget) m_formWidget, XmNtopAttachment, XmATTACH_SELF,
|
||||||
|
XmNy, yy, NULL);
|
||||||
|
|
||||||
void wxRadioBox::SetLabel(const wxString& label)
|
// Must set the actual RadioBox to be desired size MINUS label size
|
||||||
{
|
Dimension labelWidth = 0, labelHeight = 0, actualWidth = 0, actualHeight = 0;
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxRadioBox::SetFocus()
|
if (m_labelWidget)
|
||||||
{
|
XtVaGetValues ((Widget) m_labelWidget, XmNwidth, &labelWidth, XmNheight, &labelHeight, NULL);
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxRadioBox::Show(bool show)
|
actualWidth = width;
|
||||||
|
actualHeight = height - labelHeight;
|
||||||
|
|
||||||
|
if (width > -1)
|
||||||
{
|
{
|
||||||
// TODO
|
XtVaSetValues ((Widget) m_mainWidget, XmNwidth, actualWidth, NULL);
|
||||||
return FALSE;
|
}
|
||||||
|
if (height > -1)
|
||||||
|
{
|
||||||
|
XtVaSetValues ((Widget) m_mainWidget, XmNheight, actualHeight, NULL);
|
||||||
|
}
|
||||||
|
if (managed)
|
||||||
|
XtManageChild ((Widget) m_formWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enable a specific button
|
// Enable a specific button
|
||||||
void wxRadioBox::Enable(int item, bool enable)
|
void wxRadioBox::Enable(int n, bool enable)
|
||||||
{
|
{
|
||||||
// TODO
|
if ((n < 0) || (n >= m_noItems))
|
||||||
|
return;
|
||||||
|
|
||||||
|
XtSetSensitive ((Widget) m_radioButtons[n], (Boolean) enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enable all controls
|
// Enable all controls
|
||||||
@@ -154,13 +327,38 @@ void wxRadioBox::Enable(bool enable)
|
|||||||
{
|
{
|
||||||
wxControl::Enable(enable);
|
wxControl::Enable(enable);
|
||||||
|
|
||||||
// TODO
|
int i;
|
||||||
|
for (i = 0; i < m_noItems; i++)
|
||||||
|
XtSetSensitive ((Widget) m_radioButtons[i], (Boolean) enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show a specific button
|
// Show a specific button
|
||||||
void wxRadioBox::Show(int item, bool show)
|
void wxRadioBox::Show(int n, bool show)
|
||||||
{
|
{
|
||||||
// TODO
|
// This method isn't complete, and we try do do our best...
|
||||||
|
// It's main purpose isn't for allowing Show/Unshow dynamically,
|
||||||
|
// but rather to provide a way to design wxRadioBox such:
|
||||||
|
//
|
||||||
|
// o Val1 o Val2 o Val3
|
||||||
|
// o Val4 o Val6
|
||||||
|
// o Val7 o Val8 o Val9
|
||||||
|
//
|
||||||
|
// In my case, this is a 'direction' box, and the Show(5,False) is
|
||||||
|
// coupled with an Enable(5,False)
|
||||||
|
//
|
||||||
|
if ((n < 0) || (n >= m_noItems))
|
||||||
|
return;
|
||||||
|
|
||||||
|
XtVaSetValues ((Widget) m_radioButtons[n],
|
||||||
|
XmNindicatorOn, (unsigned char) show,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
// Please note that this is all we can do: removing the label
|
||||||
|
// if switching to unshow state. However, when switching
|
||||||
|
// to the on state, it's the prog. resp. to call SetLabel(item,...)
|
||||||
|
// after this call!!
|
||||||
|
if (!show)
|
||||||
|
wxRadioBox::SetLabel (n, " ");
|
||||||
}
|
}
|
||||||
|
|
||||||
// For single selection items only
|
// For single selection items only
|
||||||
@@ -191,4 +389,26 @@ void wxRadioBox::Command (wxCommandEvent & event)
|
|||||||
ProcessCommand (event);
|
ProcessCommand (event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxRadioBoxCallback (Widget w, XtPointer clientData,
|
||||||
|
XmToggleButtonCallbackStruct * cbs)
|
||||||
|
{
|
||||||
|
if (!cbs->set)
|
||||||
|
return;
|
||||||
|
|
||||||
|
wxRadioBox *item = (wxRadioBox *) clientData;
|
||||||
|
int sel = -1;
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < item->Number(); i++)
|
||||||
|
if (item->GetRadioButtons() && ((Widget) (item->GetRadioButtons()[i]) == w))
|
||||||
|
sel = i;
|
||||||
|
item->SetSel(sel);
|
||||||
|
|
||||||
|
if (item->InSetValue())
|
||||||
|
return;
|
||||||
|
|
||||||
|
wxCommandEvent event (wxEVT_COMMAND_RADIOBOX_SELECTED, item->GetId());
|
||||||
|
event.m_commandInt = sel;
|
||||||
|
event.SetEventObject(item);
|
||||||
|
item->ProcessCommand (event);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -14,11 +14,30 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/radiobut.h"
|
#include "wx/radiobut.h"
|
||||||
|
#include "wx/utils.h"
|
||||||
|
|
||||||
|
#include <Xm/Label.h>
|
||||||
|
#include <Xm/LabelG.h>
|
||||||
|
#include <Xm/ToggleB.h>
|
||||||
|
#include <Xm/ToggleBG.h>
|
||||||
|
#include <Xm/RowColumn.h>
|
||||||
|
#include <Xm/Form.h>
|
||||||
|
|
||||||
|
#include <wx/motif/private.h>
|
||||||
|
|
||||||
|
void wxRadioButtonCallback (Widget w, XtPointer clientData,
|
||||||
|
XmToggleButtonCallbackStruct * cbs);
|
||||||
|
|
||||||
#if !USE_SHARED_LIBRARY
|
#if !USE_SHARED_LIBRARY
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxRadioButton, wxControl)
|
IMPLEMENT_DYNAMIC_CLASS(wxRadioButton, wxControl)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
wxRadioButton::wxRadioButton()
|
||||||
|
{
|
||||||
|
m_labelWidget = (WXWidget) 0;
|
||||||
|
m_formWidget = (WXWidget) 0;
|
||||||
|
}
|
||||||
|
|
||||||
bool wxRadioButton::Create(wxWindow *parent, wxWindowID id,
|
bool wxRadioButton::Create(wxWindow *parent, wxWindowID id,
|
||||||
const wxString& label,
|
const wxString& label,
|
||||||
const wxPoint& pos,
|
const wxPoint& pos,
|
||||||
@@ -38,25 +57,95 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
m_windowStyle = style ;
|
m_windowStyle = style ;
|
||||||
|
|
||||||
// TODO create radiobutton
|
Widget parentWidget = (Widget) parent->GetClientWidget();
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxRadioButton::SetLabel(const wxString& label)
|
wxString label1(wxStripMenuCodes(label));
|
||||||
{
|
|
||||||
// TODO
|
XmString text = XmStringCreateSimple ((char*) (const char*) label1);
|
||||||
|
|
||||||
|
Widget formWidget = XtVaCreateManagedWidget ((char*) (const char*) name,
|
||||||
|
xmFormWidgetClass, parentWidget,
|
||||||
|
XmNmarginHeight, 0,
|
||||||
|
XmNmarginWidth, 0,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
m_formWidget = (WXWidget) formWidget;
|
||||||
|
|
||||||
|
Widget labelWidget = XtVaCreateManagedWidget ((char*) (const char*) label1,
|
||||||
|
#if wxUSE_GADGETS
|
||||||
|
xmLabelGadgetClass,
|
||||||
|
formWidget,
|
||||||
|
#else
|
||||||
|
xmLabelWidgetClass, formWidget,
|
||||||
|
#endif
|
||||||
|
XmNlabelString, text,
|
||||||
|
NULL);
|
||||||
|
m_labelWidget = (WXWidget) labelWidget;
|
||||||
|
/* TODO
|
||||||
|
if (labelFont)
|
||||||
|
XtVaSetValues (labelWidget,
|
||||||
|
XmNfontList, labelFont->GetInternalFont (XtDisplay(formWidget)),
|
||||||
|
NULL);
|
||||||
|
*/
|
||||||
|
|
||||||
|
XmStringFree (text);
|
||||||
|
|
||||||
|
Widget radioButtonWidget = XtVaCreateManagedWidget ("toggle",
|
||||||
|
#if wxUSE_GADGETS
|
||||||
|
xmToggleButtonGadgetClass, formWidget,
|
||||||
|
#else
|
||||||
|
xmToggleButtonWidgetClass, formWidget,
|
||||||
|
#endif
|
||||||
|
NULL);
|
||||||
|
XtAddCallback (radioButtonWidget, XmNvalueChangedCallback, (XtCallbackProc) wxRadioButtonCallback,
|
||||||
|
(XtCallbackProc) this);
|
||||||
|
|
||||||
|
m_mainWidget = (WXWidget) radioButtonWidget;
|
||||||
|
|
||||||
|
/* TODO
|
||||||
|
if (labelFont)
|
||||||
|
XtVaSetValues (radioButtonWidget,
|
||||||
|
XmNfontList, labelFont->GetInternalFont (XtDisplay(formWidget)),
|
||||||
|
NULL);
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (labelWidget)
|
||||||
|
XtVaSetValues (labelWidget,
|
||||||
|
XmNtopAttachment, XmATTACH_FORM,
|
||||||
|
XmNleftAttachment, XmATTACH_FORM,
|
||||||
|
XmNbottomAttachment, XmATTACH_FORM,
|
||||||
|
XmNalignment, XmALIGNMENT_BEGINNING,
|
||||||
|
NULL);
|
||||||
|
XtVaSetValues (radioButtonWidget,
|
||||||
|
XmNleftOffset, 4,
|
||||||
|
XmNtopAttachment, XmATTACH_FORM,
|
||||||
|
XmNbottomAttachment, XmATTACH_FORM,
|
||||||
|
XmNleftAttachment, (Widget) m_labelWidget ? XmATTACH_WIDGET : XmATTACH_FORM,
|
||||||
|
XmNleftWidget, (Widget) m_labelWidget ? (Widget) m_labelWidget : formWidget,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
XtManageChild (radioButtonWidget);
|
||||||
|
|
||||||
|
SetCanAddEventHandler(TRUE);
|
||||||
|
AttachWidget (parent, m_mainWidget, m_formWidget, pos.x, pos.y, size.x, size.y);
|
||||||
|
|
||||||
|
SetFont(* parent->GetFont());
|
||||||
|
ChangeColour(m_mainWidget);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxRadioButton::SetValue(bool value)
|
void wxRadioButton::SetValue(bool value)
|
||||||
{
|
{
|
||||||
// TODO
|
m_inSetValue = TRUE;
|
||||||
|
XmToggleButtonSetState ((Widget) m_mainWidget, (Boolean) value, FALSE);
|
||||||
|
m_inSetValue = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get single selection, for single choice list items
|
// Get single selection, for single choice list items
|
||||||
bool wxRadioButton::GetValue() const
|
bool wxRadioButton::GetValue() const
|
||||||
{
|
{
|
||||||
// TODO
|
return (XmToggleButtonGetState ((Widget) m_mainWidget) != 0);
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxRadioButton::Command (wxCommandEvent & event)
|
void wxRadioButton::Command (wxCommandEvent & event)
|
||||||
@@ -65,4 +154,19 @@ void wxRadioButton::Command (wxCommandEvent & event)
|
|||||||
ProcessCommand (event);
|
ProcessCommand (event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxRadioButtonCallback (Widget w, XtPointer clientData,
|
||||||
|
XmToggleButtonCallbackStruct * cbs)
|
||||||
|
{
|
||||||
|
if (!cbs->set)
|
||||||
|
return;
|
||||||
|
|
||||||
|
wxRadioButton *item = (wxRadioButton *) clientData;
|
||||||
|
if (item->InSetValue())
|
||||||
|
return;
|
||||||
|
|
||||||
|
wxCommandEvent event (wxEVT_COMMAND_RADIOBUTTON_SELECTED, item->GetId());
|
||||||
|
event.SetEventObject(item);
|
||||||
|
|
||||||
|
item->ProcessCommand (event);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -14,6 +14,17 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/slider.h"
|
#include "wx/slider.h"
|
||||||
|
#include "wx/utils.h"
|
||||||
|
|
||||||
|
#include <Xm/Xm.h>
|
||||||
|
#include <Xm/Label.h>
|
||||||
|
#include <Xm/LabelG.h>
|
||||||
|
#include <Xm/RowColumn.h>
|
||||||
|
#include <Xm/Scale.h>
|
||||||
|
|
||||||
|
#include <wx/motif/private.h>
|
||||||
|
|
||||||
|
void wxSliderCallback (Widget widget, XtPointer clientData, XmScaleCallbackStruct * cbs);
|
||||||
|
|
||||||
#if !USE_SHARED_LIBRARY
|
#if !USE_SHARED_LIBRARY
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxSlider, wxControl)
|
IMPLEMENT_DYNAMIC_CLASS(wxSlider, wxControl)
|
||||||
@@ -58,11 +69,41 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
|
|||||||
m_rangeMax = maxValue;
|
m_rangeMax = maxValue;
|
||||||
m_rangeMin = minValue;
|
m_rangeMin = minValue;
|
||||||
|
|
||||||
|
// Not used in Motif, I think
|
||||||
m_pageSize = (int)((maxValue-minValue)/10);
|
m_pageSize = (int)((maxValue-minValue)/10);
|
||||||
|
|
||||||
// TODO create slider
|
Widget parentWidget = (Widget) parent->GetClientWidget();
|
||||||
|
|
||||||
return FALSE;
|
Widget sliderWidget = XtVaCreateManagedWidget ("sliderWidget",
|
||||||
|
xmScaleWidgetClass, parentWidget,
|
||||||
|
XmNorientation,
|
||||||
|
(((m_windowStyle & wxSL_VERTICAL) == wxSL_VERTICAL) ? XmVERTICAL : XmHORIZONTAL),
|
||||||
|
XmNprocessingDirection,
|
||||||
|
(((m_windowStyle & wxSL_VERTICAL) == wxSL_VERTICAL) ? XmMAX_ON_TOP : XmMAX_ON_RIGHT),
|
||||||
|
XmNmaximum, maxValue,
|
||||||
|
XmNminimum, minValue,
|
||||||
|
XmNvalue, value,
|
||||||
|
XmNshowValue, True,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
m_mainWidget = (WXWidget) sliderWidget;
|
||||||
|
|
||||||
|
if(style & wxSL_NOTIFY_DRAG)
|
||||||
|
XtAddCallback (sliderWidget, XmNdragCallback,
|
||||||
|
(XtCallbackProc) wxSliderCallback, (XtPointer) this);
|
||||||
|
else
|
||||||
|
XtAddCallback (sliderWidget, XmNvalueChangedCallback,
|
||||||
|
(XtCallbackProc) wxSliderCallback, (XtPointer) this);
|
||||||
|
|
||||||
|
XtAddCallback (sliderWidget, XmNdragCallback, (XtCallbackProc) wxSliderCallback, (XtPointer) this);
|
||||||
|
|
||||||
|
SetCanAddEventHandler(TRUE);
|
||||||
|
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
|
||||||
|
|
||||||
|
SetFont(* parent->GetFont());
|
||||||
|
ChangeColour(m_mainWidget);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSlider::~wxSlider()
|
wxSlider::~wxSlider()
|
||||||
@@ -71,28 +112,50 @@ wxSlider::~wxSlider()
|
|||||||
|
|
||||||
int wxSlider::GetValue() const
|
int wxSlider::GetValue() const
|
||||||
{
|
{
|
||||||
// TODO
|
int val;
|
||||||
return 0;
|
XtVaGetValues ((Widget) m_mainWidget, XmNvalue, &val, NULL);
|
||||||
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSlider::SetValue(int value)
|
void wxSlider::SetValue(int value)
|
||||||
{
|
{
|
||||||
// TODO
|
XtVaSetValues ((Widget) m_mainWidget, XmNvalue, value, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSlider::GetSize(int *width, int *height) const
|
void wxSlider::GetSize(int *width, int *height) const
|
||||||
{
|
{
|
||||||
// TODO
|
wxControl::GetSize(width, height);
|
||||||
}
|
|
||||||
|
|
||||||
void wxSlider::GetPosition(int *x, int *y) const
|
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSlider::SetSize(int x, int y, int width, int height, int sizeFlags)
|
void wxSlider::SetSize(int x, int y, int width, int height, int sizeFlags)
|
||||||
{
|
{
|
||||||
// TODO
|
Widget widget = (Widget) m_mainWidget;
|
||||||
|
|
||||||
|
bool managed = XtIsManaged(widget);
|
||||||
|
|
||||||
|
if (managed)
|
||||||
|
XtUnmanageChild (widget);
|
||||||
|
|
||||||
|
if (((m_windowStyle & wxHORIZONTAL) == wxHORIZONTAL) && (width > -1))
|
||||||
|
{
|
||||||
|
XtVaSetValues (widget, XmNscaleWidth, wxMax (width, 10), NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (((m_windowStyle & wxVERTICAL) == wxVERTICAL) && (height > -1))
|
||||||
|
{
|
||||||
|
XtVaSetValues (widget, XmNscaleHeight, wxMax (height, 10), NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
int xx = x; int yy = y;
|
||||||
|
AdjustForParentClientOrigin(xx, yy, sizeFlags);
|
||||||
|
|
||||||
|
if (x > -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
||||||
|
XtVaSetValues (widget, XmNx, xx, NULL);
|
||||||
|
if (y > -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
||||||
|
XtVaSetValues (widget, XmNy, yy, NULL);
|
||||||
|
|
||||||
|
if (managed)
|
||||||
|
XtManageChild (widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSlider::SetRange(int minValue, int maxValue)
|
void wxSlider::SetRange(int minValue, int maxValue)
|
||||||
@@ -100,19 +163,19 @@ void wxSlider::SetRange(int minValue, int maxValue)
|
|||||||
m_rangeMin = minValue;
|
m_rangeMin = minValue;
|
||||||
m_rangeMax = maxValue;
|
m_rangeMax = maxValue;
|
||||||
|
|
||||||
// TODO
|
XtVaSetValues ((Widget) m_mainWidget, XmNminimum, minValue, XmNmaximum, maxValue, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// For trackbars only
|
// For trackbars only
|
||||||
void wxSlider::SetTickFreq(int n, int pos)
|
void wxSlider::SetTickFreq(int n, int pos)
|
||||||
{
|
{
|
||||||
// TODO
|
// Not implemented in Motif
|
||||||
m_tickFreq = n;
|
m_tickFreq = n;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSlider::SetPageSize(int pageSize)
|
void wxSlider::SetPageSize(int pageSize)
|
||||||
{
|
{
|
||||||
// TODO
|
// Not implemented in Motif
|
||||||
m_pageSize = pageSize;
|
m_pageSize = pageSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,57 +186,57 @@ int wxSlider::GetPageSize() const
|
|||||||
|
|
||||||
void wxSlider::ClearSel()
|
void wxSlider::ClearSel()
|
||||||
{
|
{
|
||||||
// TODO
|
// Not implemented in Motif
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSlider::ClearTicks()
|
void wxSlider::ClearTicks()
|
||||||
{
|
{
|
||||||
// TODO
|
// Not implemented in Motif
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSlider::SetLineSize(int lineSize)
|
void wxSlider::SetLineSize(int lineSize)
|
||||||
{
|
{
|
||||||
|
// Not implemented in Motif
|
||||||
m_lineSize = lineSize;
|
m_lineSize = lineSize;
|
||||||
// TODO
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxSlider::GetLineSize() const
|
int wxSlider::GetLineSize() const
|
||||||
{
|
{
|
||||||
// TODO
|
// Not implemented in Motif
|
||||||
return 0;
|
return m_lineSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxSlider::GetSelEnd() const
|
int wxSlider::GetSelEnd() const
|
||||||
{
|
{
|
||||||
// TODO
|
// Not implemented in Motif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxSlider::GetSelStart() const
|
int wxSlider::GetSelStart() const
|
||||||
{
|
{
|
||||||
// TODO
|
// Not implemented in Motif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSlider::SetSelection(int minPos, int maxPos)
|
void wxSlider::SetSelection(int WXUNUSED(minPos), int WXUNUSED(maxPos))
|
||||||
{
|
{
|
||||||
// TODO
|
// Not implemented in Motif
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSlider::SetThumbLength(int len)
|
void wxSlider::SetThumbLength(int WXUNUSED(len))
|
||||||
{
|
{
|
||||||
// TODO
|
// Not implemented in Motif (?)
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxSlider::GetThumbLength() const
|
int wxSlider::GetThumbLength() const
|
||||||
{
|
{
|
||||||
// TODO
|
// Not implemented in Motif (?)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSlider::SetTick(int tickPos)
|
void wxSlider::SetTick(int WXUNUSED(tickPos))
|
||||||
{
|
{
|
||||||
// TODO
|
// Not implemented in Motif
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSlider::Command (wxCommandEvent & event)
|
void wxSlider::Command (wxCommandEvent & event)
|
||||||
@@ -182,9 +245,25 @@ void wxSlider::Command (wxCommandEvent & event)
|
|||||||
ProcessCommand (event);
|
ProcessCommand (event);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxSlider::Show(bool show)
|
void wxSliderCallback (Widget widget, XtPointer clientData, XmScaleCallbackStruct * cbs)
|
||||||
{
|
{
|
||||||
// TODO
|
wxSlider *slider = (wxSlider *) clientData;
|
||||||
return TRUE;
|
switch (cbs->reason)
|
||||||
|
{
|
||||||
|
case XmCR_VALUE_CHANGED:
|
||||||
|
case XmCR_DRAG:
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
// TODO: the XmCR_VALUE_CHANGED case should be handled
|
||||||
|
// differently (it's not sent continually as the slider moves).
|
||||||
|
// In which case we need a similar behaviour for other platforms.
|
||||||
|
|
||||||
|
wxScrollEvent event(wxEVT_SCROLL_THUMBTRACK, slider->GetId());
|
||||||
|
XtVaGetValues (widget, XmNvalue, &event.m_commandInt, NULL);
|
||||||
|
event.SetEventObject(slider);
|
||||||
|
slider->ProcessCommand(event);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -15,6 +15,13 @@
|
|||||||
|
|
||||||
#include "wx/statbmp.h"
|
#include "wx/statbmp.h"
|
||||||
|
|
||||||
|
#include <Xm/Xm.h>
|
||||||
|
#include <Xm/Label.h>
|
||||||
|
#include <Xm/LabelG.h>
|
||||||
|
#include <Xm/RowColumn.h>
|
||||||
|
|
||||||
|
#include <wx/motif/private.h>
|
||||||
|
|
||||||
#if !USE_SHARED_LIBRARY
|
#if !USE_SHARED_LIBRARY
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxControl)
|
IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxControl)
|
||||||
#endif
|
#endif
|
||||||
@@ -41,19 +48,72 @@ bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
m_windowStyle = style;
|
m_windowStyle = style;
|
||||||
|
|
||||||
// TODO: create static bitmap control
|
Widget parentWidget = (Widget) parent->GetClientWidget();
|
||||||
return FALSE;
|
|
||||||
|
m_mainWidget = (WXWidget) XtVaCreateManagedWidget ("staticBitmap",
|
||||||
|
#if USE_GADGETS
|
||||||
|
xmLabelGadgetClass, parentWidget,
|
||||||
|
#else
|
||||||
|
xmLabelWidgetClass, parentWidget,
|
||||||
|
#endif
|
||||||
|
XmNalignment, XmALIGNMENT_BEGINNING,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
XtVaSetValues ((Widget) m_mainWidget,
|
||||||
|
XmNlabelPixmap, (Pixmap) ((wxBitmap&)bitmap).GetLabelPixmap (m_mainWidget),
|
||||||
|
XmNlabelType, XmPIXMAP,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
SetCanAddEventHandler(TRUE);
|
||||||
|
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
|
||||||
|
|
||||||
|
SetFont(* parent->GetFont());
|
||||||
|
|
||||||
|
ChangeColour (m_mainWidget);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxStaticBitmap::~wxStaticBitmap()
|
||||||
|
{
|
||||||
|
SetBitmap(wxNullBitmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxStaticBitmap::SetSize(int x, int y, int width, int height, int sizeFlags)
|
void wxStaticBitmap::SetSize(int x, int y, int width, int height, int sizeFlags)
|
||||||
{
|
{
|
||||||
// TODO
|
wxControl::SetSize(x, y, width, height, sizeFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxStaticBitmap::SetBitmap(const wxBitmap& bitmap)
|
void wxStaticBitmap::SetBitmap(const wxBitmap& bitmap)
|
||||||
{
|
{
|
||||||
m_messageBitmap = bitmap;
|
m_messageBitmap = bitmap;
|
||||||
|
|
||||||
// TODO: redraw bitmap
|
Widget widget = (Widget) m_mainWidget;
|
||||||
|
int x, y, w1, h1, w2, h2;
|
||||||
|
|
||||||
|
GetPosition(&x, &y);
|
||||||
|
|
||||||
|
if (bitmap.Ok())
|
||||||
|
{
|
||||||
|
w2 = bitmap.GetWidth();
|
||||||
|
h2 = bitmap.GetHeight();
|
||||||
|
XtVaSetValues (widget,
|
||||||
|
XmNlabelPixmap, ((wxBitmap&)bitmap).GetLabelPixmap (widget),
|
||||||
|
XmNlabelType, XmPIXMAP,
|
||||||
|
NULL);
|
||||||
|
GetSize(&w1, &h1);
|
||||||
|
|
||||||
|
if (! (w1 == w2) && (h1 == h2))
|
||||||
|
SetSize(x, y, w2, h2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Null bitmap: must not use current pixmap
|
||||||
|
// since it is no longer valid.
|
||||||
|
XtVaSetValues (widget,
|
||||||
|
XmNlabelType, XmSTRING,
|
||||||
|
XmNlabelPixmap, NULL, // TODO: Does this work?
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -70,9 +70,7 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
|
|||||||
SetFont(* parent->GetFont());
|
SetFont(* parent->GetFont());
|
||||||
|
|
||||||
ChangeColour (m_mainWidget);
|
ChangeColour (m_mainWidget);
|
||||||
// ChangeFont (m_mainWidget);
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -67,7 +67,6 @@ wxTextCtrl::wxTextCtrl()
|
|||||||
m_tempCallbackStruct = (void*) NULL;
|
m_tempCallbackStruct = (void*) NULL;
|
||||||
m_modified = FALSE;
|
m_modified = FALSE;
|
||||||
m_processedDefault = FALSE;
|
m_processedDefault = FALSE;
|
||||||
m_inSetValue = FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
|
bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
|
||||||
@@ -81,7 +80,6 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
|
|||||||
m_modified = FALSE;
|
m_modified = FALSE;
|
||||||
m_processedDefault = FALSE;
|
m_processedDefault = FALSE;
|
||||||
m_fileName = "";
|
m_fileName = "";
|
||||||
m_inSetValue = FALSE;
|
|
||||||
|
|
||||||
SetName(name);
|
SetName(name);
|
||||||
SetValidator(validator);
|
SetValidator(validator);
|
||||||
@@ -718,7 +716,7 @@ wxTextWindowModifyProc (Widget w, XtPointer clientData, XmTextVerifyCallbackStru
|
|||||||
|
|
||||||
tw->m_tempCallbackStruct = NULL;
|
tw->m_tempCallbackStruct = NULL;
|
||||||
|
|
||||||
if (tw->m_inSetValue)
|
if (tw->InSetValue())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (tw->m_processedDefault)
|
if (tw->m_processedDefault)
|
||||||
@@ -757,7 +755,7 @@ wxTextWindowModifyProc (Widget w, XtPointer clientData, XmTextVerifyCallbackStru
|
|||||||
|
|
||||||
tw->m_tempCallbackStruct = NULL;
|
tw->m_tempCallbackStruct = NULL;
|
||||||
|
|
||||||
if (tw->m_inSetValue)
|
if (tw->InSetValue())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (tw->m_processedDefault)
|
if (tw->m_processedDefault)
|
||||||
@@ -810,7 +808,7 @@ static void wxTextWindowActivateProc(Widget w, XtPointer clientData,
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (tw->m_inSetValue)
|
if (tw->InSetValue())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER);
|
wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER);
|
||||||
|
@@ -18,43 +18,108 @@
|
|||||||
#include "wx/setup.h"
|
#include "wx/setup.h"
|
||||||
#include "wx/utils.h"
|
#include "wx/utils.h"
|
||||||
#include "wx/app.h"
|
#include "wx/app.h"
|
||||||
|
#include "wx/msgdlg.h"
|
||||||
|
#include "wx/cursor.h"
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#include <dirent.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <sys/wait.h>
|
||||||
|
#include <pwd.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <netdb.h>
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
|
#ifdef __SVR4__
|
||||||
|
#include <sys/systeminfo.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <Xm/Xm.h>
|
#include <Xm/Xm.h>
|
||||||
|
|
||||||
#include "wx/motif/private.h"
|
#include "wx/motif/private.h"
|
||||||
|
|
||||||
|
// Yuck this is really BOTH site and platform dependent
|
||||||
|
// so we should use some other strategy!
|
||||||
|
#ifdef sun
|
||||||
|
# define DEFAULT_XRESOURCE_DIR "/usr/openwin/lib/app-defaults"
|
||||||
|
#else
|
||||||
|
# define DEFAULT_XRESOURCE_DIR "/usr/lib/X11/app-defaults"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static char *GetIniFile (char *dest, const char *filename);
|
||||||
|
|
||||||
|
extern wxList wxTopLevelWindows;
|
||||||
|
|
||||||
// Get full hostname (eg. DoDo.BSn-Germany.crg.de)
|
// Get full hostname (eg. DoDo.BSn-Germany.crg.de)
|
||||||
bool wxGetHostName(char *buf, int maxSize)
|
bool wxGetHostName(char *buf, int maxSize)
|
||||||
{
|
{
|
||||||
// TODO
|
#if defined(SVR4) && !defined(__hpux)
|
||||||
|
return (sysinfo (SI_HOSTNAME, buf, maxSize) != -1);
|
||||||
|
#else /* BSD Sockets */
|
||||||
|
char name[255];
|
||||||
|
struct hostent *h;
|
||||||
|
|
||||||
|
// Get hostname
|
||||||
|
if (gethostname (name, sizeof (name) / sizeof (char) - 1) == -1)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
// Get official full name of host
|
||||||
|
strncpy (buf
|
||||||
|
,(h = gethostbyname (name)) != NULL ? h->h_name : name
|
||||||
|
,maxSize - 1);
|
||||||
|
return TRUE;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get user ID e.g. jacs
|
// Get user ID e.g. jacs
|
||||||
bool wxGetUserId(char *buf, int maxSize)
|
bool wxGetUserId(char *buf, int maxSize)
|
||||||
{
|
{
|
||||||
// TODO
|
#ifdef VMS
|
||||||
|
*buf = '\0'; // return empty string
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
#else
|
||||||
|
struct passwd *who;
|
||||||
|
|
||||||
|
if ((who = getpwuid (getuid ())) != NULL)
|
||||||
|
{
|
||||||
|
strncpy (buf, who->pw_name, maxSize - 1);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get user name e.g. Julian Smart
|
// Get user name e.g. Julian Smart
|
||||||
bool wxGetUserName(char *buf, int maxSize)
|
bool wxGetUserName(char *buf, int maxSize)
|
||||||
{
|
{
|
||||||
// TODO
|
#ifdef VMS
|
||||||
|
*buf = '\0'; // return empty string
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
#else
|
||||||
|
struct passwd *who;
|
||||||
|
|
||||||
|
if ((who = getpwuid (getuid ())) != NULL)
|
||||||
|
{
|
||||||
|
strncpy (buf, who->pw_gecos, maxSize - 1);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxKill(long pid, int sig)
|
int wxKill(long pid, int sig)
|
||||||
{
|
{
|
||||||
// TODO
|
int unixSignal = 0;
|
||||||
return 0;
|
switch (sig)
|
||||||
|
{
|
||||||
|
case wxSIGTERM:
|
||||||
|
default:
|
||||||
|
unixSignal = SIGTERM;
|
||||||
|
}
|
||||||
|
return kill( (int)pid, unixSignal);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -62,40 +127,72 @@ int wxKill(long pid, int sig)
|
|||||||
//
|
//
|
||||||
bool wxShell(const wxString& command)
|
bool wxShell(const wxString& command)
|
||||||
{
|
{
|
||||||
// TODO
|
#ifdef VMS
|
||||||
return FALSE;
|
return(FALSE);
|
||||||
|
#else
|
||||||
|
#if defined(sun) || defined(__ultrix) || defined(__bsdi__)
|
||||||
|
pid_t pid = vfork ();
|
||||||
|
#else
|
||||||
|
pid_t pid = fork ();
|
||||||
|
#endif
|
||||||
|
switch( pid ) {
|
||||||
|
case -1: /* error */
|
||||||
|
return(FALSE);
|
||||||
|
case 0: /* child */
|
||||||
|
// Generic X windows terminal window
|
||||||
|
if (command != "")
|
||||||
|
execlp("xterm", "-e", (char *) (const char*) command, NULL);
|
||||||
|
else
|
||||||
|
execlp("xterm", NULL);
|
||||||
|
_exit(127);
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
#endif
|
||||||
|
// End VMS
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get free memory in bytes, or -1 if cannot determine amount (e.g. on UNIX)
|
// Get free memory in bytes, or -1 if cannot determine amount (e.g. on UNIX)
|
||||||
long wxGetFreeMemory()
|
long wxGetFreeMemory()
|
||||||
{
|
{
|
||||||
// TODO
|
return -1;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSleep(int nSecs)
|
void wxSleep(int nSecs)
|
||||||
{
|
{
|
||||||
// TODO
|
sleep(nSecs);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Consume all events until no more left
|
// Consume all events until no more left
|
||||||
void wxFlushEvents()
|
void wxFlushEvents()
|
||||||
{
|
{
|
||||||
|
Display *display = (Display*) wxGetDisplay();
|
||||||
|
|
||||||
|
XSync (display, FALSE);
|
||||||
|
XEvent event;
|
||||||
|
// XtAppPending returns availability of events AND timers/inputs, which
|
||||||
|
// are processed via callbacks, so XtAppNextEvent will not return if
|
||||||
|
// there are no events. So added '& XtIMXEvent' - Sergey.
|
||||||
|
while (XtAppPending ((XtAppContext) wxTheApp->GetAppContext()) & XtIMXEvent)
|
||||||
|
{
|
||||||
|
XFlush (XtDisplay ((Widget) wxTheApp->GetTopLevelWidget()));
|
||||||
|
// Jan Lessner: works better when events are non-X events
|
||||||
|
XtAppProcessEvent((XtAppContext) wxTheApp->GetAppContext(), XtIMXEvent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Output a debug message, in a system dependent fashion.
|
// Output a debug message, in a system dependent fashion.
|
||||||
void wxDebugMsg(const char *fmt ...)
|
void wxDebugMsg(const char *fmt ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
static char buffer[512];
|
char buffer[BUFSIZ];
|
||||||
|
|
||||||
if (!wxTheApp->GetWantDebugOutput())
|
if (!wxTheApp->GetWantDebugOutput())
|
||||||
return ;
|
return ;
|
||||||
|
|
||||||
va_start (ap, fmt);
|
va_start (ap, fmt);
|
||||||
|
|
||||||
// wvsprintf(buffer,fmt,ap) ;
|
vsprintf (buffer, fmt, ap);
|
||||||
// TODO: output buffer
|
cerr << buffer;
|
||||||
|
|
||||||
va_end (ap);
|
va_end (ap);
|
||||||
}
|
}
|
||||||
@@ -103,34 +200,121 @@ void wxDebugMsg(const char *fmt ...)
|
|||||||
// Non-fatal error: pop up message box and (possibly) continue
|
// Non-fatal error: pop up message box and (possibly) continue
|
||||||
void wxError(const wxString& msg, const wxString& title)
|
void wxError(const wxString& msg, const wxString& title)
|
||||||
{
|
{
|
||||||
// TODO
|
cerr << (const char*) title << ": " << (const char*) msg << "\n";
|
||||||
wxExit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fatal error: pop up message box and abort
|
// Fatal error: pop up message box and abort
|
||||||
void wxFatalError(const wxString& msg, const wxString& title)
|
void wxFatalError(const wxString& msg, const wxString& title)
|
||||||
{
|
{
|
||||||
// TODO
|
cerr << (const char*) title << ": " << (const char*) msg << "\n";
|
||||||
|
exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Emit a beeeeeep
|
// Emit a beeeeeep
|
||||||
void wxBell()
|
void wxBell()
|
||||||
{
|
{
|
||||||
// TODO
|
// Use current setting for the bell
|
||||||
|
XBell ((Display*) wxGetDisplay(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxGetOsVersion(int *majorVsn, int *minorVsn)
|
int wxGetOsVersion(int *majorVsn, int *minorVsn)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
return 0;
|
// This code is WRONG!! Does NOT return the
|
||||||
|
// Motif version of the libs but the X protocol
|
||||||
|
// version! @@@@@ Fix ME!!!!!!!!!
|
||||||
|
Display *display = XtDisplay ((Widget) wxTheApp->GetTopLevelWidget());
|
||||||
|
if (majorVsn)
|
||||||
|
*majorVsn = ProtocolVersion (display);
|
||||||
|
if (minorVsn)
|
||||||
|
*minorVsn = ProtocolRevision (display);
|
||||||
|
return wxMOTIF_X;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reading and writing resources (eg WIN.INI, .Xdefaults)
|
// Reading and writing resources (eg WIN.INI, .Xdefaults)
|
||||||
#if wxUSE_RESOURCES
|
#if wxUSE_RESOURCES
|
||||||
|
|
||||||
|
static char *GetResourcePath(char *buf, const char *name, bool create = FALSE)
|
||||||
|
{
|
||||||
|
if (create && wxFileExists (name) ) {
|
||||||
|
strcpy(buf, name);
|
||||||
|
return buf; // Exists so ...
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*name == '/')
|
||||||
|
strcpy(buf, name);
|
||||||
|
else {
|
||||||
|
// Put in standard place for resource files if not absolute
|
||||||
|
strcpy (buf, DEFAULT_XRESOURCE_DIR);
|
||||||
|
strcat (buf, "/");
|
||||||
|
strcat (buf, (const char*) wxFileNameFromPath (name));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (create) {
|
||||||
|
// Touch the file to create it
|
||||||
|
FILE *fd = fopen (buf, "w");
|
||||||
|
if (fd) fclose (fd);
|
||||||
|
}
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We have a cache for writing different resource files,
|
||||||
|
* which will only get flushed when we call wxFlushResources().
|
||||||
|
* Build up a list of resource databases waiting to be written.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
wxList wxResourceCache (wxKEY_STRING);
|
||||||
|
|
||||||
|
void
|
||||||
|
wxFlushResources (void)
|
||||||
|
{
|
||||||
|
char nameBuffer[512];
|
||||||
|
|
||||||
|
wxNode *node = wxResourceCache.First ();
|
||||||
|
while (node)
|
||||||
|
{
|
||||||
|
char *file = node->key.string;
|
||||||
|
// If file doesn't exist, create it first.
|
||||||
|
(void)GetResourcePath(nameBuffer, file, TRUE);
|
||||||
|
|
||||||
|
XrmDatabase database = (XrmDatabase) node->Data ();
|
||||||
|
XrmPutFileDatabase (database, nameBuffer);
|
||||||
|
XrmDestroyDatabase (database);
|
||||||
|
wxNode *next = node->Next ();
|
||||||
|
delete node;
|
||||||
|
node = next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static XrmDatabase wxResourceDatabase = 0;
|
||||||
|
|
||||||
|
void wxXMergeDatabases (wxApp * theApp, Display * display);
|
||||||
|
|
||||||
bool wxWriteResource(const wxString& section, const wxString& entry, const wxString& value, const wxString& file)
|
bool wxWriteResource(const wxString& section, const wxString& entry, const wxString& value, const wxString& file)
|
||||||
{
|
{
|
||||||
// TODO
|
char buffer[500];
|
||||||
return FALSE;
|
|
||||||
|
(void) GetIniFile (buffer, file);
|
||||||
|
|
||||||
|
XrmDatabase database;
|
||||||
|
wxNode *node = wxResourceCache.Find (buffer);
|
||||||
|
if (node)
|
||||||
|
database = (XrmDatabase) node->Data ();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
database = XrmGetFileDatabase (buffer);
|
||||||
|
wxResourceCache.Append (buffer, (wxObject *) database);
|
||||||
|
}
|
||||||
|
|
||||||
|
char resName[300];
|
||||||
|
strcpy (resName, (const char*) section);
|
||||||
|
strcat (resName, ".");
|
||||||
|
strcat (resName, (const char*) entry);
|
||||||
|
|
||||||
|
XrmPutStringResource (&database, resName, value);
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxWriteResource(const wxString& section, const wxString& entry, float value, const wxString& file)
|
bool wxWriteResource(const wxString& section, const wxString& entry, float value, const wxString& file)
|
||||||
@@ -156,7 +340,59 @@ bool wxWriteResource(const wxString& section, const wxString& entry, int value,
|
|||||||
|
|
||||||
bool wxGetResource(const wxString& section, const wxString& entry, char **value, const wxString& file)
|
bool wxGetResource(const wxString& section, const wxString& entry, char **value, const wxString& file)
|
||||||
{
|
{
|
||||||
// TODO
|
if (!wxResourceDatabase)
|
||||||
|
{
|
||||||
|
Display *display = (Display*) wxGetDisplay();
|
||||||
|
wxXMergeDatabases (wxTheApp, display);
|
||||||
|
}
|
||||||
|
|
||||||
|
XrmDatabase database;
|
||||||
|
|
||||||
|
if (file != "")
|
||||||
|
{
|
||||||
|
char buffer[500];
|
||||||
|
|
||||||
|
// Is this right? Trying to get it to look in the user's
|
||||||
|
// home directory instead of current directory -- JACS
|
||||||
|
(void) GetIniFile (buffer, file);
|
||||||
|
|
||||||
|
wxNode *node = wxResourceCache.Find (buffer);
|
||||||
|
if (node)
|
||||||
|
database = (XrmDatabase) node->Data ();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
database = XrmGetFileDatabase (buffer);
|
||||||
|
wxResourceCache.Append (buffer, (wxObject *) database);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
database = wxResourceDatabase;
|
||||||
|
|
||||||
|
XrmValue xvalue;
|
||||||
|
char *str_type[20];
|
||||||
|
char buf[150];
|
||||||
|
strcpy (buf, section);
|
||||||
|
strcat (buf, ".");
|
||||||
|
strcat (buf, entry);
|
||||||
|
|
||||||
|
Bool success = XrmGetResource (database, buf, "*", str_type,
|
||||||
|
&xvalue);
|
||||||
|
// Try different combinations of upper/lower case, just in case...
|
||||||
|
if (!success)
|
||||||
|
{
|
||||||
|
buf[0] = (isupper (buf[0]) ? tolower (buf[0]) : toupper (buf[0]));
|
||||||
|
success = XrmGetResource (database, buf, "*", str_type,
|
||||||
|
&xvalue);
|
||||||
|
}
|
||||||
|
if (success)
|
||||||
|
{
|
||||||
|
if (*value)
|
||||||
|
delete[] *value;
|
||||||
|
|
||||||
|
*value = new char[xvalue.size + 1];
|
||||||
|
strncpy (*value, xvalue.addr, (int) xvalue.size);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -192,27 +428,167 @@ bool wxGetResource(const wxString& section, const wxString& entry, int *value, c
|
|||||||
bool succ = wxGetResource(section, entry, (char **)&s, file);
|
bool succ = wxGetResource(section, entry, (char **)&s, file);
|
||||||
if (succ)
|
if (succ)
|
||||||
{
|
{
|
||||||
|
// Handle True, False here
|
||||||
|
// True, Yes, Enables, Set or Activated
|
||||||
|
if (*s == 'T' || *s == 'Y' || *s == 'E' || *s == 'S' || *s == 'A')
|
||||||
|
*value = TRUE;
|
||||||
|
// False, No, Disabled, Reset, Cleared, Deactivated
|
||||||
|
else if (*s == 'F' || *s == 'N' || *s == 'D' || *s == 'R' || *s == 'C')
|
||||||
|
*value = FALSE;
|
||||||
|
// Handle as Integer
|
||||||
|
else
|
||||||
*value = (int) strtol (s, NULL, 10);
|
*value = (int) strtol (s, NULL, 10);
|
||||||
delete[] s;
|
delete[] s;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
else return FALSE;
|
else
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxXMergeDatabases (wxApp * theApp, Display * display)
|
||||||
|
{
|
||||||
|
XrmDatabase homeDB, serverDB, applicationDB;
|
||||||
|
char filenamebuf[1024];
|
||||||
|
|
||||||
|
char *filename = &filenamebuf[0];
|
||||||
|
char *environment;
|
||||||
|
wxString classname = theApp->GetClassName();
|
||||||
|
char name[256];
|
||||||
|
(void) strcpy (name, "/usr/lib/X11/app-defaults/");
|
||||||
|
(void) strcat (name, (const char*) classname);
|
||||||
|
|
||||||
|
/* Get application defaults file, if any */
|
||||||
|
applicationDB = XrmGetFileDatabase (name);
|
||||||
|
(void) XrmMergeDatabases (applicationDB, &wxResourceDatabase);
|
||||||
|
|
||||||
|
/* Merge server defaults, created by xrdb, loaded as a property of the root
|
||||||
|
* window when the server initializes and loaded into the display
|
||||||
|
* structure on XOpenDisplay;
|
||||||
|
* if not defined, use .Xdefaults
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (XResourceManagerString (display) != NULL)
|
||||||
|
{
|
||||||
|
serverDB = XrmGetStringDatabase (XResourceManagerString (display));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
(void) GetIniFile (filename, NULL);
|
||||||
|
serverDB = XrmGetFileDatabase (filename);
|
||||||
|
}
|
||||||
|
XrmMergeDatabases (serverDB, &wxResourceDatabase);
|
||||||
|
|
||||||
|
/* Open XENVIRONMENT file, or if not defined, the .Xdefaults,
|
||||||
|
* and merge into existing database
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ((environment = getenv ("XENVIRONMENT")) == NULL)
|
||||||
|
{
|
||||||
|
size_t len;
|
||||||
|
environment = GetIniFile (filename, NULL);
|
||||||
|
len = strlen (environment);
|
||||||
|
#if defined(SVR4) && !defined(__hpux)
|
||||||
|
(void) sysinfo (SI_HOSTNAME, environment + len, 1024 - len);
|
||||||
|
#else
|
||||||
|
(void) gethostname (environment + len, 1024 - len);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
homeDB = XrmGetFileDatabase (environment);
|
||||||
|
XrmMergeDatabases (homeDB, &wxResourceDatabase);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Not yet used but may be useful.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
wxSetDefaultResources (const Widget w, const char **resourceSpec, const char *name)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
Display *dpy = XtDisplay (w); // Retrieve the display pointer
|
||||||
|
|
||||||
|
XrmDatabase rdb = NULL; // A resource data base
|
||||||
|
|
||||||
|
// Create an empty resource database
|
||||||
|
rdb = XrmGetStringDatabase ("");
|
||||||
|
|
||||||
|
// Add the Component resources, prepending the name of the component
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
while (resourceSpec[i] != NULL)
|
||||||
|
{
|
||||||
|
char buf[1000];
|
||||||
|
|
||||||
|
sprintf (buf, "*%s%s", name, resourceSpec[i++]);
|
||||||
|
XrmPutLineResource (&rdb, buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Merge them into the Xt database, with lowest precendence
|
||||||
|
|
||||||
|
if (rdb)
|
||||||
|
{
|
||||||
|
#if (XlibSpecificationRelease>=5)
|
||||||
|
XrmDatabase db = XtDatabase (dpy);
|
||||||
|
XrmCombineDatabase (rdb, &db, FALSE);
|
||||||
|
#else
|
||||||
|
XrmMergeDatabases (dpy->db, &rdb);
|
||||||
|
dpy->db = rdb;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
// 0
|
||||||
|
|
||||||
#endif // wxUSE_RESOURCES
|
#endif // wxUSE_RESOURCES
|
||||||
|
|
||||||
static int wxBusyCursorCount = 0;
|
static int wxBusyCursorCount = 0;
|
||||||
|
|
||||||
|
// Helper function
|
||||||
|
static void
|
||||||
|
wxXSetBusyCursor (wxWindow * win, wxCursor * cursor)
|
||||||
|
{
|
||||||
|
Display *display = (Display*) win->GetXDisplay();
|
||||||
|
|
||||||
|
Window xwin = (Window) win->GetXWindow();
|
||||||
|
XSetWindowAttributes attrs;
|
||||||
|
|
||||||
|
if (cursor)
|
||||||
|
{
|
||||||
|
attrs.cursor = (Cursor) cursor->GetXCursor(display);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Restore old cursor
|
||||||
|
if (win->GetCursor()->Ok())
|
||||||
|
attrs.cursor = (Cursor) win->GetCursor()->GetXCursor(display);
|
||||||
|
else
|
||||||
|
attrs.cursor = None;
|
||||||
|
}
|
||||||
|
if (xwin)
|
||||||
|
XChangeWindowAttributes (display, xwin, CWCursor, &attrs);
|
||||||
|
|
||||||
|
XFlush (display);
|
||||||
|
|
||||||
|
for(wxNode *node = win->GetChildren()->First (); node; node = node->Next())
|
||||||
|
{
|
||||||
|
wxWindow *child = (wxWindow *) node->Data ();
|
||||||
|
wxXSetBusyCursor (child, cursor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Set the cursor to the busy cursor for all windows
|
// Set the cursor to the busy cursor for all windows
|
||||||
void wxBeginBusyCursor(wxCursor *cursor)
|
void wxBeginBusyCursor(wxCursor *cursor)
|
||||||
{
|
{
|
||||||
wxBusyCursorCount++;
|
wxBusyCursorCount++;
|
||||||
if (wxBusyCursorCount == 1)
|
if (wxBusyCursorCount == 1)
|
||||||
{
|
{
|
||||||
// TODO
|
for(wxNode *node = wxTopLevelWindows.First (); node; node = node->Next())
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
// TODO
|
wxWindow *win = (wxWindow *) node->Data ();
|
||||||
|
wxXSetBusyCursor (win, cursor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,7 +601,11 @@ void wxEndBusyCursor()
|
|||||||
wxBusyCursorCount--;
|
wxBusyCursorCount--;
|
||||||
if (wxBusyCursorCount == 0)
|
if (wxBusyCursorCount == 0)
|
||||||
{
|
{
|
||||||
// TODO
|
for(wxNode *node = wxTopLevelWindows.First (); node; node = node->Next())
|
||||||
|
{
|
||||||
|
wxWindow *win = (wxWindow *) node->Data ();
|
||||||
|
wxXSetBusyCursor (win, NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,21 +617,72 @@ bool wxIsBusy()
|
|||||||
|
|
||||||
char *wxGetUserHome (const wxString& user)
|
char *wxGetUserHome (const wxString& user)
|
||||||
{
|
{
|
||||||
// TODO
|
#ifdef VMS
|
||||||
return NULL;
|
return(NULL);
|
||||||
|
#else
|
||||||
|
struct passwd *who = NULL;
|
||||||
|
|
||||||
|
if (user == "") {
|
||||||
|
register char *ptr;
|
||||||
|
|
||||||
|
if ((ptr = getenv("HOME")) != NULL)
|
||||||
|
return ptr;
|
||||||
|
if ((ptr = getenv("USER")) != NULL ||
|
||||||
|
(ptr = getenv("LOGNAME")) != NULL)
|
||||||
|
{
|
||||||
|
who = getpwnam( ptr );
|
||||||
|
}
|
||||||
|
// We now make sure the the user exists!
|
||||||
|
if (who == NULL)
|
||||||
|
who = getpwuid( getuid() );
|
||||||
|
} else
|
||||||
|
who = getpwnam ((const char*) user);
|
||||||
|
|
||||||
|
return who ? who->pw_dir : (char*) NULL;
|
||||||
|
#endif
|
||||||
|
// ifdef VMS
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check whether this window wants to process messages, e.g. Stop button
|
// Check whether this window wants to process messages, e.g. Stop button
|
||||||
// in long calculations.
|
// in long calculations.
|
||||||
bool wxCheckForInterrupt(wxWindow *wnd)
|
bool wxCheckForInterrupt(wxWindow *wnd)
|
||||||
{
|
{
|
||||||
// TODO
|
if(wnd){
|
||||||
return FALSE;
|
Display *dpy=(Display*) wnd->GetXDisplay();
|
||||||
|
Window win=(Window) wnd->GetXWindow();
|
||||||
|
XEvent event;
|
||||||
|
XFlush(dpy);
|
||||||
|
if(wnd->GetMainWidget()){
|
||||||
|
XmUpdateDisplay((Widget)(wnd->GetMainWidget()));
|
||||||
|
}
|
||||||
|
while(XCheckMaskEvent(dpy,
|
||||||
|
ButtonPressMask|ButtonReleaseMask|ButtonMotionMask|
|
||||||
|
PointerMotionMask|KeyPressMask|KeyReleaseMask,
|
||||||
|
&event)){
|
||||||
|
if(event.xany.window==win)
|
||||||
|
XtDispatchEvent(&event);
|
||||||
|
// else
|
||||||
|
// XBell(dpy,50);
|
||||||
|
}
|
||||||
|
return TRUE;//*** temporary?
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
wxMessageBox("wnd==NULL !!!");
|
||||||
|
return FALSE;//*** temporary?
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGetMousePosition( int* x, int* y )
|
void wxGetMousePosition( int* x, int* y )
|
||||||
{
|
{
|
||||||
// TODO
|
XMotionEvent xev;
|
||||||
|
Window root, child;
|
||||||
|
XQueryPointer((Display*) wxGetDisplay(),
|
||||||
|
DefaultRootWindow((Display*) wxGetDisplay()), &root, &child,
|
||||||
|
&(xev.x_root), &(xev.y_root),
|
||||||
|
&(xev.x), &(xev.y),
|
||||||
|
&(xev.state));
|
||||||
|
*x = xev.x_root;
|
||||||
|
*y = xev.y_root;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Return TRUE if we have a colour display
|
// Return TRUE if we have a colour display
|
||||||
@@ -656,3 +1087,145 @@ KeySym wxCharCodeWXToX(int id)
|
|||||||
} // switch
|
} // switch
|
||||||
return keySym;
|
return keySym;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Read $HOME for what it says is home, if not
|
||||||
|
// read $USER or $LOGNAME for user name else determine
|
||||||
|
// the Real User, then determine the Real home dir.
|
||||||
|
static char * GetIniFile (char *dest, const char *filename)
|
||||||
|
{
|
||||||
|
char *home = NULL;
|
||||||
|
if (filename && wxIsAbsolutePath(filename))
|
||||||
|
{
|
||||||
|
strcpy(dest, filename);
|
||||||
|
}
|
||||||
|
else if ((home = wxGetUserHome("")) != NULL)
|
||||||
|
{
|
||||||
|
strcpy(dest, home);
|
||||||
|
if (dest[strlen(dest) - 1] != '/')
|
||||||
|
strcat (dest, "/");
|
||||||
|
if (filename == NULL)
|
||||||
|
{
|
||||||
|
if ((filename = getenv ("XENVIRONMENT")) == NULL)
|
||||||
|
filename = ".Xdefaults";
|
||||||
|
}
|
||||||
|
else if (*filename != '.')
|
||||||
|
strcat (dest, ".");
|
||||||
|
strcat (dest, filename);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
dest[0] = '\0';
|
||||||
|
}
|
||||||
|
return dest;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Some colour manipulation routines
|
||||||
|
*/
|
||||||
|
|
||||||
|
void wxHSVToXColor(wxHSV *hsv,XColor *rgb)
|
||||||
|
{
|
||||||
|
int h = hsv->h;
|
||||||
|
int s = hsv->s;
|
||||||
|
int v = hsv->v;
|
||||||
|
int r, g, b;
|
||||||
|
int i, f;
|
||||||
|
int p, q, t;
|
||||||
|
s = (s * wxMAX_RGB) / wxMAX_SV;
|
||||||
|
v = (v * wxMAX_RGB) / wxMAX_SV;
|
||||||
|
if (h == 360) h = 0;
|
||||||
|
if (s == 0) { h = 0; r = g = b = v; }
|
||||||
|
i = h / 60;
|
||||||
|
f = h % 60;
|
||||||
|
p = v * (wxMAX_RGB - s) / wxMAX_RGB;
|
||||||
|
q = v * (wxMAX_RGB - s * f / 60) / wxMAX_RGB;
|
||||||
|
t = v * (wxMAX_RGB - s * (60 - f) / 60) / wxMAX_RGB;
|
||||||
|
switch (i)
|
||||||
|
{
|
||||||
|
case 0: r = v, g = t, b = p; break;
|
||||||
|
case 1: r = q, g = v, b = p; break;
|
||||||
|
case 2: r = p, g = v, b = t; break;
|
||||||
|
case 3: r = p, g = q, b = v; break;
|
||||||
|
case 4: r = t, g = p, b = v; break;
|
||||||
|
case 5: r = v, g = p, b = q; break;
|
||||||
|
}
|
||||||
|
rgb->red = r << 8;
|
||||||
|
rgb->green = g << 8;
|
||||||
|
rgb->blue = b << 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxXColorToHSV(wxHSV *hsv,XColor *rgb)
|
||||||
|
{
|
||||||
|
int r = rgb->red >> 8;
|
||||||
|
int g = rgb->green >> 8;
|
||||||
|
int b = rgb->blue >> 8;
|
||||||
|
int maxv = wxMax3(r, g, b);
|
||||||
|
int minv = wxMin3(r, g, b);
|
||||||
|
int h, s, v;
|
||||||
|
v = maxv;
|
||||||
|
if (maxv) s = (maxv - minv) * wxMAX_RGB / maxv;
|
||||||
|
else s = 0;
|
||||||
|
if (s == 0) h = 0;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int rc, gc, bc, hex;
|
||||||
|
rc = (maxv - r) * wxMAX_RGB / (maxv - minv);
|
||||||
|
gc = (maxv - g) * wxMAX_RGB / (maxv - minv);
|
||||||
|
bc = (maxv - b) * wxMAX_RGB / (maxv - minv);
|
||||||
|
if (r == maxv) { h = bc - gc, hex = 0; }
|
||||||
|
else if (g == maxv) { h = rc - bc, hex = 2; }
|
||||||
|
else if (b == maxv) { h = gc - rc, hex = 4; }
|
||||||
|
h = hex * 60 + (h * 60 / wxMAX_RGB);
|
||||||
|
if (h < 0) h += 360;
|
||||||
|
}
|
||||||
|
hsv->h = h;
|
||||||
|
hsv->s = (s * wxMAX_SV) / wxMAX_RGB;
|
||||||
|
hsv->v = (v * wxMAX_SV) / wxMAX_RGB;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxAllocNearestColor(Display *d,Colormap cmp,XColor *xc)
|
||||||
|
{
|
||||||
|
int llp;
|
||||||
|
|
||||||
|
int screen = DefaultScreen(d);
|
||||||
|
int num_colors = DisplayCells(d,screen);
|
||||||
|
|
||||||
|
XColor *color_defs = new XColor[num_colors];
|
||||||
|
for(llp = 0;llp < num_colors;llp++) color_defs[llp].pixel = llp;
|
||||||
|
XQueryColors(d,cmp,color_defs,num_colors);
|
||||||
|
|
||||||
|
wxHSV hsv_defs, hsv;
|
||||||
|
wxXColorToHSV(&hsv,xc);
|
||||||
|
|
||||||
|
int diff, min_diff, pixel = 0;
|
||||||
|
|
||||||
|
for(llp = 0;llp < num_colors;llp++)
|
||||||
|
{
|
||||||
|
wxXColorToHSV(&hsv_defs,&color_defs[llp]);
|
||||||
|
diff = wxSIGN(wxH_WEIGHT * (hsv.h - hsv_defs.h)) +
|
||||||
|
wxSIGN(wxS_WEIGHT * (hsv.s - hsv_defs.s)) +
|
||||||
|
wxSIGN(wxV_WEIGHT * (hsv.v - hsv_defs.v));
|
||||||
|
if (llp == 0) min_diff = diff;
|
||||||
|
if (min_diff > diff) { min_diff = diff; pixel = llp; }
|
||||||
|
if (min_diff == 0) break;
|
||||||
|
}
|
||||||
|
|
||||||
|
xc -> red = color_defs[pixel].red;
|
||||||
|
xc -> green = color_defs[pixel].green;
|
||||||
|
xc -> blue = color_defs[pixel].blue;
|
||||||
|
xc -> flags = DoRed | DoGreen | DoBlue;
|
||||||
|
if (!XAllocColor(d,cmp,xc))
|
||||||
|
cout << "wxAllocNearestColor : Warning : Cannot find nearest color !\n";
|
||||||
|
|
||||||
|
delete[] color_defs;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxAllocColor(Display *d,Colormap cmp,XColor *xc)
|
||||||
|
{
|
||||||
|
if (!XAllocColor(d,cmp,xc))
|
||||||
|
{
|
||||||
|
// cout << "wxAllocColor : Warning : Can not allocate color, attempt find nearest !\n";
|
||||||
|
wxAllocNearestColor(d,cmp,xc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -475,6 +475,9 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id,
|
|||||||
if (m_vScrollBar)
|
if (m_vScrollBar)
|
||||||
XtRealizeWidget ((Widget) m_vScrollBar);
|
XtRealizeWidget ((Widget) m_vScrollBar);
|
||||||
|
|
||||||
|
// Without this, the cursor may not be restored properly
|
||||||
|
// (e.g. in splitter sample).
|
||||||
|
SetCursor(*wxSTANDARD_CURSOR);
|
||||||
SetSize(pos.x, pos.y, size.x, size.y);
|
SetSize(pos.x, pos.y, size.x, size.y);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -592,6 +595,17 @@ void wxWindow::GetPosition(int *x, int *y) const
|
|||||||
Widget widget = (Widget) GetTopWidget();
|
Widget widget = (Widget) GetTopWidget();
|
||||||
Position xx, yy;
|
Position xx, yy;
|
||||||
XtVaGetValues(widget, XmNx, &xx, XmNy, &yy, NULL);
|
XtVaGetValues(widget, XmNx, &xx, XmNy, &yy, NULL);
|
||||||
|
|
||||||
|
// We may be faking the client origin.
|
||||||
|
// So a window that's really at (0, 30) may appear
|
||||||
|
// (to wxWin apps) to be at (0, 0).
|
||||||
|
if (GetParent())
|
||||||
|
{
|
||||||
|
wxPoint pt(GetParent()->GetClientAreaOrigin());
|
||||||
|
xx -= pt.x;
|
||||||
|
yy -= pt.y;
|
||||||
|
}
|
||||||
|
|
||||||
*x = xx; *y = yy;
|
*x = xx; *y = yy;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -660,10 +674,13 @@ void wxWindow::SetSize(int x, int y, int width, int height, int sizeFlags)
|
|||||||
if (managed)
|
if (managed)
|
||||||
XtUnmanageChild(widget);
|
XtUnmanageChild(widget);
|
||||||
|
|
||||||
|
int xx = x; int yy = y;
|
||||||
|
AdjustForParentClientOrigin(xx, yy, sizeFlags);
|
||||||
|
|
||||||
if (x > -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
if (x > -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
||||||
XtVaSetValues(widget, XmNx, x, NULL);
|
XtVaSetValues(widget, XmNx, xx, NULL);
|
||||||
if (y > -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
if (y > -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
||||||
XtVaSetValues(widget, XmNy, y, NULL);
|
XtVaSetValues(widget, XmNy, yy, NULL);
|
||||||
if (width > -1)
|
if (width > -1)
|
||||||
XtVaSetValues(widget, XmNwidth, width, NULL);
|
XtVaSetValues(widget, XmNwidth, width, NULL);
|
||||||
if (height > -1)
|
if (height > -1)
|
||||||
@@ -1268,14 +1285,24 @@ void wxWindow::SetFont(const wxFont& font)
|
|||||||
m_windowFont = font;
|
m_windowFont = font;
|
||||||
|
|
||||||
// Note that this causes the widget to be resized back
|
// Note that this causes the widget to be resized back
|
||||||
// to its original size! How can we stop that?
|
// to its original size! We therefore have to set the size
|
||||||
|
// back again. TODO: a better way in Motif?
|
||||||
/*
|
/*
|
||||||
Widget w = (Widget) GetLabelWidget(); // Usually the main widget
|
Widget w = (Widget) GetLabelWidget(); // Usually the main widget
|
||||||
if (w && m_windowFont.Ok())
|
if (w && m_windowFont.Ok())
|
||||||
{
|
{
|
||||||
|
int width, height, width1, height1;
|
||||||
|
GetSize(& width, & height);
|
||||||
|
|
||||||
XtVaSetValues (w,
|
XtVaSetValues (w,
|
||||||
XmNfontList, (XmFontList) m_windowFont.GetFontList(1.0, XtDisplay(w)),
|
XmNfontList, (XmFontList) m_windowFont.GetFontList(1.0, XtDisplay(w)),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
GetSize(& width1, & height1);
|
||||||
|
if (width != width1 || height != height1)
|
||||||
|
{
|
||||||
|
SetSize(-1, -1, width, height);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
@@ -2380,6 +2407,8 @@ void wxCanvasInputEvent (Widget drawingArea, XtPointer data, XmDrawingAreaCallba
|
|||||||
|
|
||||||
wxevent.SetId(canvas->GetId());
|
wxevent.SetId(canvas->GetId());
|
||||||
wxevent.SetEventObject(canvas);
|
wxevent.SetEventObject(canvas);
|
||||||
|
wxevent.m_x = local_event.xbutton.x;
|
||||||
|
wxevent.m_y = local_event.xbutton.y;
|
||||||
canvas->GetEventHandler()->ProcessEvent (wxevent);
|
canvas->GetEventHandler()->ProcessEvent (wxevent);
|
||||||
/*
|
/*
|
||||||
if (eventType == wxEVT_ENTER_WINDOW ||
|
if (eventType == wxEVT_ENTER_WINDOW ||
|
||||||
@@ -2494,16 +2523,19 @@ void wxWindow::CanvasSetSize (int x, int y, int w, int h, int sizeFlags)
|
|||||||
XtUnmanageChild (m_borderWidget ? (Widget) m_borderWidget : (Widget) m_scrolledWindow);
|
XtUnmanageChild (m_borderWidget ? (Widget) m_borderWidget : (Widget) m_scrolledWindow);
|
||||||
XtVaSetValues((Widget) m_drawingArea, XmNresizePolicy, XmRESIZE_ANY, NULL);
|
XtVaSetValues((Widget) m_drawingArea, XmNresizePolicy, XmRESIZE_ANY, NULL);
|
||||||
|
|
||||||
|
int xx = x; int yy = y;
|
||||||
|
AdjustForParentClientOrigin(xx, yy, sizeFlags);
|
||||||
|
|
||||||
if (x > -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
if (x > -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
||||||
{
|
{
|
||||||
XtVaSetValues (m_borderWidget ? (Widget) m_borderWidget : (Widget) m_scrolledWindow,
|
XtVaSetValues (m_borderWidget ? (Widget) m_borderWidget : (Widget) m_scrolledWindow,
|
||||||
XmNx, x, NULL);
|
XmNx, xx, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (y > -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
if (y > -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
||||||
{
|
{
|
||||||
XtVaSetValues (m_borderWidget ? (Widget) m_borderWidget : (Widget) m_scrolledWindow,
|
XtVaSetValues (m_borderWidget ? (Widget) m_borderWidget : (Widget) m_scrolledWindow,
|
||||||
XmNy, y, NULL);
|
XmNy, yy, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (w > -1)
|
if (w > -1)
|
||||||
@@ -2643,6 +2675,17 @@ void wxWindow::CanvasGetPosition (int *x, int *y) const
|
|||||||
{
|
{
|
||||||
Position xx, yy;
|
Position xx, yy;
|
||||||
XtVaGetValues (m_borderWidget ? (Widget) m_borderWidget : (Widget) m_scrolledWindow, XmNx, &xx, XmNy, &yy, NULL);
|
XtVaGetValues (m_borderWidget ? (Widget) m_borderWidget : (Widget) m_scrolledWindow, XmNx, &xx, XmNy, &yy, NULL);
|
||||||
|
|
||||||
|
// We may be faking the client origin.
|
||||||
|
// So a window that's really at (0, 30) may appear
|
||||||
|
// (to wxWin apps) to be at (0, 0).
|
||||||
|
if (GetParent())
|
||||||
|
{
|
||||||
|
wxPoint pt(GetParent()->GetClientAreaOrigin());
|
||||||
|
xx -= pt.x;
|
||||||
|
yy -= pt.y;
|
||||||
|
}
|
||||||
|
|
||||||
*x = xx;
|
*x = xx;
|
||||||
*y = yy;
|
*y = yy;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user