my wxMotif fixes (merged with Robert's changes), wxMotif compiles, links

and runs... until you click in the menu, that is.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2929 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1999-06-29 12:34:18 +00:00
parent a641505f0d
commit dfe1eee3bb
28 changed files with 782 additions and 751 deletions

View File

@@ -1,3 +1,14 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/dialog.h
// Purpose: wxDialogBase class
// Author: Vadim Zeitlin
// Modified by:
// Created: 29.06.99
// RCS-ID: $Id$
// Copyright: (c) Vadim Zeitlin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DIALOG_H_BASE_ #ifndef _WX_DIALOG_H_BASE_
#define _WX_DIALOG_H_BASE_ #define _WX_DIALOG_H_BASE_
@@ -6,6 +17,12 @@
class WXDLLEXPORT wxDialogBase : public wxPanel class WXDLLEXPORT wxDialogBase : public wxPanel
{ {
public:
// the modal dialogs have a return code - usually the id of the last
// pressed button
void SetReturnCode(int returnCode) { m_returnCode = returnCode; }
int GetReturnCode() const { return m_returnCode; }
protected: protected:
// functions to help with dialog layout // functions to help with dialog layout
// ------------------------------------ // ------------------------------------
@@ -43,6 +60,9 @@ protected:
// as the height of just text which may be retrieved from // as the height of just text which may be retrieved from
// wxGetCharHeight()) // wxGetCharHeight())
long GetStandardTextHeight(); long GetStandardTextHeight();
// the return code from modal dialog
int m_returnCode;
}; };
#if defined(__WXMSW__) #if defined(__WXMSW__)

View File

@@ -2,8 +2,9 @@
// Name: gridg.h // Name: gridg.h
// Purpose: wxGenericGrid // Purpose: wxGenericGrid
// Author: Julian Smart // Author: Julian Smart
// Modified by: Michael Bedward 20 April 1999 // Modified by: Michael Bedward
// Added edit in place facility // Added edit in place facility, 20 April 1999
// Added cursor key control, 29 Jun 1999
// Created: 01/02/97 // Created: 01/02/97
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) // Copyright: (c)
@@ -226,7 +227,9 @@ public:
void OnMouseEvent(wxMouseEvent& event); void OnMouseEvent(wxMouseEvent& event);
void OnSize(wxSizeEvent& event); void OnSize(wxSizeEvent& event);
void OnText(wxCommandEvent& ev); void OnText(wxCommandEvent& ev);
void OnTextEnter(wxCommandEvent& ev);
void OnTextInPlace(wxCommandEvent& ev); void OnTextInPlace(wxCommandEvent& ev);
void OnTextInPlaceEnter(wxCommandEvent& ev);
void OnGridScroll(wxScrollEvent& ev); void OnGridScroll(wxScrollEvent& ev);
protected: protected:

View File

@@ -20,6 +20,8 @@
#include "wx/dialog.h" #include "wx/dialog.h"
class WXDLLEXPORT wxTextCtrl;
// Handy dialog functions (will be converted into classes at some point) // Handy dialog functions (will be converted into classes at some point)
WXDLLEXPORT_DATA(extern const wxChar*) wxGetTextFromUserPromptStr; WXDLLEXPORT_DATA(extern const wxChar*) wxGetTextFromUserPromptStr;
WXDLLEXPORT_DATA(extern const wxChar*) wxEmptyString; WXDLLEXPORT_DATA(extern const wxChar*) wxEmptyString;

View File

@@ -87,9 +87,6 @@ public:
virtual void Maximize() { } virtual void Maximize() { }
virtual void Restore() { } virtual void Restore() { }
void SetReturnCode(int returnCode) { m_returnCode = returnCode; }
int GetReturnCode() const { return m_returnCode; }
// implementation // implementation
virtual void GtkOnSize( int x, int y, int width, int height ); virtual void GtkOnSize( int x, int y, int width, int height );
@@ -108,8 +105,6 @@ protected:
int sizeFlags = wxSIZE_AUTO); int sizeFlags = wxSIZE_AUTO);
private: private:
int m_returnCode;
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };

View File

@@ -87,9 +87,6 @@ public:
virtual void Maximize() { } virtual void Maximize() { }
virtual void Restore() { } virtual void Restore() { }
void SetReturnCode(int returnCode) { m_returnCode = returnCode; }
int GetReturnCode() const { return m_returnCode; }
// implementation // implementation
virtual void GtkOnSize( int x, int y, int width, int height ); virtual void GtkOnSize( int x, int y, int width, int height );
@@ -108,8 +105,6 @@ protected:
int sizeFlags = wxSIZE_AUTO); int sizeFlags = wxSIZE_AUTO);
private: private:
int m_returnCode;
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };

View File

@@ -9,7 +9,7 @@
// Created: 17/09/98 // Created: 17/09/98
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) Julian Smart // Copyright: (c) Julian Smart
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifndef _WX_CLIPBRD_H_ #ifndef _WX_CLIPBRD_H_
@@ -20,11 +20,11 @@
#endif #endif
#include "wx/defs.h" #include "wx/defs.h"
#include "wx/setup.h"
#if wxUSE_CLIPBOARD
#include "wx/dataobj.h" #include "wx/dataobj.h"
#include "wx/list.h"
#include "wx/module.h" #include "wx/module.h"
bool WXDLLEXPORT wxOpenClipboard(); bool WXDLLEXPORT wxOpenClipboard();
@@ -170,5 +170,7 @@ WXDLLEXPORT_DATA(extern wxClipboard*) wxTheClipboard;
#endif #endif
// Old clipboard class // Old clipboard class
#endif // wxUSE_CLIPBOARD
#endif #endif
// _WX_CLIPBRD_H_ // _WX_CLIPBRD_H_

View File

