More Motif stuff incl. beginnings of wxToolBar

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@895 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart 1998-10-21 21:43:20 +00:00
parent b0f1bdde5a
commit 0d57be4594
77 changed files with 982 additions and 234 deletions

View File

@ -38,7 +38,7 @@ or a frame becomes inactivate resulting in all application frames being inactive
\membersection{wxActivateEvent::wxActivateEvent}
\func{}{wxActivateEvent}{\param{WXTYPE }{eventType = 0}, \param{int }{id = 0}}
\func{}{wxActivateEvent}{\param{WXTYPE }{eventType = 0}, \param{bool}{ active = TRUE}, \param{int }{id = 0}}
Constructor.

View File

@ -545,7 +545,7 @@ Reads a double value, returning TRUE if the value was found. If the value was
not found, {\it d} is not changed.
\constfunc{bool}{Read}{\param{const wxString\& }{ key}, \param{double*}{ d},
\param{double}{ defaultVal}}
\param{double}{ defaultVal}}
Reads a double value, returning TRUE if the value was found. If the value was
not found, {\it defaultVal} is used instead.

View File

@ -24,7 +24,14 @@ High Priority
- Colour setting in widgets.
- Implementation of OnEraseBackground.
- Implementation of OnEraseBackground. How? Call OnEraseBackground
just before OnPaint? Will duplicate Xlib's own erase of the background.
However, this is usually OK, because the default wxWindow::OnEraseBackground
can do nothing (SetBackgroundColour will make the background look OK).
And if a custom OnEraseBackground uses the same colour as the window
background, no flicker will be seen. If it does something else, such as
painting a tiled bitmap, then a slight flicker might be seen unless
X can be persuaded not to repaint the window background by default.
- wxBitmapCheckBox, wxBitmapRadioButton
@ -48,9 +55,11 @@ High Priority
http://www.motifzone.com/tmd/articles/Kurt_Huhner/jun96.html.
This article also explains how to implement tooltips.
- wxSystemSettings
- Find out why modal dialogs give a grab warning.
- wxTimer
- Find out why UI updates aren't working (probably an OnIdle failure).
- wxSystemSettings
- wxThread (hopefully, similar to wxGTK)

View File

@ -198,7 +198,7 @@ public:
inline WXDisplay* GetPixmap() const { return M_BITMAPDATA->m_pixmap; }
virtual WXPixmap GetLabelPixmap(WXWidget w) ;
virtual WXPixmap GetArmPixmap(WXWidget w) ;
virtual WXPixmap GetInsensPixmap(WXWidget w) ;
virtual WXPixmap GetInsensPixmap(WXWidget w = (WXWidget) 0) ;
protected:
static wxList sm_handlers;

View File

@ -44,6 +44,11 @@ class WXDLLEXPORT wxButton: public wxControl
virtual void SetDefault();
virtual void Command(wxCommandEvent& event);
// Implementation
virtual void ChangeFont();
virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour();
};
#endif

View File

@ -45,6 +45,11 @@ class WXDLLEXPORT wxCheckBox: public wxControl
virtual void SetValue(bool);
virtual bool GetValue() const ;
virtual void Command(wxCommandEvent& event);
// Implementation
virtual void ChangeFont();
virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour();
};
class WXDLLEXPORT wxBitmapCheckBox: public wxCheckBox

View File

@ -67,6 +67,10 @@ class WXDLLEXPORT wxChoice: public wxControl
void SetFocus();
// Implementation
virtual void ChangeFont();
virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour();
WXWidget GetTopWidget() const { return m_formWidget; }
WXWidget GetMainWidget() const { return m_buttonWidget; }

View File

@ -22,6 +22,7 @@
// Colour
class WXDLLEXPORT wxColour : public wxObject
{
DECLARE_DYNAMIC_CLASS(wxColour)
public:
// ctors
// default
@ -53,10 +54,17 @@ public:
// accessors
bool Ok() const {return m_isInit; }
unsigned char Red() const { return m_red; }
unsigned char Green() const { return m_green; }
unsigned char Blue() const { return m_blue; }
int GetPixel() const { return m_pixel; };
void SetPixel(int pixel) { m_pixel = pixel; m_isInit = TRUE; };
inline bool operator == (const wxColour& colour) { return (m_red == colour.m_red && m_green == colour.m_green && m_blue == colour.m_blue); }
inline bool operator != (const wxColour& colour) { return (!(m_red == colour.m_red && m_green == colour.m_green && m_blue == colour.m_blue)); }
// Allocate a colour, or nearest colour, using the given display.
// If realloc is TRUE, ignore the existing pixel, otherwise just return
// the existing one.
@ -67,6 +75,8 @@ public:
int AllocColour(WXDisplay* display, bool realloc = FALSE);
void InitFromName(const wxString& col);
private:
bool m_isInit;
unsigned char m_red;

View File

@ -72,6 +72,11 @@ class WXDLLEXPORT wxComboBox: public wxChoice
}
virtual void SetSelection(long from, long to);
virtual void SetEditable(bool editable);
// Implementation
virtual void ChangeFont();
virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour();
};
#endif

View File

@ -93,7 +93,10 @@ public:
// Responds to colour changes
void OnSysColourChanged(wxSysColourChangedEvent& event);
//// Motif-specific
// Implementation
virtual void ChangeFont();
virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour();
inline WXWidget GetTopWidget() const { return m_mainWidget; }
inline WXWidget GetClientWidget() const { return m_mainWidget; }

View File

@ -144,8 +144,10 @@ public:
virtual void CaptureMouse();
virtual void ReleaseMouse();
//// Motif-specific
// Implementation
virtual void ChangeFont();
virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour();
WXWidget GetMenuBarWidget() const ;
inline WXWidget GetShellWidget() const { return m_frameShell; }
inline WXWidget GetWorkAreaWidget() const { return m_workArea; }

View File

@ -60,6 +60,11 @@ class WXDLLEXPORT wxGauge: public wxControl
virtual void Command(wxCommandEvent& WXUNUSED(event)) {} ;
// Implementation
virtual void ChangeFont();
virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour();
protected:
int m_rangeMax;
int m_gaugePos;

View File

@ -89,6 +89,10 @@ class WXDLLEXPORT wxListBox: public wxControl
void Command(wxCommandEvent& event);
// Implementation
virtual void ChangeFont();
virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour();
WXWidget GetTopWidget() const;
protected:

View File

@ -69,7 +69,7 @@ public:
// toolbar(s), don't call SetToolBar.
void GetClientSize(int *width, int *height) const;
// Get the active MDI child window (Windows only)
// Get the active MDI child window
wxMDIChildFrame *GetActiveChild() const ;
// Get the client window
@ -86,9 +86,13 @@ public:
virtual void ActivateNext();
virtual void ActivatePrevious();
// Implementation
inline void SetActiveChild(wxMDIChildFrame* child) { m_activeChild = child; }
protected:
wxMDIClientWindow *m_clientWindow;
wxMDIClientWindow* m_clientWindow;
wxMDIChildFrame* m_activeChild;
DECLARE_EVENT_TABLE()
};
@ -144,6 +148,8 @@ public:
void BuildClientArea(WXWidget parent);
inline WXWidget GetTopWidget() const { return m_mainWidget; };
inline wxXsMDIWindow *GetMDIWindow() const { return m_mdiWindow; };
virtual void OnRaise();
virtual void OnLower();
protected:
wxXsMDIWindow* m_mdiWindow ;

View File

@ -162,6 +162,11 @@ public:
virtual void SetConstraintSizes(bool recurse = TRUE);
virtual bool DoPhase(int nPhase);
// Implementation
virtual void ChangeFont();
virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour();
protected:
// common part of all ctors
void Init();

View File

@ -35,6 +35,8 @@ bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win, Widget widget,
bool wxTranslateKeyEvent(wxKeyEvent& wxevent, wxWindow *win, Widget widget, XEvent *xevent);
int wxGetBestMatchingPixel(Display *display, XColor *desiredColor, Colormap cmap);
Pixmap XCreateInsensitivePixmap( Display *display, Pixmap pixmap );
extern XColor g_itemColors[];
extern int wxComputeColours (Display *display, wxColour * back, wxColour * fore);
#define wxNO_COLORS 0x00
#define wxBACK_COLORS 0x01

View File

@ -68,6 +68,10 @@ public:
inline int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; }
inline void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; }
// Implementation
virtual void ChangeFont();
virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour();
WXWidget GetTopWidget() const { return m_formWidget; }
WXWidget GetLabelWidget() const { return m_labelWidget; }
inline WXWidget* GetRadioButtons() const { return m_radioButtons; }

View File

@ -48,6 +48,10 @@ public:
void Command(wxCommandEvent& event);
// Implementation
virtual void ChangeFont();
virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour();
WXWidget GetTopWidget() const { return m_formWidget; }
WXWidget GetLabelWidget() const { return m_labelWidget; }