@@ -6,22 +6,20 @@
// Created: 17/09/98 // Created: 17/09/98
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) Julian Smart // Copyright: (c) Julian Smart
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DIALOG_H_ #ifndef _WX_DIALOG_H_
#define _WX_DIALOG_H_ #define _WX_DIALOG_H_
#ifdef __GNUG__ #ifdef __GNUG__
#pragma interface "dialog.h" #pragma interface "dialog.h"
#endif #endif
#include "wx/panel.h"
WXDLLEXPORT_DATA(extern const char*) wxDialogNameStr; WXDLLEXPORT_DATA(extern const char*) wxDialogNameStr;
// Dialog boxes // Dialog boxes
class WXDLLEXPORT wxDialog : public wxPanel class WXDLLEXPORT wxDialog : public wxDialogBase
{ {
DECLARE_DYNAMIC_CLASS(wxDialog) DECLARE_DYNAMIC_CLASS(wxDialog)
@@ -67,35 +65,18 @@ public:
void Lower(); void Lower();
virtual bool IsIconized() const; virtual bool IsIconized() const;
void Fit();
void SetTitle(const wxString& title); void SetTitle(const wxString& title);
wxString GetTitle() const ; wxString GetTitle() const ;
// bool OnClose();
void OnCharHook(wxKeyEvent& event);
void OnCloseWindow(wxCloseEvent& event);
void SetModal(bool flag); void SetModal(bool flag);
virtual void Centre(int direction = wxBOTH); virtual bool IsModal() const
virtual bool IsModal() const { return ((GetWindowStyleFlag() & wxDIALOG_MODAL) == wxDIALOG_MODAL); } { return ((GetWindowStyleFlag() & wxDIALOG_MODAL) == wxDIALOG_MODAL); }
virtual int ShowModal(); virtual int ShowModal();
virtual void EndModal(int retCode); virtual void EndModal(int retCode);
void SetReturnCode(int returnCode) { m_returnCode = returnCode; }
int GetReturnCode() const { return m_returnCode; }
// Standard buttons
void OnOK(wxCommandEvent& event);
void OnApply(wxCommandEvent& event);
void OnCancel(wxCommandEvent& event);
void OnPaint(wxPaintEvent &event);
// Responds to colour changes
void OnSysColourChanged(wxSysColourChangedEvent& event);
// Implementation // Implementation
virtual void ChangeFont(bool keepOriginalSize = TRUE); virtual void ChangeFont(bool keepOriginalSize = TRUE);
virtual void ChangeBackgroundColour(); virtual void ChangeBackgroundColour();
@@ -103,11 +84,24 @@ public:
inline WXWidget GetTopWidget() const { return m_mainWidget; } inline WXWidget GetTopWidget() const { return m_mainWidget; }
inline WXWidget GetClientWidget() const { return m_mainWidget; } inline WXWidget GetClientWidget() const { return m_mainWidget; }
// Standard buttons
void OnOK(wxCommandEvent& event);
void OnApply(wxCommandEvent& event);
void OnCancel(wxCommandEvent& event);
void OnPaint(wxPaintEvent &event);
// Responds to colour changes
void OnSysColourChanged(wxSysColourChangedEvent& event);
// bool OnClose();
void OnCharHook(wxKeyEvent& event);
void OnCloseWindow(wxCloseEvent& event);
public: public:
//// Motif-specific //// Motif-specific
bool m_modalShowing; bool m_modalShowing;
wxString m_dialogTitle; wxString m_dialogTitle;
int m_returnCode;
protected: protected:
virtual void DoSetSize(int x, int y, virtual void DoSetSize(int x, int y,

View File

@@ -173,6 +173,10 @@ public:
void ClearUpdateRegion() { m_updateRegion.Clear(); } void ClearUpdateRegion() { m_updateRegion.Clear(); }
void SetUpdateRegion(const wxRegion& region) { m_updateRegion = region; } void SetUpdateRegion(const wxRegion& region) { m_updateRegion = region; }
// sets the fore/background colour for the given widget
static void DoChangeForegroundColour(WXWidget widget, wxColour& foregroundColour);
static void DoChangeBackgroundColour(WXWidget widget, wxColour& backgroundColour, bool changeArmColour = FALSE);
protected: protected:
// event handlers (not virtual by design) // event handlers (not virtual by design)
void OnIdle(wxIdleEvent& event); void OnIdle(wxIdleEvent& event);
@@ -212,8 +216,6 @@ protected:
public: public:
// Change properties // Change properties
virtual void ChangeFont(bool keepOriginalSize = TRUE); // Change to the current font (often overridden) virtual void ChangeFont(bool keepOriginalSize = TRUE); // Change to the current font (often overridden)
virtual void DoChangeForegroundColour(WXWidget widget, wxColour& foregroundColour);
virtual void DoChangeBackgroundColour(WXWidget widget, wxColour& backgroundColour, bool changeArmColour = FALSE);
// Change background and foreground colour using current background colour // Change background and foreground colour using current background colour
// setting (Motif generates foreground based on background) // setting (Motif generates foreground based on background)

View File

@@ -60,9 +60,6 @@ public:
~wxDialog(); ~wxDialog();
void SetReturnCode(int returnCode) { m_returnCode = returnCode; }
int GetReturnCode() const { return m_returnCode; }
virtual bool Destroy(); virtual bool Destroy();
virtual void DoSetClientSize(int width, int height); virtual void DoSetClientSize(int width, int height);
@@ -132,8 +129,7 @@ private:
WXHWND m_hwndToolTip; WXHWND m_hwndToolTip;
#endif // tooltips #endif // tooltips
int m_returnCode; private:
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };

View File

@@ -2,38 +2,40 @@
// Name: gridg.cpp // Name: gridg.cpp
// Purpose: wxGenericGrid // Purpose: wxGenericGrid
// Author: Julian Smart // Author: Julian Smart
// Modified by: Michael Bedward 20 Apr 1999 // Modified by: Michael Bedward
// Added edit in place facility // Added edit in place facility, 20 Apr 1999
// Added cursor key control, 29 Jun 1999
// Created: 04/01/98 // Created: 04/01/98
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) Julian Smart and Markus Holzem // Copyright: (c) Julian Smart and Markus Holzem
// Licence: wxWindows license // Licence: wxWindows license
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation "gridg.h" #pragma implementation "gridg.h"
#pragma interface #pragma interface
#endif #endif
// For compilers that support precompilation, includes "wx/wx.h". // For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h" #include "wx/wxprec.h"
#ifdef __BORLANDC__ #ifdef __BORLANDC__
#pragma hdrstop #pragma hdrstop
#endif #endif
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/utils.h" #include "wx/utils.h"
#include "wx/dcclient.h" #include "wx/dcclient.h"
#include "wx/dcmemory.h" #include "wx/dcmemory.h"
#include "wx/textctrl.h" #include "wx/textctrl.h"
#include "wx/settings.h"
#endif #endif
#include <string.h> #include <string.h>
#include "wx/string.h" #include "wx/string.h"
#include "wx/generic/gridg.h" #include "wx/generic/gridg.h"
#include "wx/settings.h"
// Set to zero to use no double-buffering // Set to zero to use no double-buffering
#ifdef __WXMSW__ #ifdef __WXMSW__
@@ -56,6 +58,8 @@ BEGIN_EVENT_TABLE(wxGenericGrid, wxPanel)
EVT_MOUSE_EVENTS(wxGenericGrid::OnMouseEvent) EVT_MOUSE_EVENTS(wxGenericGrid::OnMouseEvent)
EVT_TEXT(wxGRID_TEXT_CTRL, wxGenericGrid::OnText) EVT_TEXT(wxGRID_TEXT_CTRL, wxGenericGrid::OnText)
EVT_TEXT(wxGRID_EDIT_IN_PLACE_TEXT_CTRL, wxGenericGrid::OnTextInPlace) EVT_TEXT(wxGRID_EDIT_IN_PLACE_TEXT_CTRL, wxGenericGrid::OnTextInPlace)
EVT_TEXT_ENTER(wxGRID_TEXT_CTRL, wxGenericGrid::OnTextEnter)
EVT_TEXT_ENTER(wxGRID_EDIT_IN_PLACE_TEXT_CTRL, wxGenericGrid::OnTextInPlaceEnter)
EVT_COMMAND_SCROLL(wxGRID_HSCROLL, wxGenericGrid::OnGridScroll) EVT_COMMAND_SCROLL(wxGRID_HSCROLL, wxGenericGrid::OnGridScroll)
EVT_COMMAND_SCROLL(wxGRID_VSCROLL, wxGenericGrid::OnGridScroll) EVT_COMMAND_SCROLL(wxGRID_VSCROLL, wxGenericGrid::OnGridScroll)
@@ -215,7 +219,7 @@ bool wxGenericGrid::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos,
m_textItem = new wxTextCtrl(m_editingPanel, wxGRID_TEXT_CTRL, "", m_textItem = new wxTextCtrl(m_editingPanel, wxGRID_TEXT_CTRL, "",
wxPoint(m_editControlPosition.x, m_editControlPosition.y), wxPoint(m_editControlPosition.x, m_editControlPosition.y),
wxSize(m_editControlPosition.width, -1), wxSize(m_editControlPosition.width, -1),
0); wxTE_PROCESS_ENTER);
m_textItem->Show(TRUE); m_textItem->Show(TRUE);
m_textItem->SetFocus(); m_textItem->SetFocus();
int controlW, controlH; int controlW, controlH;
@@ -233,9 +237,9 @@ bool wxGenericGrid::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos,
// SetSize(pos.x, pos.y, size.x, size.y); // SetSize(pos.x, pos.y, size.x, size.y);
m_inPlaceTextItem = new wxTextCtrl( (wxPanel*)this, wxGRID_EDIT_IN_PLACE_TEXT_CTRL, "", m_inPlaceTextItem = new wxTextCtrl( (wxPanel*)this, wxGRID_EDIT_IN_PLACE_TEXT_CTRL, "",
wxPoint( m_currentRect.x-2, m_currentRect.y-2 ), wxPoint( m_currentRect.x-2, m_currentRect.y-2 ),
wxSize( m_currentRect.width+4, m_currentRect.height+4 ), wxSize( m_currentRect.width+4, m_currentRect.height+4 ),
wxNO_BORDER ); wxNO_BORDER | wxTE_PROCESS_ENTER );
m_inPlaceTextItem->Show(TRUE); m_inPlaceTextItem->Show(TRUE);
m_inPlaceTextItem->SetFocus(); m_inPlaceTextItem->SetFocus();
@@ -800,8 +804,8 @@ void wxGenericGrid::DrawColumnLabel(wxDC *dc, wxRect *rect, int col)
rect2.height -= 4; rect2.height -= 4;
dc->SetTextForeground(GetLabelTextColour()); dc->SetTextForeground(GetLabelTextColour());
dc->SetFont(GetLabelTextFont()); dc->SetFont(GetLabelTextFont());
if ( !cell->GetTextValue().IsNull() ) if ( !cell->GetTextValue().IsNull() )
DrawTextRect(dc, cell->GetTextValue(), &rect2, GetLabelAlignment(wxHORIZONTAL)); DrawTextRect(dc, cell->GetTextValue(), &rect2, GetLabelAlignment(wxHORIZONTAL));
} }
} }
@@ -853,8 +857,8 @@ void wxGenericGrid::DrawRowLabel(wxDC *dc, wxRect *rect, int row)
rect2.height -= 4; rect2.height -= 4;
dc->SetTextForeground(GetLabelTextColour()); dc->SetTextForeground(GetLabelTextColour());
dc->SetFont(GetLabelTextFont()); dc->SetFont(GetLabelTextFont());
if ( !cell->GetTextValue().IsNull() ) if ( !cell->GetTextValue().IsNull() )
DrawTextRect(dc, cell->GetTextValue(), &rect2, GetLabelAlignment(wxVERTICAL)); DrawTextRect(dc, cell->GetTextValue(), &rect2, GetLabelAlignment(wxVERTICAL));
} }
} }
@@ -931,8 +935,8 @@ void wxGenericGrid::DrawCellValue(wxDC *dc, wxRect *rect, int row, int col)
dc->SetTextForeground(cell->GetTextColour()); dc->SetTextForeground(cell->GetTextColour());
dc->SetFont(cell->GetFont()); dc->SetFont(cell->GetFont());
if ( !cell->GetTextValue().IsNull() ) if ( !cell->GetTextValue().IsNull() )
DrawTextRect(dc, cell->GetTextValue(), &rect2, cell->GetAlignment()); DrawTextRect(dc, cell->GetTextValue(), &rect2, cell->GetAlignment());
} }
} }
} }
@@ -970,16 +974,16 @@ void wxGenericGrid::AdjustScrollbars(void)
int widthCount = 0; int widthCount = 0;
int i; int i;
int nx = 0; int nx = 0;
for (i = m_scrollPosX ; i < m_totalCols; i++) for (i = m_scrollPosX ; i < m_totalCols; i++)
{ {
widthCount += m_colWidths[i]; widthCount += m_colWidths[i];
// A partial bit doesn't count, we still have to scroll to see the // A partial bit doesn't count, we still have to scroll to see the
// rest of it // rest of it
if (widthCount + m_leftOfSheet + m_verticalLabelWidth > (cw-vertScrollBarWidth)) if (widthCount + m_leftOfSheet + m_verticalLabelWidth > (cw-vertScrollBarWidth))
break; break;
else else
nx ++; nx ++;
} }
@@ -993,16 +997,16 @@ void wxGenericGrid::AdjustScrollbars(void)
int heightCount = 0; int heightCount = 0;
int i; int i;
int ny = 0; int ny = 0;
for (i = m_scrollPosY ; i < m_totalRows; i++) for (i = m_scrollPosY ; i < m_totalRows; i++)
{ {
heightCount += m_rowHeights[i]; heightCount += m_rowHeights[i];
// A partial bit doesn't count, we still have to scroll to see the // A partial bit doesn't count, we still have to scroll to see the
// rest of it // rest of it
if (heightCount + m_topOfSheet + m_horizontalLabelHeight > (ch-horizScrollBarHeight)) if (heightCount + m_topOfSheet + m_horizontalLabelHeight > (ch-horizScrollBarHeight))
break; break;
else else
ny ++; ny ++;
} }
noVertSteps += ny; noVertSteps += ny;
@@ -1010,8 +1014,8 @@ void wxGenericGrid::AdjustScrollbars(void)
if (m_totalGridWidth + vertScrollBarWidth <= cw) if (m_totalGridWidth + vertScrollBarWidth <= cw)
{ {
if ( m_hScrollBar ) if ( m_hScrollBar )
m_hScrollBar->Show(FALSE); m_hScrollBar->Show(FALSE);
SetScrollPosX(0); SetScrollPosX(0);
} }
else else
@@ -1068,7 +1072,7 @@ void wxGenericGrid::AdjustScrollbars(void)
void wxGenericGrid::OnSize(wxSizeEvent& WXUNUSED(event) ) void wxGenericGrid::OnSize(wxSizeEvent& WXUNUSED(event) )
{ {
if (!m_vScrollBar || !m_hScrollBar) if (!m_vScrollBar || !m_hScrollBar)
return; return;
AdjustScrollbars(); AdjustScrollbars();
@@ -1350,7 +1354,7 @@ void wxGenericGrid::OnMouseEvent(wxMouseEvent& ev)
SetCursor(*wxSTANDARD_CURSOR); SetCursor(*wxSTANDARD_CURSOR);
int cw, ch; int cw, ch;
GetClientSize(&cw, &ch); GetClientSize(&cw, &ch);
wxSizeEvent evt; wxSizeEvent evt;
OnSize(evt); OnSize(evt);
break; break;
} }
@@ -1423,10 +1427,10 @@ void wxGenericGrid::OnSelectCellImplementation(wxDC *dc, int row, int col)
wxGridCell *cell = GetCell(m_wCursorRow, m_wCursorColumn); wxGridCell *cell = GetCell(m_wCursorRow, m_wCursorColumn);
if (cell) if (cell)
{ {
if ( cell->GetTextValue().IsNull() ) if ( cell->GetTextValue().IsNull() )
m_textItem->SetValue(""); m_textItem->SetValue("");
else else
m_textItem->SetValue(cell->GetTextValue()); m_textItem->SetValue(cell->GetTextValue());
} }
SetGridClippingRegion(dc); SetGridClippingRegion(dc);
@@ -1435,20 +1439,20 @@ void wxGenericGrid::OnSelectCellImplementation(wxDC *dc, int row, int col)
if ( m_editable && m_editInPlace ) if ( m_editable && m_editInPlace )
{ {
m_inPlaceTextItem->SetSize( m_currentRect.x-2, m_currentRect.y-2, m_inPlaceTextItem->SetSize( m_currentRect.x-2, m_currentRect.y-2,
m_currentRect.width+4, m_currentRect.height+4 ); m_currentRect.width+4, m_currentRect.height+4 );
if ( cell ) if ( cell )
{ {
if ( cell->GetTextValue().IsNull() ) if ( cell->GetTextValue().IsNull() )
{ {
m_inPlaceTextItem->SetValue( "" ); m_inPlaceTextItem->SetValue( "" );
} }
else else
{ {
m_inPlaceTextItem->SetFont( cell->GetFont() ); m_inPlaceTextItem->SetFont( cell->GetFont() );
m_inPlaceTextItem->SetValue( cell->GetTextValue() ); m_inPlaceTextItem->SetValue( cell->GetTextValue() );
} }
} }
m_inPlaceTextItem->Show(TRUE); m_inPlaceTextItem->Show(TRUE);
m_inPlaceTextItem->SetFocus(); m_inPlaceTextItem->SetFocus();
@@ -1529,22 +1533,22 @@ void wxGenericGrid::HighlightCell(wxDC *dc)
dc->DrawLine( m_currentRect.x + 1, dc->DrawLine( m_currentRect.x + 1,
m_currentRect.y + 1, m_currentRect.y + 1,
m_currentRect.x + m_currentRect.width - 1, m_currentRect.x + m_currentRect.width - 1,
m_currentRect.y + 1); m_currentRect.y + 1);
// Right // Right
dc->DrawLine( m_currentRect.x + m_currentRect.width - 1, dc->DrawLine( m_currentRect.x + m_currentRect.width - 1,
m_currentRect.y + 1, m_currentRect.y + 1,
m_currentRect.x + m_currentRect.width - 1, m_currentRect.x + m_currentRect.width - 1,
m_currentRect.y +m_currentRect.height - 1 ); m_currentRect.y +m_currentRect.height - 1 );
// Bottom // Bottom
dc->DrawLine( m_currentRect.x + m_currentRect.width - 1, dc->DrawLine( m_currentRect.x + m_currentRect.width - 1,
m_currentRect.y + m_currentRect.height - 1, m_currentRect.y + m_currentRect.height - 1,
m_currentRect.x + 1, m_currentRect.x + 1,
m_currentRect.y + m_currentRect.height - 1); m_currentRect.y + m_currentRect.height - 1);
// Left // Left
dc->DrawLine( m_currentRect.x + 1, dc->DrawLine( m_currentRect.x + 1,
m_currentRect.y + m_currentRect.height - 1, m_currentRect.y + m_currentRect.height - 1,
m_currentRect.x + 1, m_currentRect.x + 1,
m_currentRect.y + 1); m_currentRect.y + 1);
dc->SetLogicalFunction(wxCOPY); dc->SetLogicalFunction(wxCOPY);
} }
@@ -2011,8 +2015,8 @@ void wxGenericGrid::SetEditable(bool edit)
if (m_inPlaceTextItem) if (m_inPlaceTextItem)
{ {
m_inPlaceTextItem->Show(TRUE); m_inPlaceTextItem->Show(TRUE);
m_inPlaceTextItem->SetFocus(); m_inPlaceTextItem->SetFocus();
} }
} }
else else
@@ -2026,7 +2030,7 @@ void wxGenericGrid::SetEditable(bool edit)
if ( m_inPlaceTextItem ) if ( m_inPlaceTextItem )
{ {
m_inPlaceTextItem->Show(FALSE); m_inPlaceTextItem->Show(FALSE);
} }
} }
UpdateDimensions(); UpdateDimensions();
@@ -2055,35 +2059,35 @@ void wxGenericGrid::SetEditInPlace(bool edit)
m_editInPlace = edit; m_editInPlace = edit;
if ( m_editInPlace ) // switched on if ( m_editInPlace ) // switched on
{ {
if ( m_currentRectVisible && m_editable ) if ( m_currentRectVisible && m_editable )
{ {
m_inPlaceTextItem->SetSize( m_currentRect.x-2, m_currentRect.y-2, m_inPlaceTextItem->SetSize( m_currentRect.x-2, m_currentRect.y-2,
m_currentRect.width+4, m_currentRect.height+4 ); m_currentRect.width+4, m_currentRect.height+4 );
wxGridCell *cell = GetCell(m_wCursorRow, m_wCursorColumn); wxGridCell *cell = GetCell(m_wCursorRow, m_wCursorColumn);
if ( cell ) if ( cell )
{ {
if ( cell->GetTextValue().IsNull() ) if ( cell->GetTextValue().IsNull() )
{ {
m_inPlaceTextItem->SetValue( "" ); m_inPlaceTextItem->SetValue( "" );
} }
else else
{ {
m_inPlaceTextItem->SetFont( cell->GetFont() ); m_inPlaceTextItem->SetFont( cell->GetFont() );
m_inPlaceTextItem->SetValue( cell->GetTextValue() ); m_inPlaceTextItem->SetValue( cell->GetTextValue() );
} }
} }
m_inPlaceTextItem->Show( TRUE ); m_inPlaceTextItem->Show( TRUE );
m_inPlaceTextItem->SetFocus(); m_inPlaceTextItem->SetFocus();
} }
} }
else // switched off else // switched off
{ {
m_inPlaceTextItem->Show( FALSE ); m_inPlaceTextItem->Show( FALSE );
} }
} }
} }
@@ -2558,30 +2562,49 @@ void wxGenericGrid::OnText(wxCommandEvent& WXUNUSED(ev) )
wxGenericGrid *grid = this; wxGenericGrid *grid = this;
wxGridCell *cell = grid->GetCell(grid->GetCursorRow(), grid->GetCursorColumn()); wxGridCell *cell = grid->GetCell(grid->GetCursorRow(), grid->GetCursorColumn());
if (cell && grid->CurrentCellVisible()) if (cell && grid->CurrentCellVisible())
{ {
cell->SetTextValue(grid->GetTextItem()->GetValue()); cell->SetTextValue(grid->GetTextItem()->GetValue());
if ( m_editInPlace && !m_inOnTextInPlace ) if ( m_editInPlace && !m_inOnTextInPlace )
{ {
m_inPlaceTextItem->SetValue( grid->GetTextItem()->GetValue() ); m_inPlaceTextItem->SetValue( grid->GetTextItem()->GetValue() );
} }
wxClientDC dc(grid); wxClientDC dc(grid);
dc.BeginDrawing(); dc.BeginDrawing();
grid->SetGridClippingRegion(& dc); grid->SetGridClippingRegion(& dc);
grid->DrawCellBackground(& dc, &grid->GetCurrentRect(), grid->GetCursorRow(), grid->GetCursorColumn()); grid->DrawCellBackground(& dc, &grid->GetCurrentRect(), grid->GetCursorRow(), grid->GetCursorColumn());
grid->DrawCellValue(& dc, &grid->GetCurrentRect(), grid->GetCursorRow(), grid->GetCursorColumn()); grid->DrawCellValue(& dc, &grid->GetCurrentRect(), grid->GetCursorRow(), grid->GetCursorColumn());
if ( !(m_editable && m_editInPlace ) ) grid->HighlightCell(& dc); if ( !(m_editable && m_editInPlace ) ) grid->HighlightCell(& dc);
dc.DestroyClippingRegion(); dc.DestroyClippingRegion();
dc.EndDrawing(); dc.EndDrawing();
//grid->OnCellChange(grid->GetCursorRow(), grid->GetCursorColumn()); //grid->OnCellChange(grid->GetCursorRow(), grid->GetCursorColumn());
wxGridEvent g_evt(GetId(), wxEVT_GRID_CELL_CHANGE, grid, wxGridEvent g_evt(GetId(), wxEVT_GRID_CELL_CHANGE, grid,
grid->GetCursorRow(), grid->GetCursorColumn()); grid->GetCursorRow(), grid->GetCursorColumn());
GetEventHandler()->ProcessEvent(g_evt); GetEventHandler()->ProcessEvent(g_evt);
// grid->DrawCellText(); // grid->DrawCellText();
} }
}
}
void wxGenericGrid::OnTextEnter(wxCommandEvent& WXUNUSED(ev) )
{
// move the cursor down the current row (if possible)
// when the enter key has been pressed
//
if ( m_editable )
{
if ( GetCursorRow() < GetRows()-1 )
{
wxClientDC dc( this );
dc.BeginDrawing();
OnSelectCellImplementation(& dc,
GetCursorRow()+1,
GetCursorColumn() );
dc.EndDrawing();
}
} }
} }
@@ -2592,12 +2615,31 @@ void wxGenericGrid::OnTextInPlace(wxCommandEvent& ev )
wxGenericGrid *grid = this; wxGenericGrid *grid = this;
wxGridCell *cell = grid->GetCell(grid->GetCursorRow(), grid->GetCursorColumn()); wxGridCell *cell = grid->GetCell(grid->GetCursorRow(), grid->GetCursorColumn());
if (cell && grid->CurrentCellVisible()) if (cell && grid->CurrentCellVisible())
{ {
m_inOnTextInPlace = TRUE; m_inOnTextInPlace = TRUE;
grid->GetTextItem()->SetValue( m_inPlaceTextItem->GetValue() ); grid->GetTextItem()->SetValue( m_inPlaceTextItem->GetValue() );
OnText( ev ); OnText( ev );
m_inOnTextInPlace = FALSE; m_inOnTextInPlace = FALSE;
} }
}
}
void wxGenericGrid::OnTextInPlaceEnter(wxCommandEvent& WXUNUSED(ev) )
{
// move the cursor down the current row (if possible)
// when the enter key has been pressed
//
if ( m_editable )
{
if ( GetCursorRow() < GetRows()-1 )
{
wxClientDC dc( this );
dc.BeginDrawing();
OnSelectCellImplementation(& dc,
GetCursorRow()+1,
GetCursorColumn() );
dc.EndDrawing();
}
} }
} }
@@ -2606,7 +2648,7 @@ void wxGenericGrid::OnGridScroll(wxScrollEvent& ev)
static bool inScroll = FALSE; static bool inScroll = FALSE;
if ( inScroll ) if ( inScroll )
return; return;
if ( m_editInPlace ) m_inPlaceTextItem->Show(FALSE); if ( m_editInPlace ) m_inPlaceTextItem->Show(FALSE);
@@ -2640,7 +2682,7 @@ void wxGenericGrid::OnGridScroll(wxScrollEvent& ev)
if ( m_editInPlace && m_currentRectVisible ) if ( m_editInPlace && m_currentRectVisible )
{ {
m_inPlaceTextItem->SetSize( m_currentRect.x-2, m_currentRect.y-2, m_inPlaceTextItem->SetSize( m_currentRect.x-2, m_currentRect.y-2,
m_currentRect.width+4, m_currentRect.height+4 ); m_currentRect.width+4, m_currentRect.height+4 );
m_inPlaceTextItem->Show( TRUE ); m_inPlaceTextItem->Show( TRUE );
m_inPlaceTextItem->SetFocus(); m_inPlaceTextItem->SetFocus();
} }

View File

@@ -28,8 +28,7 @@
#include "wx/statbmp.h" #include "wx/statbmp.h"
#include "wx/layout.h" #include "wx/layout.h"
#include "wx/intl.h" #include "wx/intl.h"
#include "wx/dcclient.h" #include "wx/icon.h"
#include "wx/settings.h"
#endif #endif
#include <stdio.h> #include <stdio.h>
@@ -169,11 +168,11 @@ wxGenericMessageDialog::wxGenericMessageDialog( wxWindow *parent,
// get the longest caption and also calc the number of buttons // get the longest caption and also calc the number of buttons
size_t nBtn, nButtons = 0; size_t nBtn, nButtons = 0;
long width, widthBtnMax = 0; int width, widthBtnMax = 0;
for ( nBtn = 0; nBtn < Btn_Max; nBtn++ ) { for ( nBtn = 0; nBtn < Btn_Max; nBtn++ ) {
if ( buttons[nBtn] ) { if ( buttons[nBtn] ) {
nButtons++; nButtons++;
dc.GetTextExtent(buttons[nBtn]->GetLabel(), &width, NULL); GetTextExtent(buttons[nBtn]->GetLabel(), &width, NULL);
if ( width > widthBtnMax ) if ( width > widthBtnMax )
widthBtnMax = width; widthBtnMax = width;
} }

View File

@@ -18,7 +18,7 @@
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation "windowbase.h" #pragma implementation "tipdlg.h"
#endif #endif
// For compilers that support precompilation, includes "wx.h". // For compilers that support precompilation, includes "wx.h".
@@ -36,6 +36,11 @@
#include "wx/statbox.h" #include "wx/statbox.h"
#include "wx/statbmp.h" #include "wx/statbmp.h"
#include "wx/dialog.h" #include "wx/dialog.h"
#include "wx/icon.h"
#include "wx/intl.h"
#include "wx/layout.h"
#include "wx/settings.h"
#include "wx/textctrl.h"
#endif // WX_PRECOMP #endif // WX_PRECOMP
#include "wx/statline.h" #include "wx/statline.h"
@@ -175,7 +180,7 @@ wxTipDialog::wxTipDialog(wxWindow *parent,
wxIcon icon("wxICON_TIP"); wxIcon icon("wxICON_TIP");
#else #else
#include "wx/generic/tip.xpm" #include "wx/generic/tip.xpm"
wxIcon icon(info); wxIcon icon(tipIcon);
#endif #endif
wxStaticBitmap *bmp = new wxStaticBitmap(this, -1, icon); wxStaticBitmap *bmp = new wxStaticBitmap(this, -1, icon);

View File

@@ -14,8 +14,6 @@ LIBS = $(GUILIBS)
VPATH = .:${srcdir}:${srcdir}/../common:${srcdir}/../generic:${EXTRA_VPATH} VPATH = .:${srcdir}:${srcdir}/../common:${srcdir}/../generic:${EXTRA_VPATH}
EXTRA_DIST = "${srcdir}/../common ${srcdir}/../generic ${srcdir}"
lib_LTLIBRARIES = @WX_LIBRARY_NAME@ lib_LTLIBRARIES = @WX_LIBRARY_NAME@
EXTRA_LTLIBRARIES = libwx_gtk.la libwx_motif.la libwx_msw.la EXTRA_LTLIBRARIES = libwx_gtk.la libwx_motif.la libwx_msw.la

View File

@@ -14,8 +14,6 @@ LIBS = $(GUILIBS)
VPATH = .:${srcdir}:${srcdir}/../common:${srcdir}/../generic:${EXTRA_VPATH} VPATH = .:${srcdir}:${srcdir}/../common:${srcdir}/../generic:${EXTRA_VPATH}
EXTRA_DIST = "${srcdir}/../common ${srcdir}/../generic ${srcdir}"
lib_LTLIBRARIES = @WX_LIBRARY_NAME@ lib_LTLIBRARIES = @WX_LIBRARY_NAME@
EXTRA_LTLIBRARIES = libwx_gtk.la libwx_motif.la libwx_msw.la EXTRA_LTLIBRARIES = libwx_gtk.la libwx_motif.la libwx_msw.la

View File

@@ -54,6 +54,7 @@ libwx_motif_la_SOURCES = \
db.cpp \ db.cpp \
dbtable.cpp \ dbtable.cpp \
dcbase.cpp \ dcbase.cpp \
dlgcmn.cpp \
docmdi.cpp \ docmdi.cpp \
docview.cpp \ docview.cpp \
dynlib.cpp \ dynlib.cpp \
@@ -129,6 +130,7 @@ libwx_motif_la_SOURCES = \
statusbr.cpp \ statusbr.cpp \
tabg.cpp \ tabg.cpp \
textdlgg.cpp \ textdlgg.cpp \
tipdlg.cpp \
treectrl.cpp \ treectrl.cpp \
\ \
threadpsx.cpp \ threadpsx.cpp \

View File

@@ -32,7 +32,7 @@
#include "wx/intl.h" #include "wx/intl.h"
#if wxUSE_THREADS #if wxUSE_THREADS
#include "wx/thread.h" #include "wx/thread.h"
#endif #endif
#if wxUSE_WX_RESOURCES #if wxUSE_WX_RESOURCES

View File

@@ -6,7 +6,7 @@
// Created: 17/09/98 // Created: 17/09/98
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) Julian Smart // Copyright: (c) Julian Smart
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__ #ifdef __GNUG__

View File

@@ -6,7 +6,7 @@
// Created: 17/09/98 // Created: 17/09/98
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) Julian Smart // Copyright: (c) Julian Smart
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__ #ifdef __GNUG__
@@ -15,6 +15,7 @@
#include "wx/button.h" #include "wx/button.h"
#include "wx/utils.h" #include "wx/utils.h"
#include "wx/panel.h"
#include <Xm/PushBG.h> #include <Xm/PushBG.h>
#include <Xm/PushB.h> #include <Xm/PushB.h>
@@ -88,12 +89,10 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label,
void wxButton::SetDefault() void wxButton::SetDefault()
{ {
wxWindow *parent = (wxWindow *)GetParent(); wxWindow *parent = GetParent();
/* wxPanel *panel = wxDynamicCast(panel, wxPanel);
TODO if ( panel )
if (parent) panel->SetDefaultItem(this);
parent->SetDefaultItem(this);
*/
// We initially do not set XmNdefaultShadowThickness, to have small buttons. // We initially do not set XmNdefaultShadowThickness, to have small buttons.
// Unfortunately, buttons are now mis-aligned. We try to correct this // Unfortunately, buttons are now mis-aligned. We try to correct this
@@ -117,7 +116,7 @@ void wxButton::SetDefault()
if (managed) if (managed)
XtManageChild ((Widget) item->GetMainWidget()); XtManageChild ((Widget) item->GetMainWidget());
} }
} // while } // while
// XtVaSetValues((Widget)handle, XmNshowAsDefault, 1, NULL); // XtVaSetValues((Widget)handle, XmNshowAsDefault, 1, NULL);
XtVaSetValues ((Widget) parent->GetMainWidget(), XmNdefaultButton, (Widget) GetMainWidget(), NULL); XtVaSetValues ((Widget) parent->GetMainWidget(), XmNdefaultButton, (Widget) GetMainWidget(), NULL);

View File

@@ -119,10 +119,11 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id,
// that I have found the code responsible for this behaviour. // that I have found the code responsible for this behaviour.
#if XmVersion >= 1002 #if XmVersion >= 1002
#if XmVersion < 2000 #if XmVersion < 2000
Widget optionLabel = XmOptionLabelGadget ((Widget) m_buttonWidget);
// JACS, 24/1/99: this seems to cause a malloc crash later on, e.g. // JACS, 24/1/99: this seems to cause a malloc crash later on, e.g.
// in controls sample. // in controls sample.
// XtUnmanageChild (optionLabel); //
// Widget optionLabel = XmOptionLabelGadget ((Widget) m_buttonWidget);
// XtUnmanageChild (optionLabel);
#endif #endif
#endif #endif

View File

@@ -14,6 +14,10 @@
#pragma implementation "clipbrd.h" #pragma implementation "clipbrd.h"
#endif #endif
#include "wx/defs.h"
#if wxUSE_CLIPBOARD
#include "wx/app.h" #include "wx/app.h"
#include "wx/frame.h" #include "wx/frame.h"
#include "wx/bitmap.h" #include "wx/bitmap.h"
@@ -529,3 +533,4 @@ char *wxClipboard::GetClipboardData(char *format, long *length, long time)
} }
#endif #endif
#endif // wxUSE_CLIPBOARD