View File

@ -56,6 +56,11 @@ public:
void Command(wxCommandEvent& event);
// Implementation
virtual void ChangeFont();
virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour();
protected:
int m_pageSize;
int m_viewSize;

View File

@ -76,6 +76,12 @@ public:
void SetTick(int tickPos) ;
void Command(wxCommandEvent& event);
// Implementation
virtual void ChangeFont();
virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour();
protected:
int m_rangeMin;
int m_rangeMax;

View File

@ -64,6 +64,11 @@ class WXDLLEXPORT wxSpinButton: public wxControl
void Command(wxCommandEvent& event) { ProcessCommand(event); };
// Implementation
virtual void ChangeFont();
virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour();
protected:
int m_min;
int m_max;

View File

@ -56,6 +56,11 @@ class WXDLLEXPORT wxStaticBitmap: public wxControl
// overriden base class virtuals
virtual bool AcceptsFocus() const { return FALSE; }
// Implementation
virtual void ChangeFont();
virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour();
protected:
wxBitmap m_messageBitmap;

View File

@ -51,7 +51,10 @@ class WXDLLEXPORT wxStaticBox: public wxControl
void SetLabel(const wxString& label);
wxString GetLabel() const;
// Motif-specific
// Implementation
virtual void ChangeFont();
virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour();
WXWidget GetTopWidget() const { return m_formWidget; }
WXWidget GetLabelWidget() const { return m_labelWidget; }

View File

@ -46,6 +46,11 @@ class WXDLLEXPORT wxStaticText: public wxControl
// operations
virtual void Command(wxCommandEvent& WXUNUSED(event)) {};
virtual void ProcessCommand(wxCommandEvent& WXUNUSED(event)) {};
// Implementation
virtual void ChangeFont();
virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour();
};
#endif

View File

@ -124,11 +124,12 @@ public:
void OnChar(wxKeyEvent& event);
// void OnEraseBackground(wxEraseEvent& event);
// Implementation
// --------------
virtual void Command(wxCommandEvent& event);
//// Motif-specific
// Implementation
virtual void ChangeFont();
virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour();
inline void SetModified(bool mod) { m_modified = mod; }
virtual WXWidget GetTopWidget() const;

View File

@ -22,6 +22,8 @@ class WXDLLEXPORT wxTimer: public wxObject
{
DECLARE_DYNAMIC_CLASS(wxTimer)
friend void wxTimerCallback (wxTimer * timer);
public:
wxTimer();
~wxTimer();

View File

@ -32,7 +32,9 @@ class WXDLLEXPORT wxToolBar: public wxToolBarBase
inline wxToolBar(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = wxNO_BORDER|wxTB_HORIZONTAL,
const wxString& name = wxToolBarNameStr)
const wxString& name = wxToolBarNameStr):
m_widgets(wxKEY_INTEGER)
{
Create(parent, id, pos, size, style, name);
}
@ -69,6 +71,8 @@ class WXDLLEXPORT wxToolBar: public wxToolBarBase
bool Realize() { return CreateTools(); };
protected:
// List of widgets in the toolbar, indexed by tool index
wxList m_widgets;
DECLARE_EVENT_TABLE()
};

View File