View File

@@ -6,7 +6,7 @@
// Created: 17/09/98 // Created: 17/09/98
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) Julian Smart // Copyright: (c) Julian Smart
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__ #ifdef __GNUG__
@@ -14,6 +14,7 @@
#endif #endif
#include "wx/control.h" #include "wx/control.h"
#include "wx/panel.h"
#include "wx/utils.h" #include "wx/utils.h"
#include <Xm/Xm.h> #include <Xm/Xm.h>
@@ -38,15 +39,12 @@ wxControl::~wxControl()
{ {
// If we delete an item, we should initialize the parent panel, // If we delete an item, we should initialize the parent panel,
// because it could now be invalid. // because it could now be invalid.
/* wxPanel *panel = wxDynamicCast(GetParent(), wxPanel);
TODO if (panel)
wxWindow *parent = (wxWindow *)GetParent();
if (parent)
{ {
if (parent->GetDefaultItem() == (wxButton*) this) if (panel->GetDefaultItem() == this)
parent->SetDefaultItem((wxButton*) NULL); panel->SetDefaultItem((wxButton*) NULL);
} }
*/
} }
void wxControl::SetLabel(const wxString& label) void wxControl::SetLabel(const wxString& label)

View File

@@ -4,13 +4,17 @@
// Author: Julian Smart // Author: Julian Smart
// Id: $Id$ // Id: $Id$
// Copyright: (c) 1998 Julian Smart // Copyright: (c) 1998 Julian Smart
// Licence: wxWindows licence // Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation "dataobj.h" #pragma implementation "dataobj.h"
#endif #endif
#include "wx/defs.h"
#if wxUSE_CLIPBOARD
#include "wx/dataobj.h" #include "wx/dataobj.h"
#include "wx/app.h" #include "wx/app.h"
@@ -298,3 +302,4 @@ void wxPrivateDataObject::WriteData( const void *data, void *dest ) const
memcpy( dest, data, GetSize() ); memcpy( dest, data, GetSize() );
} }
#endif // wxUSE_CLIPBOARD

View File

@@ -6,7 +6,7 @@
// Created: 17/09/98 // Created: 17/09/98
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) Julian Smart // Copyright: (c) Julian Smart
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__ #ifdef __GNUG__
@@ -369,35 +369,6 @@ wxString wxDialog::GetTitle() const
return m_dialogTitle; return m_dialogTitle;
} }
void wxDialog::Centre(int direction)
{
int x_offset,y_offset ;
int display_width, display_height;
int width, height, x, y;
wxWindow *parent = GetParent();
if ((direction & wxCENTER_FRAME) && parent)
{
parent->GetPosition(&x_offset,&y_offset) ;
parent->GetSize(&display_width,&display_height) ;
}
else
{
wxDisplaySize(&display_width, &display_height);
x_offset = 0 ;
y_offset = 0 ;
}
GetSize(&width, &height);
GetPosition(&x, &y);
if (direction & wxHORIZONTAL)
x = (int)((display_width - width)/2);
if (direction & wxVERTICAL)
y = (int)((display_height - height)/2);
SetSize(x+x_offset, y+y_offset, width, height);
}
void wxDialog::Raise() void wxDialog::Raise()
{ {
Window parent_window = XtWindow((Widget) m_mainWidget), Window parent_window = XtWindow((Widget) m_mainWidget),
@@ -607,11 +578,6 @@ void wxDialog::OnSysColourChanged(wxSysColourChangedEvent& WXUNUSED(event))
Refresh(); Refresh();
} }
void wxDialog::Fit()
{
wxWindow::Fit();
}
// Handle a close event from the window manager // Handle a close event from the window manager
static void wxCloseDialogCallback( Widget WXUNUSED(widget), XtPointer client_data, static void wxCloseDialogCallback( Widget WXUNUSED(widget), XtPointer client_data,
XmAnyCallbackStruct *WXUNUSED(cbs)) XmAnyCallbackStruct *WXUNUSED(cbs))
@@ -624,12 +590,12 @@ static void wxCloseDialogCallback( Widget WXUNUSED(widget), XtPointer client_dat
dialog->GetEventHandler()->ProcessEvent(closeEvent); dialog->GetEventHandler()->ProcessEvent(closeEvent);
} }
void wxDialogBoxEventHandler (Widget wid, void wxDialogBoxEventHandler(Widget wid,
XtPointer WXUNUSED(client_data), XtPointer WXUNUSED(client_data),
XEvent* event, XEvent* event,
Boolean *continueToDispatch) Boolean* continueToDispatch)
{ {
wxDialog *dialog = (wxDialog *)wxWidgetHashTable->Get((long)wid); wxDialog *dialog = (wxDialog *)wxGetWindowFromTable(wid);
if (dialog) if (dialog)
{ {
wxMouseEvent wxevent(wxEVT_NULL); wxMouseEvent wxevent(wxEVT_NULL);
@@ -667,7 +633,7 @@ void wxDialogBoxEventHandler (Widget wid,
{ {
keyEvent.SetEventType(wxEVT_CHAR); keyEvent.SetEventType(wxEVT_CHAR);
dialog->GetEventHandler()->ProcessEvent(keyEvent); dialog->GetEventHandler()->ProcessEvent(keyEvent);
} }
} }
} }
} }