@ -311,11 +311,11 @@ public:
void SetConstraints(wxLayoutConstraints *c);
// Set/get window background colour
inline virtual void SetBackgroundColour(const wxColour& col);
virtual void SetBackgroundColour(const wxColour& col);
inline virtual wxColour GetBackgroundColour() const;
// Set/get window foreground colour
inline virtual void SetForegroundColour(const wxColour& col);
virtual void SetForegroundColour(const wxColour& col);
inline virtual wxColour GetForegroundColour() const;
// Get the default button, if there is one
@ -488,8 +488,15 @@ public:
virtual WXRegion GetPaintRegion() const { return m_paintRegion; }
// Change properties
virtual void ChangeColour(WXWidget widget);
virtual void ChangeFont(WXWidget widget);
virtual void ChangeFont(); // Change to the current font (often overridden)
virtual void DoChangeForegroundColour(WXWidget widget, wxColour& foregroundColour);
virtual void DoChangeBackgroundColour(WXWidget widget, wxColour& backgroundColour, bool changeArmColour = FALSE);
// These to be overridden as needed (may change several widgets)
virtual void ChangeBackgroundColour(); // Change background and foreground colour using current
// background colour setting (Motif generates
// foreground based on background)
virtual void ChangeForegroundColour(); // Change foreground colour using current
// foreground colour setting
// Adds the widget to the hash table and adds event handlers.
bool AttachWidget (wxWindow* parent, WXWidget mainWidget,
@ -595,9 +602,7 @@ inline wxEvtHandler *wxWindow::GetEventHandler() const { return m_windowEventHan
inline void wxWindow::SetAutoLayout(bool a) { m_autoLayout = a; }
inline bool wxWindow::GetAutoLayout() const { return m_autoLayout; }
inline wxLayoutConstraints *wxWindow::GetConstraints() const { return m_constraints; }
inline void wxWindow::SetBackgroundColour(const wxColour& col) { m_backgroundColour = col; };
inline wxColour wxWindow::GetBackgroundColour() const { return m_backgroundColour; };
inline void wxWindow::SetForegroundColour(const wxColour& col) { m_foregroundColour = col; };
inline wxColour wxWindow::GetForegroundColour() const { return m_foregroundColour; };
inline wxButton *wxWindow::GetDefaultItem() const { return m_defaultItem; }

View File

@ -12,9 +12,7 @@
# define wxToolBar wxToolBarMSW
# define sm_classwxToolBar sm_classwxToolBarMSW
#elif defined(__WXMOTIF__)
# include "wx/tbarsmpl.h"
# define wxToolBar wxToolBarSimple
# define sm_classwxToolBar sm_classwxToolBarSimple
# include "wx/motif/toolbar.h"
#elif defined(__WXGTK__)
# include "wx/gtk/tbargtk.h"
#elif defined(__WXQT__)

View File

@ -66,7 +66,7 @@ DECLARE_EVENT_TABLE()
class MyCanvas: public wxScrolledWindow
{
public:
MyCanvas(wxWindow* parent, int x, int y, int w, int h);
MyCanvas(wxWindow* parent, wxWindowID id, int x, int y, int w, int h);
virtual ~MyCanvas();
virtual void OnDraw(wxDC& dc);
@ -83,6 +83,12 @@ END_EVENT_TABLE()
#define SPLIT_VERTICAL 3
#define SPLIT_UNSPLIT 4
// Window ids
#define SPLITTER_WINDOW 100
#define SPLITTER_FRAME 101
#define CANVAS1 102
#define CANVAS2 103
IMPLEMENT_APP(MyApp)
bool MyApp::OnInit(void)
@ -110,7 +116,7 @@ END_EVENT_TABLE()
// My frame constructor
MyFrame::MyFrame(wxFrame* frame, const wxString& title, const wxPoint& pos, const wxSize& size):
wxFrame(frame, -1, title, pos, size)
wxFrame(frame, SPLITTER_FRAME, title, pos, size)
{
// set the icon
#ifdef __WXMSW__
@ -131,16 +137,16 @@ MyFrame::MyFrame(wxFrame* frame, const wxString& title, const wxPoint& pos, cons
SetMenuBar(menuBar);
splitter = new wxSplitterWindow(this, -1, wxPoint(0, 0), wxSize(400, 400),
splitter = new wxSplitterWindow(this, SPLITTER_WINDOW, wxPoint(0, 0), wxSize(400, 400),
// wxSP_BORDER);
wxSP_3D);
// wxSP_NOBORDER);
leftCanvas = new MyCanvas(splitter, 0, 0, 400, 400);
leftCanvas = new MyCanvas(splitter, CANVAS1, 0, 0, 400, 400);
leftCanvas->SetBackgroundColour(*wxRED);
leftCanvas->SetScrollbars(20, 20, 50, 50);
rightCanvas = new MyCanvas(splitter, 0, 0, 400, 400);
rightCanvas = new MyCanvas(splitter, CANVAS2, 0, 0, 400, 400);
rightCanvas->SetBackgroundColour(*wxCYAN);
rightCanvas->SetScrollbars(20, 20, 50, 50);
rightCanvas->Show(FALSE);
@ -212,8 +218,8 @@ void MyFrame::OnIdle(wxIdleEvent& event)
wxFrame::OnIdle(event);
}
MyCanvas::MyCanvas(wxWindow* parent, int x, int y, int w, int h) :
wxScrolledWindow(parent, -1, wxPoint(x, y), wxSize(w, h))
MyCanvas::MyCanvas(wxWindow* parent, wxWindowID id, int x, int y, int w, int h) :
wxScrolledWindow(parent, id, wxPoint(x, y), wxSize(w, h))
{
}

View File

@ -302,7 +302,7 @@ int wxApp::MainLoop()
XtDispatchEvent(&event);
DeletePendingObjects();
ProcessIdle();
}
}

View File

@ -619,8 +619,17 @@ bool wxXPMFileHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long fla
M_BITMAPHANDLERDATA->m_bitmapMask->SetPixmap((WXPixmap) mask);
}
unsigned int depthRet;
int xRet, yRet;
unsigned int widthRet, heightRet, borderWidthRet;
Window rootWindowRet;
XGetGeometry(dpy, pixmap, &rootWindowRet, &xRet, &yRet,
&widthRet, &heightRet, &borderWidthRet, &depthRet);
M_BITMAPHANDLERDATA->m_width = xpmAttr.width;
M_BITMAPHANDLERDATA->m_height = xpmAttr.height;
/*
if ( xpmAttr.npixels > 2 )
{
M_BITMAPHANDLERDATA->m_depth = 8; // TODO: next time not just a guess :-) ...
@ -628,6 +637,9 @@ bool wxXPMFileHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long fla
{
M_BITMAPHANDLERDATA->m_depth = 1; // mono
}
*/
M_BITMAPHANDLERDATA->m_depth = depthRet;
M_BITMAPHANDLERDATA->m_numColors = xpmAttr.npixels;
@ -714,6 +726,15 @@ bool wxXPMDataHandler::Create(wxBitmap *bitmap, void *data, long flags, int widt
// Set attributes
M_BITMAPHANDLERDATA->m_width = xpmAttr.width;
M_BITMAPHANDLERDATA->m_height = xpmAttr.height;
unsigned int depthRet;
int xRet, yRet;
unsigned int widthRet, heightRet, borderWidthRet;
Window rootWindowRet;
XGetGeometry(dpy, pixmap, &rootWindowRet, &xRet, &yRet,
&widthRet, &heightRet, &borderWidthRet, &depthRet);
/*
if ( xpmAttr.npixels > 2 )
{
M_BITMAPHANDLERDATA->m_depth = 8; // next time not just a guess :-) ...
@ -721,6 +742,10 @@ bool wxXPMDataHandler::Create(wxBitmap *bitmap, void *data, long flags, int widt
{
M_BITMAPHANDLERDATA->m_depth = 1; // mono
}
*/
M_BITMAPHANDLERDATA->m_depth = depthRet;
M_BITMAPHANDLERDATA->m_numColors = xpmAttr.npixels;
XpmFreeAttributes(&xpmAttr);
M_BITMAPHANDLERDATA->m_ok = TRUE;
@ -846,6 +871,18 @@ WXPixmap wxBitmap::GetInsensPixmap (WXWidget w)
{
Display *dpy = (Display*) M_BITMAPDATA->m_display;
if (M_BITMAPDATA->m_insensPixmap)
return M_BITMAPDATA->m_insensPixmap;
if (!w)
{
M_BITMAPDATA->m_insensPixmap = (WXPixmap) XCreateInsensitivePixmap(dpy, (Pixmap) M_BITMAPDATA->m_pixmap);
if (M_BITMAPDATA->m_insensPixmap)
return M_BITMAPDATA->m_insensPixmap;
else
return M_BITMAPDATA->m_pixmap;
}
if (M_BITMAPDATA->m_insensImage == (WXPixmap) 0)
return M_BITMAPDATA->m_pixmap;

View File

@ -116,7 +116,7 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit
SetFont(* parent->GetFont());
ChangeColour (m_mainWidget);
ChangeBackgroundColour ();
return TRUE;

View File

@ -38,6 +38,8 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label,
SetName(name);
SetValidator(validator);
m_windowStyle = style;
m_backgroundColour = parent->GetBackgroundColour();
m_foregroundColour = parent->GetForegroundColour();
parent->AddChild((wxButton *)this);
@ -77,7 +79,7 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label,
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
SetFont(* parent->GetFont());
ChangeColour(m_mainWidget);
ChangeBackgroundColour();
return TRUE;
}
@ -132,3 +134,19 @@ void wxButtonCallback (Widget w, XtPointer clientData, XtPointer ptr)
event.SetEventObject(item);
item->ProcessCommand (event);
}
void wxButton::ChangeFont()
{
// TODO
}
void wxButton::ChangeBackgroundColour()
{
// TODO
}
void wxButton::ChangeForegroundColour()
{
// TODO
}

View File

@ -40,6 +40,8 @@ bool wxCheckBox::Create(wxWindow *parent, wxWindowID id, const wxString& label,
SetName(name);
SetValidator(validator);
m_windowStyle = style;
m_backgroundColour = parent->GetBackgroundColour();
m_foregroundColour = parent->GetForegroundColour();
if (parent) parent->AddChild(this);
@ -67,7 +69,7 @@ bool wxCheckBox::Create(wxWindow *parent, wxWindowID id, const wxString& label,
SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
ChangeColour(m_mainWidget);
ChangeBackgroundColour();
SetFont(* parent->GetFont());
return TRUE;
@ -148,3 +150,19 @@ void wxCheckBoxCallback (Widget w, XtPointer clientData,
event.SetEventObject(item);
item->ProcessCommand (event);
}
void wxCheckBox::ChangeFont()
{
// TODO
}
void wxCheckBox::ChangeBackgroundColour()
{
// TODO
}
void wxCheckBox::ChangeForegroundColour()
{
// TODO
}

View File

@ -64,6 +64,9 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id,
else
m_windowId = id;
m_backgroundColour = parent->GetBackgroundColour();
m_foregroundColour = parent->GetForegroundColour();
Widget parentWidget = (Widget) parent->GetClientWidget();
m_formWidget = (WXWidget) XtVaCreateManagedWidget ((char*) (const char*) name,
@ -125,7 +128,7 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id,
AttachWidget (parent, m_buttonWidget, m_formWidget, pos.x, pos.y, size.x, size.y);
SetFont(* parent->GetFont());
ChangeColour(m_mainWidget);
ChangeBackgroundColour();
return TRUE;
}
@ -415,3 +418,18 @@ void wxChoiceCallback (Widget w, XtPointer clientData,
}
}
void wxChoice::ChangeFont()
{
// TODO
}
void wxChoice::ChangeBackgroundColour()
{
// TODO
}
void wxChoice::ChangeForegroundColour()
{
// TODO
}

View File

@ -40,6 +40,8 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
SetValidator(validator);
m_noStrings = n;
m_windowStyle = style;
m_backgroundColour = parent->GetBackgroundColour();
m_foregroundColour = parent->GetForegroundColour();
if (parent) parent->AddChild(this);
@ -85,7 +87,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
SetFont(* parent->GetFont());
ChangeColour(m_mainWidget);
ChangeBackgroundColour();
return TRUE;
}
@ -205,5 +207,20 @@ void wxComboBoxCallback (Widget w, XtPointer clientData,
}
}
void wxComboBox::ChangeFont()
{
// TODO
}
void wxComboBox::ChangeBackgroundColour()
{
// TODO
}
void wxComboBox::ChangeForegroundColour()
{
// TODO
}
#endif

View File

@ -1855,7 +1855,9 @@ void wxWindowDC::SetBackground( const wxBrush &brush )
int pixel = m_backgroundBrush.GetColour().AllocColour(m_display);
XSetWindowBackground ((Display*) m_display, (Pixmap) m_pixmap, pixel);
// XSetWindowBackground doesn't work for non-Window pixmaps
if (!this->IsKindOf(CLASSINFO(wxMemoryDC)))
XSetWindowBackground ((Display*) m_display, (Pixmap) m_pixmap, pixel);
// Necessary for ::DrawIcon, which use fg/bg pixel or the GC.
// And Blit,... (Any fct that use XCopyPlane, in fact.)

View File

@ -80,7 +80,7 @@ END_EVENT_TABLE()
wxDialog::wxDialog()
{
m_modalShowing = FALSE;
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);
}
bool wxDialog::Create(wxWindow *parent, wxWindowID id,
@ -94,7 +94,9 @@ bool wxDialog::Create(wxWindow *parent, wxWindowID id,
m_modalShowing = FALSE;
m_dialogTitle = title;
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);
m_foregroundColour = *wxBLACK;
SetName(name);
if (!parent)
@ -233,6 +235,8 @@ bool wxDialog::Create(wxWindow *parent, wxWindowID id,
wxDialogBoxEventHandler,
(XtPointer)this);
ChangeBackgroundColour();
return TRUE;
}
@ -739,3 +743,19 @@ static void wxUnmapBulletinBoard(Widget dialog, wxDialog *client,XtPointer call)
client->m_isShown = FALSE;
*/
}
void wxDialog::ChangeFont()
{
// TODO
}
void wxDialog::ChangeBackgroundColour()
{
// TODO
}
void wxDialog::ChangeForegroundColour()
{
// TODO
}

View File