View File

@@ -36,11 +36,11 @@
IMPLEMENT_CLASS(wxFileDialog, wxDialog) IMPLEMENT_CLASS(wxFileDialog, wxDialog)
#endif #endif
#define DEFAULT_FILE_SELECTOR_SIZE 0 #define DEFAULT_FILE_SELECTOR_SIZE 0
// Let Motif defines the size of File // Let Motif defines the size of File
// Selector Box (if 1), or fix it to // Selector Box (if 1), or fix it to
// wxFSB_WIDTH x wxFSB_HEIGHT (if 0) // wxFSB_WIDTH x wxFSB_HEIGHT (if 0)
#define wxFSB_WIDTH 600 #define wxFSB_WIDTH 600
#define wxFSB_HEIGHT 500 #define wxFSB_HEIGHT 500
@@ -145,11 +145,11 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
static void wxChangeListBoxColours(wxWindow* win, Widget widget) static void wxChangeListBoxColours(wxWindow* win, Widget widget)
{ {
win->DoChangeBackgroundColour((WXWidget) widget, *wxWHITE); wxWindow::DoChangeBackgroundColour((WXWidget) widget, *wxWHITE);
// Change colour of the scrolled areas of the listboxes // Change colour of the scrolled areas of the listboxes
Widget listParent = XtParent (widget); Widget listParent = XtParent (widget);
win->DoChangeBackgroundColour((WXWidget) listParent, *wxWHITE, TRUE); wxWindow::DoChangeBackgroundColour((WXWidget) listParent, *wxWHITE, TRUE);
Widget hsb = (Widget) 0; Widget hsb = (Widget) 0;
Widget vsb = (Widget) 0; Widget vsb = (Widget) 0;
@@ -162,8 +162,8 @@ static void wxChangeListBoxColours(wxWindow* win, Widget widget)
* function to change them (by default, taken from wxSystemSettings) * function to change them (by default, taken from wxSystemSettings)
*/ */
wxColour backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE); wxColour backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);
win->DoChangeBackgroundColour((WXWidget) hsb, backgroundColour, TRUE); wxWindow::DoChangeBackgroundColour((WXWidget) hsb, backgroundColour, TRUE);
win->DoChangeBackgroundColour((WXWidget) vsb, backgroundColour, TRUE); wxWindow::DoChangeBackgroundColour((WXWidget) vsb, backgroundColour, TRUE);
if (hsb) if (hsb)
XtVaSetValues (hsb, XtVaSetValues (hsb,
@@ -195,9 +195,13 @@ int wxFileDialog::ShowModal()
Widget selectionWidget = XmFileSelectionBoxGetChild(fileSel, XmDIALOG_TEXT); Widget selectionWidget = XmFileSelectionBoxGetChild(fileSel, XmDIALOG_TEXT);
Widget dirListWidget = XmFileSelectionBoxGetChild(fileSel, XmDIALOG_DIR_LIST); Widget dirListWidget = XmFileSelectionBoxGetChild(fileSel, XmDIALOG_DIR_LIST);
Widget fileListWidget = XmFileSelectionBoxGetChild(fileSel, XmDIALOG_LIST); Widget fileListWidget = XmFileSelectionBoxGetChild(fileSel, XmDIALOG_LIST);
// code using these vars disabled
#if 0
Widget okWidget = XmFileSelectionBoxGetChild(fileSel, XmDIALOG_OK_BUTTON); Widget okWidget = XmFileSelectionBoxGetChild(fileSel, XmDIALOG_OK_BUTTON);
Widget applyWidget = XmFileSelectionBoxGetChild(fileSel, XmDIALOG_APPLY_BUTTON); Widget applyWidget = XmFileSelectionBoxGetChild(fileSel, XmDIALOG_APPLY_BUTTON);
Widget cancelWidget = XmFileSelectionBoxGetChild(fileSel, XmDIALOG_CANCEL_BUTTON); Widget cancelWidget = XmFileSelectionBoxGetChild(fileSel, XmDIALOG_CANCEL_BUTTON);
#endif
Widget shell = XtParent(fileSel); Widget shell = XtParent(fileSel);
@@ -273,11 +277,12 @@ int wxFileDialog::ShowModal()
DoChangeBackgroundColour((WXWidget) filterWidget, *wxWHITE); DoChangeBackgroundColour((WXWidget) filterWidget, *wxWHITE);
DoChangeBackgroundColour((WXWidget) selectionWidget, *wxWHITE); DoChangeBackgroundColour((WXWidget) selectionWidget, *wxWHITE);
/* For some reason this crashes // apparently, this provokes a crash
#if 0
DoChangeBackgroundColour((WXWidget) okWidget, m_backgroundColour, TRUE); DoChangeBackgroundColour((WXWidget) okWidget, m_backgroundColour, TRUE);
DoChangeBackgroundColour((WXWidget) cancelWidget, m_backgroundColour, TRUE); DoChangeBackgroundColour((WXWidget) cancelWidget, m_backgroundColour, TRUE);
DoChangeBackgroundColour((WXWidget) applyWidget, m_backgroundColour, TRUE); DoChangeBackgroundColour((WXWidget) applyWidget, m_backgroundColour, TRUE);
*/ #endif
wxChangeListBoxColours(this, dirListWidget); wxChangeListBoxColours(this, dirListWidget);
wxChangeListBoxColours(this, fileListWidget); wxChangeListBoxColours(this, fileListWidget);
@@ -329,17 +334,18 @@ wxDefaultFileSelector(bool load, const char *what, const char *extension, const
{ {
char *ext = (char *)extension; char *ext = (char *)extension;
char prompt[50]; wxString prompt;
wxString str; wxString str;
if (load) if (load)
str = "Load %s file"; str = _("Load %s file");
else else
str = "Save %s file"; str = _("Save %s file");
sprintf(prompt, wxGetTranslation(str), what); prompt.Printf(str, what);
if (*ext == '.') ext++; if (*ext == '.')
char wild[60]; ext++;
sprintf(wild, "*.%s", ext); wxString wild;
wild.Printf("*.%s", ext);
return wxFileSelector (prompt, NULL, default_name, ext, wild, 0, parent); return wxFileSelector (prompt, NULL, default_name, ext, wild, 0, parent);
} }

View File

@@ -6,7 +6,7 @@
// Created: 17/09/98 // Created: 17/09/98
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) Julian Smart // Copyright: (c) Julian Smart
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__ #ifdef __GNUG__
@@ -35,13 +35,13 @@ wxXFont::wxXFont()
wxXFont::~wxXFont() wxXFont::~wxXFont()
{ {
XFontStruct* fontStruct = (XFontStruct*) m_fontStruct;
XmFontList fontList = (XmFontList) m_fontList; XmFontList fontList = (XmFontList) m_fontList;
XmFontListFree (fontList); XmFontListFree (fontList);
// TODO: why does freeing the font produce a segv??? // TODO: why does freeing the font produce a segv???
// Note that XFreeFont wasn't called in wxWin 1.68 either. // Note that XFreeFont wasn't called in wxWin 1.68 either.
// XFontStruct* fontStruct = (XFontStruct*) m_fontStruct;
// XFreeFont((Display*) m_display, fontStruct); // XFreeFont((Display*) m_display, fontStruct);
} }

View File

@@ -202,7 +202,8 @@ bool wxFrame::Create(wxWindow *parent,
XtManageChild((Widget) m_clientArea); XtManageChild((Widget) m_clientArea);
XtManageChild((Widget) m_workArea); XtManageChild((Widget) m_workArea);
wxASSERT_MSG ((wxWidgetHashTable->Get((long)m_workArea) == (wxObject*) NULL), "Widget table clash in frame.cpp") ; wxASSERT_MSG( !wxGetWindowFromTable((Widget)m_workArea),
"Widget table clash in frame.cpp") ;
wxAddWindowToTable((Widget) m_workArea, this); wxAddWindowToTable((Widget) m_workArea, this);
@@ -1042,18 +1043,17 @@ void wxFrame::Lower(void)
void wxFrameFocusProc(Widget workArea, XtPointer clientData, void wxFrameFocusProc(Widget workArea, XtPointer clientData,
XmAnyCallbackStruct *cbs) XmAnyCallbackStruct *cbs)
{ {
wxFrame *frame = (wxFrame *)clientData;
// wxDebugMsg("focus proc from frame %ld\n",(long)frame); // wxDebugMsg("focus proc from frame %ld\n",(long)frame);
// TODO // TODO
// frame->GetEventHandler()->OnSetFocus(); // wxFrame *frame = (wxFrame *)clientData;
// frame->GetEventHandler()->OnSetFocus();
} }
/* MATTEW: Used to insure that hide-&-show within an event cycle works */ /* MATTEW: Used to insure that hide-&-show within an event cycle works */
static void wxFrameMapProc(Widget frameShell, XtPointer clientData, static void wxFrameMapProc(Widget frameShell, XtPointer clientData,
XCrossingEvent * event) XCrossingEvent * event)
{ {
wxFrame *frame = (wxFrame *)wxWidgetHashTable->Get((long)clientData); wxFrame *frame = (wxFrame *)wxGetWindowFromTable((Widget)clientData);
if (frame) { if (frame) {
XEvent *e = (XEvent *)event; XEvent *e = (XEvent *)event;

View File

@@ -6,7 +6,7 @@
// Created: 17/09/98 // Created: 17/09/98
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) Julian Smart // Copyright: (c) Julian Smart
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__ #ifdef __GNUG__
@@ -317,8 +317,8 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
SetMDIParentFrame(parent); SetMDIParentFrame(parent);
int x = pos.x; int y = pos.y; int width = size.x;
int width = size.x; int height = size.y; int height = size.y;
if (width == -1) if (width == -1)
width = 200; // TODO: give reasonable default width = 200; // TODO: give reasonable default
if (height == -1) if (height == -1)

View File

@@ -3,7 +3,7 @@
// Purpose: Region class // Purpose: Region class
// Author: Markus Holzem/Julian Smart // Author: Markus Holzem/Julian Smart
// Created: Fri Oct 24 10:46:34 MET 1997 // Created: Fri Oct 24 10:46:34 MET 1997
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) 1997 Markus Holzem/Julian Smart // Copyright: (c) 1997 Markus Holzem/Julian Smart
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -19,8 +19,8 @@
// #include "wx/motif/private.h" // #include "wx/motif/private.h"
#if !USE_SHARED_LIBRARY #if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxRegion, wxGDIObject) IMPLEMENT_DYNAMIC_CLASS(wxRegion, wxGDIObject)
IMPLEMENT_DYNAMIC_CLASS(wxRegionIterator, wxObject) IMPLEMENT_DYNAMIC_CLASS(wxRegionIterator, wxObject)
#endif #endif
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -29,21 +29,21 @@
class WXDLLEXPORT wxRegionRefData : public wxGDIRefData { class WXDLLEXPORT wxRegionRefData : public wxGDIRefData {
public: public:
wxRegionRefData() wxRegionRefData()
{ {
m_region = XCreateRegion(); m_region = XCreateRegion();
} }
wxRegionRefData(const wxRegionRefData& data) wxRegionRefData(const wxRegionRefData& data)
{ {
m_region = XCreateRegion(); m_region = XCreateRegion();
XUnionRegion(m_region, data.m_region, m_region); XUnionRegion(m_region, data.m_region, m_region);
} }
~wxRegionRefData() ~wxRegionRefData()
{ {
XDestroyRegion(m_region); XDestroyRegion(m_region);
} }
Region m_region; Region m_region;
}; };
@@ -64,24 +64,24 @@ wxRegion::wxRegion(long x, long y, long w, long h)
{ {
m_refData = new wxRegionRefData; m_refData = new wxRegionRefData;
XRectangle rect; XRectangle rect;
rect.x = x; rect.x = x;
rect.y = y; rect.y = y;
rect.width = w; rect.width = w;
rect.height = h; rect.height = h;
XUnionRectWithRegion(&rect, M_REGION, M_REGION); XUnionRectWithRegion(&rect, M_REGION, M_REGION);
} }
wxRegion::wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight) wxRegion::wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight)
{ {
m_refData = new wxRegionRefData; m_refData = new wxRegionRefData;
XRectangle rect; XRectangle rect;
rect.x = topLeft.x; rect.x = topLeft.x;
rect.y = topLeft.y; rect.y = topLeft.y;
rect.width = bottomRight.x - topLeft.x; rect.width = bottomRight.x - topLeft.x;
rect.height = bottomRight.y - topLeft.y; rect.height = bottomRight.y - topLeft.y;
XUnionRectWithRegion(&rect, M_REGION, M_REGION); XUnionRectWithRegion(&rect, M_REGION, M_REGION);
} }
wxRegion::wxRegion(const wxRect& rect) wxRegion::wxRegion(const wxRect& rect)
@@ -89,9 +89,9 @@ wxRegion::wxRegion(const wxRect& rect)
m_refData = new wxRegionRefData; m_refData = new wxRegionRefData;
XRectangle rect1; XRectangle rect1;
rect1.x = rect.x; rect1.x = rect.x;
rect1.y = rect.y; rect1.y = rect.y;
rect1.width = rect.width; rect1.width = rect.width;
rect1.height = rect.height; rect1.height = rect.height;
XUnionRectWithRegion(&rect1, M_REGION, M_REGION); XUnionRectWithRegion(&rect1, M_REGION, M_REGION);
} }
@@ -125,33 +125,32 @@ void wxRegion::Clear()
//! Combine rectangle (x, y, w, h) with this. //! Combine rectangle (x, y, w, h) with this.
bool wxRegion::Combine(long x, long y, long width, long height, wxRegionOp op) bool wxRegion::Combine(long x, long y, long width, long height, wxRegionOp op)
{ {
// Don't change shared data // Don't change shared data
if (!m_refData) { if (!m_refData) {
m_refData = new wxRegionRefData(); m_refData = new wxRegionRefData();
} else if (m_refData->GetRefCount() > 1) { } else if (m_refData->GetRefCount() > 1) {
wxRegionRefData* ref = (wxRegionRefData*)m_refData; wxRegionRefData* ref = (wxRegionRefData*)m_refData;
UnRef(); UnRef();
m_refData = new wxRegionRefData(*ref); m_refData = new wxRegionRefData(*ref);
} }
// If ref count is 1, that means it's 'ours' anyway so no action. // If ref count is 1, that means it's 'ours' anyway so no action.
Region rectRegion = XCreateRegion(); Region rectRegion = XCreateRegion();
XRectangle rect; XRectangle rect;
rect.x = x; rect.x = x;
rect.y = y; rect.y = y;
rect.width = width; rect.width = width;
rect.height = height; rect.height = height;
XUnionRectWithRegion(&rect, rectRegion, rectRegion); XUnionRectWithRegion(&rect, rectRegion, rectRegion);
int mode = 0; // TODO platform-specific code
switch (op) switch (op)
{ {
case wxRGN_AND: case wxRGN_AND:
XIntersectRegion(M_REGION, rectRegion, M_REGION); XIntersectRegion(M_REGION, rectRegion, M_REGION);
break ; break ;
case wxRGN_OR: case wxRGN_OR:
XUnionRegion(M_REGION, rectRegion, M_REGION); XUnionRegion(M_REGION, rectRegion, M_REGION);
break ; break ;
case wxRGN_XOR: case wxRGN_XOR:
// TODO // TODO
@@ -171,28 +170,27 @@ bool wxRegion::Combine(long x, long y, long width, long height, wxRegionOp op)
//! Union /e region with this. //! Union /e region with this.
bool wxRegion::Combine(const wxRegion& region, wxRegionOp op) bool wxRegion::Combine(const wxRegion& region, wxRegionOp op)
{ {
if (region.Empty()) if (region.Empty())
return FALSE; return FALSE;
// Don't change shared data // Don't change shared data
if (!m_refData) { if (!m_refData) {
m_refData = new wxRegionRefData(); m_refData = new wxRegionRefData();
} else if (m_refData->GetRefCount() > 1) { } else if (m_refData->GetRefCount() > 1) {
wxRegionRefData* ref = (wxRegionRefData*)m_refData; wxRegionRefData* ref = (wxRegionRefData*)m_refData;
UnRef(); UnRef();
m_refData = new wxRegionRefData(*ref); m_refData = new wxRegionRefData(*ref);
} }
int mode = 0; // TODO platform-specific code
switch (op) switch (op)
{ {
case wxRGN_AND: case wxRGN_AND:
XIntersectRegion(M_REGION, ((wxRegionRefData*)region.m_refData)->m_region, XIntersectRegion(M_REGION, ((wxRegionRefData*)region.m_refData)->m_region,
M_REGION); M_REGION);
break ; break ;
case wxRGN_OR: case wxRGN_OR:
XUnionRegion(M_REGION, ((wxRegionRefData*)region.m_refData)->m_region, XUnionRegion(M_REGION, ((wxRegionRefData*)region.m_refData)->m_region,
M_REGION); M_REGION);
break ; break ;
case wxRGN_XOR: case wxRGN_XOR:
// TODO // TODO
@@ -221,16 +219,16 @@ bool wxRegion::Combine(const wxRect& rect, wxRegionOp op)
// Outer bounds of region // Outer bounds of region
void wxRegion::GetBox(long& x, long& y, long&w, long &h) const void wxRegion::GetBox(long& x, long& y, long&w, long &h) const
{ {
if (m_refData) { if (m_refData) {
XRectangle rect; XRectangle rect;
XClipBox(M_REGION, &rect); XClipBox(M_REGION, &rect);
x = rect.x; x = rect.x;
y = rect.y; y = rect.y;
w = rect.width; w = rect.width;
h = rect.height; h = rect.height;
} else { } else {
x = y = w = h = 0; x = y = w = h = 0;
} }
} }
wxRect wxRegion::GetBox() const wxRect wxRegion::GetBox() const
@@ -243,7 +241,7 @@ wxRect wxRegion::GetBox() const
// Is region empty? // Is region empty?
bool wxRegion::Empty() const bool wxRegion::Empty() const
{ {
return m_refData ? XEmptyRegion(M_REGION) : TRUE; return m_refData ? XEmptyRegion(M_REGION) : TRUE;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -253,8 +251,8 @@ bool wxRegion::Empty() const
// Does the region contain the point (x,y)? // Does the region contain the point (x,y)?
wxRegionContain wxRegion::Contains(long x, long y) const wxRegionContain wxRegion::Contains(long x, long y) const
{ {
if (!m_refData) if (!m_refData)
return wxOutRegion; return wxOutRegion;
// TODO. Return wxInRegion if within region. // TODO. Return wxInRegion if within region.
if (0) if (0)
@@ -265,30 +263,30 @@ wxRegionContain wxRegion::Contains(long x, long y) const
// Does the region contain the point pt? // Does the region contain the point pt?
wxRegionContain wxRegion::Contains(const wxPoint& pt) const wxRegionContain wxRegion::Contains(const wxPoint& pt) const
{ {
if (!m_refData) if (!m_refData)
return wxOutRegion; return wxOutRegion;
return XPointInRegion(M_REGION, pt.x, pt.y) ? wxInRegion : wxOutRegion; return XPointInRegion(M_REGION, pt.x, pt.y) ? wxInRegion : wxOutRegion;
} }
// Does the region contain the rectangle (x, y, w, h)? // Does the region contain the rectangle (x, y, w, h)?
wxRegionContain wxRegion::Contains(long x, long y, long w, long h) const wxRegionContain wxRegion::Contains(long x, long y, long w, long h) const
{ {
if (!m_refData) if (!m_refData)
return wxOutRegion; return wxOutRegion;
switch (XRectInRegion(M_REGION, x, y, w, h)) { switch (XRectInRegion(M_REGION, x, y, w, h)) {
case RectangleIn: return wxInRegion; case RectangleIn: return wxInRegion;
case RectanglePart: return wxPartRegion; case RectanglePart: return wxPartRegion;
} }
return wxOutRegion; return wxOutRegion;
} }
// Does the region contain the rectangle rect // Does the region contain the rectangle rect
wxRegionContain wxRegion::Contains(const wxRect& rect) const wxRegionContain wxRegion::Contains(const wxRect& rect) const
{ {
if (!m_refData) if (!m_refData)
return wxOutRegion; return wxOutRegion;
long x, y, w, h; long x, y, w, h;
x = rect.x; x = rect.x;
@@ -299,9 +297,9 @@ wxRegionContain wxRegion::Contains(const wxRect& rect) const
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// // // //
// wxRegionIterator // // wxRegionIterator //
// // // //
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
/*! /*!
@@ -324,7 +322,7 @@ wxRegionIterator::wxRegionIterator(const wxRegion& region)
{ {
m_rects = NULL; m_rects = NULL;
Reset(region); Reset(region);
} }
/*! /*!
@@ -332,17 +330,17 @@ wxRegionIterator::wxRegionIterator(const wxRegion& region)
*/ */
void wxRegionIterator::Reset(const wxRegion& region) void wxRegionIterator::Reset(const wxRegion& region)
{ {
m_current = 0; m_current = 0;
m_region = region; m_region = region;
if (m_rects) if (m_rects)
delete[] m_rects; delete[] m_rects;
m_rects = NULL; m_rects = NULL;
if (m_region.Empty()) if (m_region.Empty())
m_numRects = 0; m_numRects = 0;
else else
{ {
// TODO create m_rects and fill with rectangles for this region // TODO create m_rects and fill with rectangles for this region
m_numRects = 0; m_numRects = 0;
@@ -355,8 +353,8 @@ void wxRegionIterator::Reset(const wxRegion& region)
*/ */
void wxRegionIterator::operator ++ () void wxRegionIterator::operator ++ ()
{ {
if (m_current < m_numRects) if (m_current < m_numRects)
++m_current; ++m_current;
} }
/*! /*!
@@ -365,35 +363,35 @@ void wxRegionIterator::operator ++ ()
*/ */
void wxRegionIterator::operator ++ (int) void wxRegionIterator::operator ++ (int)
{ {
if (m_current < m_numRects) if (m_current < m_numRects)
++m_current; ++m_current;
} }
long wxRegionIterator::GetX() const long wxRegionIterator::GetX() const
{ {
if (m_current < m_numRects) if (m_current < m_numRects)
return m_rects[m_current].x; return m_rects[m_current].x;
return 0; return 0;
} }
long wxRegionIterator::GetY() const long wxRegionIterator::GetY() const
{ {
if (m_current < m_numRects) if (m_current < m_numRects)
return m_rects[m_current].y; return m_rects[m_current].y;
return 0; return 0;
} }
long wxRegionIterator::GetW() const long wxRegionIterator::GetW() const
{ {
if (m_current < m_numRects) if (m_current < m_numRects)
return m_rects[m_current].width ; return m_rects[m_current].width ;
return 0; return 0;
} }
long wxRegionIterator::GetH() const long wxRegionIterator::GetH() const
{ {
if (m_current < m_numRects) if (m_current < m_numRects)
return m_rects[m_current].height; return m_rects[m_current].height;
return 0; return 0;
} }