@ -126,7 +126,8 @@ bool wxFrame::Create(wxWindow *parent,
m_visibleStatus = TRUE;
m_title = "";
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE));
m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE);
m_foregroundColour = *wxBLACK;
if ( id > -1 )
m_windowId = id;
@ -264,6 +265,8 @@ bool wxFrame::Create(wxWindow *parent,
#endif
#endif
ChangeBackgroundColour();
PreResize();
wxSizeEvent sizeEvent(wxSize(width, height), GetId());
@ -1037,6 +1040,21 @@ WXWidget wxFrame::GetClientWidget() const
return m_clientArea;
}
void wxFrame::ChangeFont()
{
// TODO
}
void wxFrame::ChangeBackgroundColour()
{
// TODO
}
void wxFrame::ChangeForegroundColour()
{
// TODO
}
void wxCloseFrameCallback(Widget widget, XtPointer client_data, XmAnyCallbackStruct *cbs)
{
wxFrame *frame = (wxFrame *)client_data;
@ -1047,3 +1065,4 @@ void wxCloseFrameCallback(Widget widget, XtPointer client_data, XmAnyCallbackStr
// May delete the frame (with delayed deletion)
frame->GetEventHandler()->ProcessEvent(closeEvent);
}

View File

@ -85,6 +85,8 @@ bool wxGauge::Create(wxWindow *parent, wxWindowID id,
SetValidator(validator);
m_rangeMax = range;
m_windowStyle = style;
m_backgroundColour = parent->GetBackgroundColour();
m_foregroundColour = parent->GetForegroundColour();
if (parent) parent->AddChild(this);
@ -125,7 +127,7 @@ bool wxGauge::Create(wxWindow *parent, wxWindowID id,
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, x, y, width, height);
SetFont(* parent->GetFont());
ChangeColour(m_mainWidget);
ChangeBackgroundColour();
return TRUE;
}
@ -186,6 +188,21 @@ int wxGauge::GetValue() const
// return m_gaugePos;
}
void wxGauge::ChangeFont()
{
// TODO
}
void wxGauge::ChangeBackgroundColour()
{
// TODO
}
void wxGauge::ChangeForegroundColour()
{
// TODO
}
//// PRIVATE DECLARATIONS FOR XMGAUGE
#include <Xm/PrimitiveP.h>

View File

@ -53,6 +53,8 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
m_windowStyle = style;
m_noItems = n;
m_selected = 0;
m_backgroundColour = parent->GetBackgroundColour();
m_foregroundColour = parent->GetForegroundColour();
SetName(name);
SetValidator(validator);
@ -107,11 +109,10 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, width, height);
wxSystemSettings settings;
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW));
m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW);
SetFont(* parent->GetFont());
ChangeColour(m_mainWidget);
ChangeBackgroundColour();
return TRUE;
}
@ -739,3 +740,19 @@ WXWidget wxListBox::GetTopWidget() const
{
return (WXWidget) XtParent( (Widget) m_mainWidget );
}
void wxListBox::ChangeFont()
{
// TODO
}
void wxListBox::ChangeBackgroundColour()
{
// TODO
}
void wxListBox::ChangeForegroundColour()
{
// TODO
}

View File

@ -127,6 +127,7 @@ LIB_CPP_SRC=\
textctrl.cpp \
thread.cpp \
timer.cpp \
toolbar.cpp \
utils.cpp \
utilsexc.cpp \
wave.cpp \
@ -157,7 +158,6 @@ LIB_CPP_SRC=\
# listctrl.cpp \
# imaglist.cpp \
# statusbr.cpp \
# toolbar.cpp \
LIB_C_SRC=\
\

View File

@ -88,7 +88,7 @@ public:
// Generate wxSizeEvent here, I think. Maybe also restore, maximize
// Probably don't need to generate size event here since work area
// is used
// is used (???)
wxSizeEvent event(wxSize(w, h), m_childFrame->GetId());
event.SetEventObject(m_childFrame);
m_childFrame->ProcessEvent(event);
@ -98,6 +98,16 @@ public:
XsMotifWindow::close();
m_childFrame->Close();
}
virtual void raise()
{
XsMotifWindow::raise();
m_childFrame->OnRaise();
}
virtual void lower()
{
XsMotifWindow::lower();
m_childFrame->OnLower();
}
virtual void _buildClientArea(Widget parent)
{
m_childFrame->BuildClientArea((WXWidget) parent);
@ -204,7 +214,8 @@ public:
wxMDIParentFrame::wxMDIParentFrame()
{
m_clientWindow = NULL;
m_clientWindow = (wxMDIClientWindow*) NULL;
m_activeChild = (wxMDIChildFrame*) NULL;
}
bool wxMDIParentFrame::Create(wxWindow *parent,
@ -215,7 +226,8 @@ bool wxMDIParentFrame::Create(wxWindow *parent,
long style,
const wxString& name)
{
m_clientWindow = NULL;
m_clientWindow = (wxMDIClientWindow*) NULL;
m_activeChild = (wxMDIChildFrame*) NULL;
bool success = wxFrame::Create(parent, id, title, pos, size, style, name);
if (success)
@ -273,8 +285,7 @@ void wxMDIParentFrame::OnActivate(wxActivateEvent& event)
// Returns the active MDI child window
wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const
{
// TODO
return NULL;
return m_activeChild;
}
// Create the client window class (don't Create the window,
@ -344,14 +355,32 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
int x = pos.x; int y = pos.y;
int width = size.x; int height = size.y;
if (width == -1)
width = 200; // TODO: give reasonable default
if (height == -1)
height = 200; // TODO: give reasonable default
wxMDIClientWindow* clientWindow = parent->GetClientWindow();
if (!clientWindow)
return FALSE;
// We're deactivating the old child
wxMDIChildFrame* oldActiveChild = parent->GetActiveChild();
if (oldActiveChild)
{
wxActivateEvent event(wxEVT_ACTIVATE, FALSE, oldActiveChild->GetId());
event.SetEventObject( oldActiveChild );
oldActiveChild->GetEventHandler()->ProcessEvent(event);
}
m_mdiWindow = new wxXsMDIWindow("mdiChildWindow", this);
clientWindow->GetMDICanvas()->add(m_mdiWindow);
// This is the currently active child
parent->SetActiveChild((wxMDIChildFrame*) this);
m_mdiWindow->Show();
#if 0
m_mainWidget = (WXWidget) (Widget) (*m_mdiWindow);
@ -411,10 +440,7 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
PreResize();
wxSizeEvent sizeEvent(wxSize(width, height), GetId());
sizeEvent.SetEventObject(this);
GetEventHandler()->ProcessEvent(sizeEvent);
m_mdiWindow->setSize(width, height);
wxModelessWindows.Append(this);
return TRUE;
@ -490,11 +516,50 @@ void wxMDIChildFrame::BuildClientArea(WXWidget parent)
wxMDIChildFrame::~wxMDIChildFrame()
{
wxMDIClientWindow* clientWindow = ((wxMDIParentFrame*)GetParent())->GetClientWindow();
wxMDIParentFrame* parentFrame = (wxMDIParentFrame*) GetParent() ;
if (parentFrame->GetActiveChild() == this)
parentFrame->SetActiveChild((wxMDIChildFrame*) NULL);
wxMDIClientWindow* clientWindow = parentFrame->GetClientWindow();
clientWindow->GetMDICanvas()->remove(m_mdiWindow);
m_mainWidget = (WXWidget) 0;
}
// Implementation: intercept and act upon raise and lower commands.
void wxMDIChildFrame::OnRaise()
{
wxMDIParentFrame* parentFrame = (wxMDIParentFrame*) GetParent() ;
wxMDIChildFrame* oldActiveChild = parentFrame->GetActiveChild();
parentFrame->SetActiveChild(this);
if (oldActiveChild)
{
wxActivateEvent event(wxEVT_ACTIVATE, FALSE, oldActiveChild->GetId());
event.SetEventObject( oldActiveChild );
oldActiveChild->GetEventHandler()->ProcessEvent(event);
}
wxActivateEvent event(wxEVT_ACTIVATE, TRUE, this->GetId());
event.SetEventObject( this );
this->GetEventHandler()->ProcessEvent(event);
}
void wxMDIChildFrame::OnLower()
{
wxMDIParentFrame* parentFrame = (wxMDIParentFrame*) GetParent() ;
wxMDIChildFrame* oldActiveChild = parentFrame->GetActiveChild();
if (oldActiveChild == this)
{
wxActivateEvent event(wxEVT_ACTIVATE, FALSE, oldActiveChild->GetId());
event.SetEventObject( oldActiveChild );
oldActiveChild->GetEventHandler()->ProcessEvent(event);
}
// TODO: unfortunately we don't now know which is the top-most child,
// so make the active child NULL.
parentFrame->SetActiveChild((wxMDIChildFrame*) NULL);
}
// Set the client size (i.e. leave the calculation of borders etc.
// to wxWindows)
void wxMDIChildFrame::SetClientSize(int width, int height)

View File

@ -1,4 +1,4 @@
Copyright (c) 1996 Scott W. Sadler
Copyright (c) 1996, 1998 Scott W. Sadler
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
@ -21,9 +21,8 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization.
Scott W. Sadler
Software Engineer
International TechneGroup Incorporated
5303 DuPont Circle
Milford, OH 45150
sws@iti-oh.com
http://www.iti-oh.com/~sws
Cisco Systems
7025 Kit Creek Road
P.O. Box 14987
Research Triangle Park NC, 27709
ssadler@cisco.com

View File

@ -37,6 +37,13 @@ CC = $(CXX)
#define FOUND_COMPILER
#endif
#ifdef i386SVR4Architecture
CXX = CC
CC = $(CXX)
CCOPTIONS=
#define COMPILER_FOUND
#endif
#ifndef FOUND_COMPILER
CXX = gcc
CC = $(CXX)

View File

@ -2,7 +2,7 @@
<HEAD>
<TITLE>XsMDICanvas Class</TITLE>
<LINK REV="made" HREF="mailto:sws@iti-oh.com">
<LINK REV="made" HREF="mailto:ssadler@cisco.com">
</HEAD>
<H2>

View File

@ -2,7 +2,7 @@
<HEAD>
<TITLE>Motif Multi-Document Interface (MDI)</TITLE>
<LINK REV="made" HREF="mailto:sws@iti-oh.com">
<LINK REV="made" HREF="mailto:ssadler@cisco.com">
</HEAD>
<CENTER>

View File

@ -2,7 +2,7 @@
<HEAD>
<TITLE>XsMotifWindow Class</TITLE>
<LINK REV="made" HREF="mailto:sws@iti-oh.com">
<LINK REV="made" HREF="mailto:ssadler@cisco.com">
</HEAD>
<H2>

View File

@ -7,7 +7,7 @@
XsComponent.C
History
03-Mar-96 1.0; Scott W. Sadler (sws@iti-oh.com)
03-Mar-96 1.0; Scott W. Sadler (ssadler@cisco.com)
Created
*/
@ -62,8 +62,8 @@ void XsComponent::show ( )
{
#ifndef NDEBUG
if (XtIsManaged (_base))
cout << "Re-managing a widget:" << _name << endl;
// if (XtIsManaged (_base))
// cout << "Re-managing a widget:" << _name << endl;
#endif
// Make sure the _destroyHandler was installed
@ -80,8 +80,8 @@ void XsComponent::hide ( )
{
#ifndef NDEBUG
if (!XtIsManaged (_base))
cout << "Re-unmanaging a widget:" << _name << endl;
// if (!XtIsManaged (_base))
// cout << "Re-unmanaging a widget:" << _name << endl;
#endif
assert (_base != 0);

View File

@ -7,7 +7,7 @@
XsComponent.h
History
03-Mar-96 1.0; Scott W. Sadler (sws@iti-oh.com)
03-Mar-96 1.0; Scott W. Sadler (ssadler@cisco.com)
Created
*/
@ -33,9 +33,6 @@ class XsComponent {
virtual void show ( ); // Show the component
virtual void hide ( ); // Hide the component
// Added JACS 19/10/98
inline Widget GetBase() const { return _base; }
// Component name
const char *name ( ) const;

View File

@ -7,7 +7,7 @@
XsMDICanvas.C
History
03-Mar-96 1.0; Scott W. Sadler (sws@iti-oh.com)
03-Mar-96 1.0; Scott W. Sadler (ssadler@cisco.com)
Created
*/

View File

@ -7,7 +7,7 @@
XsMDICanvas.h
History
03-Mar-96 1.0; Scott W. Sadler (sws@iti-oh.com)
03-Mar-96 1.0; Scott W. Sadler (ssadler@cisco.com)
Created
*/
@ -38,13 +38,11 @@ class XsMDICanvas : public XsComponent {
virtual void add (XsMDIWindow *win); // Add an MDI window
virtual void remove (XsMDIWindow *win); // Remove an MDI window
void removeAll ( ); // Remove all MDI windows
// Added JACS 19/10/98
inline Widget GetDrawingArea() const { return _drawArea; }
// Utilities
int numWindows ( ) const; // Number of MDI windows
Widget GetDrawingArea() const { return _drawArea; }
// Component methods

View File

@ -7,7 +7,7 @@
XsMDIWindow.C
History
03-Mar-96 1.0; Scott W. Sadler (sws@iti-oh.com)
03-Mar-96 1.0; Scott W. Sadler (ssadler@cisco.com)
Created
*/

View File

@ -7,7 +7,7 @@
XsMDIWindow.h
History
03-Mar-96 1.0; Scott W. Sadler (sws@iti-oh.com)
03-Mar-96 1.0; Scott W. Sadler (ssadler@cisco.com)
Created
*/

View File

@ -7,7 +7,7 @@
XsMotifWindow.C
History
03-Mar-96 1.0; Scott W. Sadler (sws@iti-oh.com)
03-Mar-96 1.0; Scott W. Sadler (ssadler@cisco.com)
Created
*/
@ -2880,12 +2880,6 @@ void XsMotifWindow::restore ( )
setPosition (_savedX, _savedY);
setSize (_savedWidth, _savedHeight);
_maximized = False;
// Redraw the maximize button
_buttons[_XsMotifButton::Maximize]->redraw ( );
}
}
@ -2972,6 +2966,17 @@ void XsMotifWindow::setSize (Dimension w, Dimension h)
if (_minimized == False)
XtVaSetValues (_base, XmNwidth, w, XmNheight, h, NULL);
// If window was maximized, change the window state back to normal
if (_maximized == True)
{
_maximized = False;
// Redraw the maximize button
_buttons[_XsMotifButton::Maximize]->redraw ( );
}
}
else
XsMDIWindow::setSize (w, h); // Cache the points

View File

@ -7,7 +7,7 @@
XsMotifWindow.h
History
03-Mar-96 1.0; Scott W. Sadler (sws@iti-oh.com)
03-Mar-96 1.0; Scott W. Sadler (ssadler@cisco.com)
Created
*/

View File

@ -7,7 +7,7 @@
XsMoveOutline.C
History
03-Mar-96 1.0; Scott W. Sadler (sws@iti-oh.com)
03-Mar-96 1.0; Scott W. Sadler (ssadler@cisco.com)
Created
*/

View File

@ -7,7 +7,7 @@
XsMoveOutline.h
History
03-Mar-96 1.0; Scott W. Sadler (sws@iti-oh.com)
03-Mar-96 1.0; Scott W. Sadler (ssadler@cisco.com)
Created
*/

View File

@ -7,7 +7,7 @@
XsOutline.C
History
03-Mar-96 1.0; Scott W. Sadler (sws@iti-oh.com)
03-Mar-96 1.0; Scott W. Sadler (ssadler@cisco.com)
Created
*/

View File

@ -7,7 +7,7 @@
XsOutline.h
History
03-Mar-96 1.0; Scott W. Sadler (sws@iti-oh.com)
03-Mar-96 1.0; Scott W. Sadler (ssadler@cisco.com)
Created
*/

View File

@ -7,7 +7,7 @@
XsResizeOutline.C
History
03-Mar-96 1.0; Scott W. Sadler (sws@iti-oh.com)
03-Mar-96 1.0; Scott W. Sadler (ssadler@cisco.com)
Created
*/

View File

@ -7,7 +7,7 @@
XsResizeOutline.h
History
03-Mar-96 1.0; Scott W. Sadler (sws@iti-oh.com)
03-Mar-96 1.0; Scott W. Sadler (ssadler@cisco.com)
Created
*/

View File

@ -7,7 +7,7 @@
xs_motif_icon.xbm
History
03-Mar-96 1.0; Scott W. Sadler (sws@iti-oh.com)
03-Mar-96 1.0; Scott W. Sadler (ssadler@cisco.com)
Created
*/

View File

@ -365,3 +365,18 @@ void wxNotebook::ChangePage(int nOldSel, int nSel)
m_nSelection = nSel;
}
void wxNotebook::ChangeFont()
{
// TODO
}
void wxNotebook::ChangeBackgroundColour()
{
// TODO
}
void wxNotebook::ChangeForegroundColour()
{
// TODO
}

View File

@ -57,6 +57,8 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
m_labelWidget = (WXWidget) 0;
m_radioButtons = (WXWidget*) NULL;
m_radioButtonLabels = (wxString*) NULL;
m_backgroundColour = parent->GetBackgroundColour();
m_foregroundColour = parent->GetForegroundColour();
SetName(name);
SetValidator(val);
@ -176,7 +178,7 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
AttachWidget (parent, m_mainWidget, m_formWidget, pos.x, pos.y, size.x, size.y);
SetFont(* parent->GetFont());
ChangeColour(m_mainWidget);
ChangeBackgroundColour();
return TRUE;
}
@ -389,6 +391,21 @@ void wxRadioBox::Command (wxCommandEvent & event)
ProcessCommand (event);
}
void wxRadioBox::ChangeFont()
{
// TODO
}
void wxRadioBox::ChangeBackgroundColour()
{
// TODO
}
void wxRadioBox::ChangeForegroundColour()
{
// TODO
}
void wxRadioBoxCallback (Widget w, XtPointer clientData,
XmToggleButtonCallbackStruct * cbs)
{

View File

@ -47,6 +47,8 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id,
{
SetName(name);
SetValidator(validator);
m_backgroundColour = parent->GetBackgroundColour();
m_foregroundColour = parent->GetForegroundColour();
if (parent) parent->AddChild(this);
@ -130,7 +132,7 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id,
AttachWidget (parent, m_mainWidget, m_formWidget, pos.x, pos.y, size.x, size.y);
SetFont(* parent->GetFont());
ChangeColour(m_mainWidget);
ChangeBackgroundColour();
return TRUE;
}
@ -154,6 +156,21 @@ void wxRadioButton::Command (wxCommandEvent & event)
ProcessCommand (event);
}
void wxRadioButton::ChangeFont()
{
// TODO
}
void wxRadioButton::ChangeBackgroundColour()
{
// TODO
}
void wxRadioButton::ChangeForegroundColour()
{
// TODO
}
void wxRadioButtonCallback (Widget w, XtPointer clientData,
XmToggleButtonCallbackStruct * cbs)
{

View File

@ -40,7 +40,9 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
return FALSE;
parent->AddChild(this);
SetName(name);
SetValidator(validator);
m_backgroundColour = parent->GetBackgroundColour();
m_foregroundColour = parent->GetForegroundColour();
SetValidator(validator);
m_windowStyle = style;
@ -91,7 +93,7 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, x, y, width, height);
ChangeColour(m_mainWidget);
ChangeBackgroundColour();
return TRUE;
}
@ -150,6 +152,21 @@ void wxScrollBar::Command(wxCommandEvent& event)
ProcessCommand(event);
}
void wxScrollBar::ChangeFont()
{
// TODO
}
void wxScrollBar::ChangeBackgroundColour()
{
// TODO
}
void wxScrollBar::ChangeForegroundColour()
{
// TODO
}
void wxScrollBarCallback(Widget widget, XtPointer clientData,
XmScaleCallbackStruct *cbs)
{

View File

@ -54,6 +54,8 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
{
SetName(name);
SetValidator(validator);
m_backgroundColour = parent->GetBackgroundColour();
m_foregroundColour = parent->GetForegroundColour();
if (parent) parent->AddChild(this);
@ -101,7 +103,7 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
SetFont(* parent->GetFont());
ChangeColour(m_mainWidget);
ChangeBackgroundColour();
return TRUE;
}
@ -245,6 +247,21 @@ void wxSlider::Command (wxCommandEvent & event)
ProcessCommand (event);
}
void wxSlider::ChangeFont()
{
// TODO
}
void wxSlider::ChangeBackgroundColour()
{
// TODO
}
void wxSlider::ChangeForegroundColour()
{
// TODO
}
void wxSliderCallback (Widget widget, XtPointer clientData, XmScaleCallbackStruct * cbs)
{
wxSlider *slider = (wxSlider *) clientData;

View File

@ -68,6 +68,21 @@ void wxSpinButton::SetRange(int minVal, int maxVal)
// TODO
}
void wxSpinButton::ChangeFont()
{
// TODO
}
void wxSpinButton::ChangeBackgroundColour()
{
// TODO
}
void wxSpinButton::ChangeForegroundColour()
{
// TODO
}
// Spin event
IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxScrollEvent)

View File

@ -39,6 +39,8 @@ bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID id,
{
m_messageBitmap = bitmap;
SetName(name);
m_backgroundColour = parent->GetBackgroundColour();
m_foregroundColour = parent->GetForegroundColour();
if (parent) parent->AddChild(this);
if ( id == -1 )
@ -69,7 +71,7 @@ bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID id,
SetFont(* parent->GetFont());
ChangeColour (m_mainWidget);
ChangeBackgroundColour ();
return TRUE;
}
@ -117,3 +119,18 @@ void wxStaticBitmap::SetBitmap(const wxBitmap& bitmap)
}
}
void wxStaticBitmap::ChangeFont()
{
// TODO
}
void wxStaticBitmap::ChangeBackgroundColour()
{
// TODO
}
void wxStaticBitmap::ChangeForegroundColour()
{
// TODO
}

View File

@ -51,6 +51,8 @@ bool wxStaticBox::Create(wxWindow *parent, wxWindowID id,
{
m_formWidget = (WXWidget) 0;
m_labelWidget = (WXWidget) 0;
m_backgroundColour = parent->GetBackgroundColour();
m_foregroundColour = parent->GetForegroundColour();
SetName(name);
@ -112,7 +114,7 @@ bool wxStaticBox::Create(wxWindow *parent, wxWindowID id,
SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, (WXWidget) frameWidget, pos.x, pos.y, size.x, size.y);
ChangeColour(m_mainWidget);
ChangeBackgroundColour();
return TRUE;
}
@ -179,3 +181,18 @@ void wxStaticBox::SetSize(int x, int y, int width, int height, int sizeFlags)
}
}
void wxStaticBox::ChangeFont()
{
// TODO
}
void wxStaticBox::ChangeBackgroundColour()
{
// TODO
}
void wxStaticBox::ChangeForegroundColour()
{
// TODO
}

View File

@ -36,8 +36,8 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
SetName(name);
if (parent) parent->AddChild(this);
SetBackgroundColour(parent->GetBackgroundColour()) ;
SetForegroundColour(parent->GetForegroundColour()) ;
m_backgroundColour = parent->GetBackgroundColour();
m_foregroundColour = parent->GetForegroundColour();
if ( id == -1 )
m_windowId = (int)NewControlId();
@ -69,8 +69,23 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
SetFont(* parent->GetFont());
ChangeColour (m_mainWidget);
ChangeBackgroundColour ();
return TRUE;
}
void wxStaticText::ChangeFont()
{
// TODO
}
void wxStaticText::ChangeBackgroundColour()
{
// TODO
}
void wxStaticText::ChangeForegroundColour()
{
// TODO
}

View File

@ -80,6 +80,8 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
m_modified = FALSE;
m_processedDefault = FALSE;
m_fileName = "";
m_backgroundColour = parent->GetBackgroundColour();
m_foregroundColour = parent->GetForegroundColour();
SetName(name);
SetValidator(validator);
@ -145,7 +147,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
SetFont(* parent->GetFont());
ChangeColour(m_mainWidget);
ChangeBackgroundColour();
return TRUE;
}
@ -617,6 +619,21 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
}
}
void wxTextCtrl::ChangeFont()
{
// TODO
}
void wxTextCtrl::ChangeBackgroundColour()
{
// TODO
}
void wxTextCtrl::ChangeForegroundColour()
{
// TODO
}
static void wxTextWindowChangedProc (Widget w, XtPointer clientData, XtPointer ptr)
{
if (!wxGetWindowFromTable(w))

View File

@ -14,13 +14,39 @@
#endif
#include "wx/timer.h"
#include "wx/app.h"
#include "wx/list.h"
#include <Xm/Xm.h>
#include "wx/motif/private.h"
#if !USE_SHARED_LIBRARY
IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxObject)
#endif
static wxList wxTimerList(wxKEY_INTEGER);
void wxTimerCallback (wxTimer * timer)
{
// Check to see if it's still on
if (!wxTimerList.Find((long)timer))
return;
if (timer->m_id == 0)
return; // Avoid to process spurious timer events
if (!timer->m_oneShot)
timer->m_id = XtAppAddTimeOut ((XtAppContext) wxTheApp->GetAppContext(), timer->m_milli,
(XtTimerCallbackProc) wxTimerCallback, (XtPointer) timer);
else
timer->m_id = 0;
timer->Notify ();
}
wxTimer::wxTimer()
{
m_id = 0;
m_milli = 0 ;
m_id = 0;
m_oneShot = FALSE;
@ -31,21 +57,34 @@ wxTimer::~wxTimer()
Stop();
}
bool wxTimer::Start(int milliseconds,bool mode)
bool wxTimer::Start(int milliseconds, bool mode)
{
m_oneShot = mode ;
Stop();
m_oneShot = mode;
if (milliseconds < 0)
milliseconds = m_lastMilli;
if (milliseconds <= 0)
return FALSE;
m_milli = milliseconds;
m_lastMilli = m_milli = milliseconds;
// TODO: set the timer going.
return FALSE;
if (!wxTimerList.Find((long)this))
wxTimerList.Append((long)this, this);
m_id = XtAppAddTimeOut ((XtAppContext) wxTheApp->GetAppContext(), milliseconds,
(XtTimerCallbackProc) wxTimerCallback, (XtPointer) this);
return TRUE;
}
void wxTimer::Stop()
{
m_id = 0 ;
if (m_id > 0)
{
XtRemoveTimeOut (m_id);
m_id = 0;
}
m_milli = 0 ;
}

View File

@ -14,7 +14,16 @@
#endif
#include "wx/wx.h"
#include "wx/toolbar.h"
#include "wx/motif/toolbar.h"
#include <Xm/Xm.h>
#include <Xm/PushBG.h>
#include <Xm/PushB.h>
#include <Xm/ToggleB.h>
#include <Xm/ToggleBG.h>
#include <Xm/Form.h>
#include "wx/motif/private.h"
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxToolBarBase)
@ -23,7 +32,8 @@ BEGIN_EVENT_TABLE(wxToolBar, wxToolBarBase)
END_EVENT_TABLE()
#endif
wxToolBar::wxToolBar()
wxToolBar::wxToolBar():
m_widgets(wxKEY_INTEGER)
{
m_maxWidth = -1;
m_maxHeight = -1;
@ -41,16 +51,32 @@ bool wxToolBar::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, cons
m_defaultWidth = 24;
m_defaultHeight = 22;
SetName(name);
m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);
m_foregroundColour = parent->GetForegroundColour();
m_windowStyle = style;
SetParent(parent);
if (parent) parent->AddChild(this);
// TODO create toolbar
Widget parentWidget = (Widget) parent->GetClientWidget();
Widget toolbar = XtVaCreateManagedWidget("toolbar",
xmFormWidgetClass, parentWidget,
XmNtraversalOn, False,
XmNhorizontalSpacing, 0,
XmNverticalSpacing, 0,
NULL);
m_mainWidget = (WXWidget) toolbar;
SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
SetFont(* parent->GetFont());
ChangeBackgroundColour();
return FALSE;
return TRUE;
}
wxToolBar::~wxToolBar()
@ -63,8 +89,150 @@ bool wxToolBar::CreateTools()
if (m_tools.Number() == 0)
return FALSE;
// TODO
return FALSE;
m_widgets.Clear();
Widget prevButton = (Widget) 0;
wxNode* node = m_tools.First();
while (node)
{
wxToolBarTool *tool = (wxToolBarTool *)node->Data();
if ((tool->m_toolStyle != wxTOOL_STYLE_SEPARATOR) && tool->m_bitmap1.Ok())
{
Widget button = (Widget) 0;
if (tool->m_isToggle)
{
button = XtVaCreateManagedWidget("toggleButton",
xmToggleButtonWidgetClass, (Widget) m_mainWidget,
XmNleftAttachment, (prevButton == (Widget) 0) ? XmATTACH_FORM : XmATTACH_WIDGET,
XmNleftWidget, (prevButton == (Widget) 0) ? NULL : prevButton,
XmNleftOffset, 0,
XmNtopAttachment, XmATTACH_FORM,
// XmNpushButtonEnabled, True,
XmNmultiClick, XmMULTICLICK_KEEP,
XmNlabelType, XmPIXMAP,
NULL);
}
else
{
button = XtVaCreateManagedWidget("button",
xmPushButtonWidgetClass, (Widget) m_mainWidget,
XmNleftAttachment, (prevButton == (Widget) 0) ? XmATTACH_FORM : XmATTACH_WIDGET,
XmNleftWidget, (prevButton == (Widget) 0) ? NULL : prevButton,
XmNleftOffset, 0,
XmNtopAttachment, XmATTACH_FORM,
XmNpushButtonEnabled, True,
XmNmultiClick, XmMULTICLICK_KEEP,
XmNlabelType, XmPIXMAP,
NULL);
}
// For each button, if there is a mask, we must create
// a new wxBitmap that has the correct background colour
// for the button. Otherwise the background will just be
// e.g. black if a transparent XPM has been loaded.
if (tool->m_bitmap1.GetMask())
{
wxBitmap newBitmap(tool->m_bitmap1.GetWidth(),
tool->m_bitmap1.GetHeight(),
tool->m_bitmap1.GetDepth());
int backgroundPixel;
XtVaGetValues(button, XmNbackground, &backgroundPixel,
NULL);
wxColour col;
col.SetPixel(backgroundPixel);
wxMemoryDC destDC;
wxMemoryDC srcDC;
srcDC.SelectObject(tool->m_bitmap1);
destDC.SelectObject(newBitmap);
wxBrush brush(col, wxSOLID);
destDC.SetOptimization(FALSE);
destDC.SetBackground(brush);
destDC.Clear();
destDC.Blit(0, 0, tool->m_bitmap1.GetWidth(), tool->m_bitmap1.GetHeight(), & srcDC, 0, 0, wxCOPY, TRUE);
tool->m_bitmap1 = newBitmap;
}
if (tool->m_bitmap2.Ok() && tool->m_bitmap2.GetMask())
{
wxBitmap newBitmap(tool->m_bitmap2.GetWidth(),
tool->m_bitmap2.GetHeight(),
tool->m_bitmap2.GetDepth());
int backgroundPixel;
XtVaGetValues(button, XmNbackground, &backgroundPixel,
NULL);
wxColour col;
col.SetPixel(backgroundPixel);
wxMemoryDC destDC;
wxMemoryDC srcDC;
srcDC.SelectObject(tool->m_bitmap2);
destDC.SelectObject(newBitmap);
wxBrush brush(col, wxSOLID);
destDC.SetOptimization(FALSE);
destDC.SetBackground(brush);
destDC.Clear();
destDC.Blit(0, 0, tool->m_bitmap2.GetWidth(), tool->m_bitmap2.GetHeight(), & srcDC, 0, 0, wxCOPY, TRUE);
tool->m_bitmap2 = newBitmap;
}
Pixmap pixmap = (Pixmap) tool->m_bitmap1.GetPixmap();
Pixmap insensPixmap = (Pixmap) tool->m_bitmap1.GetInsensPixmap();
if (tool->m_isToggle)
{
Pixmap pixmap2 = (Pixmap) 0;
Pixmap insensPixmap2 = (Pixmap) 0;
// If there's a bitmap for the toggled state, use it,
// otherwise generate one.
if (tool->m_bitmap2.Ok())
{
pixmap2 = (Pixmap) tool->m_bitmap2.GetPixmap();
insensPixmap2 = (Pixmap) tool->m_bitmap2.GetInsensPixmap();
}
else
{
pixmap2 = (Pixmap) tool->m_bitmap1.GetArmPixmap(button);
// This has to be both toggled and insensitive, but
// wxBitmap doesn't yet have a member to store & destroy
// it, so make it the same as pixmap2. Actually it's not
// used!
insensPixmap2 = pixmap2;
}
XtVaSetValues (button,
XmNlabelPixmap, pixmap,
XmNselectPixmap, pixmap,
XmNlabelInsensitivePixmap, insensPixmap,
XmNselectInsensitivePixmap, insensPixmap,
XmNarmPixmap, pixmap2,
XmNlabelType, XmPIXMAP,
NULL);
}
else
{
XtVaSetValues(button,
XmNlabelPixmap, pixmap,
XmNlabelInsensitivePixmap, insensPixmap,
NULL);
}
m_widgets.Append(tool->m_index, (wxObject*) button);
prevButton = button;
}
node = node->Next();
}
return TRUE;
}
void wxToolBar::SetToolBitmapSize(const wxSize& size)
@ -113,7 +281,15 @@ void wxToolBar::ToggleTool(int toolIndex, bool toggle)
void wxToolBar::ClearTools()
{
// TODO
wxNode* node = m_widgets.First();
while (node)
{
Widget button = (Widget) node->Data();
XtDestroyWidget(button);
node = node->Next();
}
m_widgets.Clear();
wxToolBarBase::ClearTools();
}

View File

@ -1280,33 +1280,6 @@ void wxWindow::ScrollWindow(int dx, int dy, const wxRectangle *rect)
}
}
void wxWindow::SetFont(const wxFont& font)
{
m_windowFont = font;
// Note that this causes the widget to be resized back
// 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
if (w && m_windowFont.Ok())
{
int width, height, width1, height1;
GetSize(& width, & height);
XtVaSetValues (w,
XmNfontList, (XmFontList) m_windowFont.GetFontList(1.0, XtDisplay(w)),
NULL);
GetSize(& width1, & height1);
if (width != width1 || height != height1)
{
SetSize(-1, -1, width, height);
}
}
*/
}
void wxWindow::OnChar(wxKeyEvent& event)
{
if ( event.KeyCode() == WXK_TAB ) {
@ -1977,26 +1950,9 @@ wxWindow *wxWindow::FindWindow(const wxString& name)
void wxWindow::OnIdle(wxIdleEvent& event)
{
/* TODO: you may need to do something like this
* if your GUI doesn't generate enter/leave events
// Check if we need to send a LEAVE event
if (m_mouseInWindow)
{
POINT pt;
::GetCursorPos(&pt);
if (::WindowFromPoint(pt) != (HWND) GetHWND())
{
// Generate a LEAVE event
m_mouseInWindow = FALSE;
MSWOnMouseLeave(pt.x, pt.y, 0);
}
}
*/
// This calls the UI-update mechanism (querying windows for
// menu/toolbar/control state information)
UpdateWindowUI();
UpdateWindowUI();
}
// Raise the window to the top of the Z order
@ -2990,11 +2946,9 @@ bool wxTranslateKeyEvent(wxKeyEvent& wxevent, wxWindow *win, Widget widget, XEve
return FALSE;
}
// TODO From wxWin 1.68. What does it do exactly?
#define YAllocColor XAllocColor
XColor itemColors[5];
int wxComputeColors (Display *display, wxColour * back, wxColour * fore)
XColor g_itemColors[5];
int wxComputeColours (Display *display, wxColour * back, wxColour * fore)
{
int result;
static XmColorProc colorProc;
@ -3003,10 +2957,10 @@ int wxComputeColors (Display *display, wxColour * back, wxColour * fore)
if (back)
{
itemColors[0].red = (((long) back->Red ()) << 8);
itemColors[0].green = (((long) back->Green ()) << 8);
itemColors[0].blue = (((long) back->Blue ()) << 8);
itemColors[0].flags = DoRed | DoGreen | DoBlue;
g_itemColors[0].red = (((long) back->Red ()) << 8);
g_itemColors[0].green = (((long) back->Green ()) << 8);
g_itemColors[0].blue = (((long) back->Blue ()) << 8);
g_itemColors[0].flags = DoRed | DoGreen | DoBlue;
if (colorProc == (XmColorProc) NULL)
{
// Get a ptr to the actual function
@ -3014,19 +2968,19 @@ int wxComputeColors (Display *display, wxColour * back, wxColour * fore)
// And set it back to motif.
XmSetColorCalculation (colorProc);
}
(*colorProc) (&itemColors[wxBACK_INDEX],
&itemColors[wxFORE_INDEX],
&itemColors[wxSELE_INDEX],
&itemColors[wxTOPS_INDEX],
&itemColors[wxBOTS_INDEX]);
(*colorProc) (&g_itemColors[wxBACK_INDEX],
&g_itemColors[wxFORE_INDEX],
&g_itemColors[wxSELE_INDEX],
&g_itemColors[wxTOPS_INDEX],
&g_itemColors[wxBOTS_INDEX]);
result = wxBACK_COLORS;
}
if (fore)
{
itemColors[wxFORE_INDEX].red = (((long) fore->Red ()) << 8);
itemColors[wxFORE_INDEX].green = (((long) fore->Green ()) << 8);
itemColors[wxFORE_INDEX].blue = (((long) fore->Blue ()) << 8);
itemColors[wxFORE_INDEX].flags = DoRed | DoGreen | DoBlue;
g_itemColors[wxFORE_INDEX].red = (((long) fore->Red ()) << 8);
g_itemColors[wxFORE_INDEX].green = (((long) fore->Green ()) << 8);
g_itemColors[wxFORE_INDEX].blue = (((long) fore->Blue ()) << 8);
g_itemColors[wxFORE_INDEX].flags = DoRed | DoGreen | DoBlue;
if (result == wxNO_COLORS)
result = wxFORE_COLORS;
}
@ -3038,13 +2992,13 @@ int wxComputeColors (Display *display, wxColour * back, wxColour * fore)
{
/* 5 Colours to allocate */
for (int i = 0; i < 5; i++)
if (!YAllocColor (dpy, cmap, &itemColors[i]))
if (!YAllocColor (dpy, cmap, &g_itemColors[i]))
result = wxNO_COLORS;
}
else if (fore)
{
/* Only 1 colour to allocate */
if (!YAllocColor (dpy, cmap, &itemColors[wxFORE_INDEX]))
if (!YAllocColor (dpy, cmap, &g_itemColors[wxFORE_INDEX]))
result = wxNO_COLORS;
}
@ -3052,58 +3006,101 @@ int wxComputeColors (Display *display, wxColour * back, wxColour * fore)
}
void wxWindow::ChangeColour(WXWidget widget)
// Changes the foreground and background colours to be derived
// from the current background colour.
// To change the foreground colour, you must call SetForegroundColour
// explicitly.
void wxWindow::ChangeBackgroundColour()
{
// TODO
#if 0
int change;
if (GetMainWidget())
DoChangeBackgroundColour(GetMainWidget(), m_backgroundColour);
}
// TODO: how to determine whether we can change this item's colours?
// We used to have wxUSER_COLOURS. Now perhaps we assume we always
// can change it.
// if (!(parent->GetWindowStyleFlag() & wxUSER_COLOURS))
// return;
void wxWindow::ChangeForegroundColour()
{
if (GetMainWidget())
DoChangeForegroundColour(GetMainWidget(), m_foregroundColour);
}
change = wxComputeColors (XtDisplay((Widget)widget), panel->GetBackgroundColour(),
panel->GetLabelColour());
if (change == wxBACK_COLORS)
// Change a widget's foreground and background colours.
// TODO: make this 2 functions, ChangeForegroundColour and ChangeBackgroundColour.
void wxWindow::DoChangeForegroundColour(WXWidget widget, wxColour& foregroundColour)
{
// When should we specify the foreground, if it's calculated
// by wxComputeColours?
// Solution: say we start with the default (computed) foreground colour.
// If we call SetForegroundColour explicitly for a control or window,
// then the foreground is changed.
// Therefore SetBackgroundColour computes the foreground colour, and
// SetForegroundColour changes the foreground colour. The ordering is
// important.
XtVaSetValues ((Widget) widget,
XmNforeground, foregroundColour.AllocColour(XtDisplay((Widget) widget)),
NULL);
}
void wxWindow::DoChangeBackgroundColour(WXWidget widget, wxColour& backgroundColour, bool changeArmColour)
{
wxComputeColours (XtDisplay((Widget) widget), & backgroundColour,
(wxColour*) NULL);
XtVaSetValues ((Widget) widget,
XmNbackground, g_itemColors[wxBACK_INDEX].pixel,
XmNtopShadowColor, g_itemColors[wxTOPS_INDEX].pixel,
XmNbottomShadowColor, g_itemColors[wxBOTS_INDEX].pixel,
XmNforeground, g_itemColors[wxFORE_INDEX].pixel,
NULL);
if (changeArmColour)
XtVaSetValues ((Widget) widget,
XmNbackground, itemColors[wxBACK_INDEX].pixel,
XmNtopShadowColor, itemColors[wxTOPS_INDEX].pixel,
XmNbottomShadowColor, itemColors[wxBOTS_INDEX].pixel,
XmNforeground, itemColors[wxFORE_INDEX].pixel,
NULL);
else if (change == wxFORE_COLORS)
XtVaSetValues (formWidget,
XmNforeground, itemColors[wxFORE_INDEX].pixel,
NULL);
change = wxComputeColors (XtDisplay((Widget)formWidget), GetBackgroundColour(), GetLabelColour());
if (change == wxBACK_COLORS)
XtVaSetValues (labelWidget,
XmNbackground, itemColors[wxBACK_INDEX].pixel,
XmNtopShadowColor, itemColors[wxTOPS_INDEX].pixel,
XmNbottomShadowColor, itemColors[wxBOTS_INDEX].pixel,
XmNarmColor, itemColors[wxSELE_INDEX].pixel,
XmNforeground, itemColors[wxFORE_INDEX].pixel,
NULL);
else if (change == wxFORE_COLORS)
XtVaSetValues (labelWidget,
XmNforeground, itemColors[wxFORE_INDEX].pixel,
NULL);
#endif
XmNarmColor, g_itemColors[wxSELE_INDEX].pixel,
NULL);
}
void wxWindow::ChangeFont(WXWidget widget)
void wxWindow::SetBackgroundColour(const wxColour& col)
{
/*
if (widget && GetFont() && GetFont()->Ok())
{
XmFontList fontList = (XmFontList) GetFont()->GetFontList(1.0, GetXDisplay());
if (fontList)
XtVaSetValues ((Widget) widget,
XmNfontList, fontList,
NULL);
}
*/
m_backgroundColour = col;
ChangeBackgroundColour();
}
void wxWindow::SetForegroundColour(const wxColour& col)
{
m_foregroundColour = col;
ChangeForegroundColour();
}
void wxWindow::ChangeFont()
{
// Note that this causes the widget to be resized back
// 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
if (w && m_windowFont.Ok())
{
int width, height, width1, height1;
GetSize(& width, & height);
XtVaSetValues (w,
XmNfontList, (XmFontList) m_windowFont.GetFontList(1.0, XtDisplay(w)),
NULL);
GetSize(& width1, & height1);
if (width != width1 || height != height1)
{
SetSize(-1, -1, width, height);
}
}
*/
}
void wxWindow::SetFont(const wxFont& font)
{
m_windowFont = font;
ChangeFont();
}