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:
@@ -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__)
|
||||||
|
@@ -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:
|
||||||
|
@@ -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;
|
||||||
|
@@ -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()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -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()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -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();
|
||||||
@@ -48,35 +48,35 @@ class WXDLLEXPORT wxClipboard: public wxObject
|
|||||||
DECLARE_DYNAMIC_CLASS(wxClipboard)
|
DECLARE_DYNAMIC_CLASS(wxClipboard)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
wxClipboard();
|
wxClipboard();
|
||||||
~wxClipboard();
|
~wxClipboard();
|
||||||
|
|
||||||
// open the clipboard before SetData() and GetData()
|
// open the clipboard before SetData() and GetData()
|
||||||
virtual bool Open();
|
virtual bool Open();
|
||||||
|
|
||||||
// close the clipboard after SetData() and GetData()
|
// close the clipboard after SetData() and GetData()
|
||||||
virtual void Close();
|
virtual void Close();
|
||||||
|
|
||||||
// can be called several times
|
// can be called several times
|
||||||
virtual bool SetData( wxDataObject *data );
|
virtual bool SetData( wxDataObject *data );
|
||||||
|
|
||||||
// format available on the clipboard ?
|
// format available on the clipboard ?
|
||||||
// supply ID if private format, the same as wxPrivateDataObject::SetId()
|
// supply ID if private format, the same as wxPrivateDataObject::SetId()
|
||||||
virtual bool IsSupported( wxDataFormat format );
|
virtual bool IsSupported( wxDataFormat format );
|
||||||
|
|
||||||
// fill data with data on the clipboard (if available)
|
// fill data with data on the clipboard (if available)
|
||||||
virtual bool GetData( wxDataObject *data );
|
virtual bool GetData( wxDataObject *data );
|
||||||
|
|
||||||
// clears wxTheClipboard and the system's clipboard if possible
|
// clears wxTheClipboard and the system's clipboard if possible
|
||||||
virtual void Clear();
|
virtual void Clear();
|
||||||
|
|
||||||
/// If primary == TRUE, use primary selection in all further ops,
|
/// If primary == TRUE, use primary selection in all further ops,
|
||||||
/// primary=FALSE resets it.
|
/// primary=FALSE resets it.
|
||||||
inline void UsePrimarySelection(bool primary = TRUE) { m_usePrimary = primary; }
|
inline void UsePrimarySelection(bool primary = TRUE) { m_usePrimary = primary; }
|
||||||
|
|
||||||
// implementation
|
// implementation
|
||||||
|
|
||||||
bool m_open;
|
bool m_open;
|
||||||
wxList m_data;
|
wxList m_data;
|
||||||
bool m_usePrimary;
|
bool m_usePrimary;
|
||||||
@@ -92,7 +92,7 @@ WXDLLEXPORT_DATA(extern wxClipboard*) wxTheClipboard;
|
|||||||
class wxClipboardModule: public wxModule
|
class wxClipboardModule: public wxModule
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxClipboardModule)
|
DECLARE_DYNAMIC_CLASS(wxClipboardModule)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxClipboardModule() {}
|
wxClipboardModule() {}
|
||||||
bool OnInit();
|
bool OnInit();
|
||||||
@@ -154,7 +154,7 @@ class WXDLLEXPORT wxClipboard : public wxObject
|
|||||||
char *GetClipboardData(char *format, long *length, long time);
|
char *GetClipboardData(char *format, long *length, long time);
|
||||||
|
|
||||||
/* Get the clipboard client directly. Will be NULL if clipboard data
|
/* Get the clipboard client directly. Will be NULL if clipboard data
|
||||||
is a string, or if some other application owns the clipboard.
|
is a string, or if some other application owns the clipboard.
|
||||||
This can be useful for shortcutting data translation, if the
|
This can be useful for shortcutting data translation, if the
|
||||||
clipboard user can check for a specific client. (This is used
|
clipboard user can check for a specific client. (This is used
|
||||||
by the wxMediaEdit class.) */
|
by the wxMediaEdit class.) */
|
||||||
@@ -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_
|
||||||
|
@@ -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,
|
||||||
|
@@ -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)
|
||||||
|
@@ -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()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -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)
|
||||||
|
|
||||||
@@ -92,7 +96,7 @@ wxGenericGrid::wxGenericGrid(void)
|
|||||||
|
|
||||||
m_editInPlace = TRUE;
|
m_editInPlace = TRUE;
|
||||||
m_inOnTextInPlace = FALSE;
|
m_inOnTextInPlace = FALSE;
|
||||||
|
|
||||||
#if defined(__WIN95__)
|
#if defined(__WIN95__)
|
||||||
m_scrollWidth = wxSystemSettings::GetSystemMetric(wxSYS_VSCROLL_X);
|
m_scrollWidth = wxSystemSettings::GetSystemMetric(wxSYS_VSCROLL_X);
|
||||||
#elif defined(__WXGTK__)
|
#elif defined(__WXGTK__)
|
||||||
@@ -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,12 +237,12 @@ 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();
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -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;
|
||||||
}
|
}
|
||||||
@@ -1416,17 +1420,17 @@ void wxGenericGrid::OnSelectCellImplementation(wxDC *dc, int row, int col)
|
|||||||
{
|
{
|
||||||
HighlightCell(dc);
|
HighlightCell(dc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Highlight the new cell and copy its content to the edit control
|
// Highlight the new cell and copy its content to the edit control
|
||||||
SetCurrentRect(m_wCursorRow, m_wCursorColumn);
|
SetCurrentRect(m_wCursorRow, m_wCursorColumn);
|
||||||
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);
|
||||||
@@ -1434,30 +1438,30 @@ 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();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// 1) Why isn't this needed for Windows??
|
// 1) Why isn't this needed for Windows??
|
||||||
// Probably because of the SetValue?? JS.
|
// Probably because of the SetValue?? JS.
|
||||||
// 2) Arrrrrgh. This isn't needed anywhere,
|
// 2) Arrrrrgh. This isn't needed anywhere,
|
||||||
// of course. One hour of debugging... RR.
|
// of course. One hour of debugging... RR.
|
||||||
//
|
//
|
||||||
// 3) It *is* needed for Motif - michael
|
// 3) It *is* needed for Motif - michael
|
||||||
@@ -1472,7 +1476,7 @@ void wxGenericGrid::OnSelectCellImplementation(wxDC *dc, int row, int col)
|
|||||||
|
|
||||||
OnSelectCell(row, col);
|
OnSelectCell(row, col);
|
||||||
wxGridEvent g_evt2(GetId(), wxEVT_GRID_SELECT_CELL, this, row, col);
|
wxGridEvent g_evt2(GetId(), wxEVT_GRID_SELECT_CELL, this, row, col);
|
||||||
GetEventHandler()->ProcessEvent(g_evt2);
|
GetEventHandler()->ProcessEvent(g_evt2);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxGridCell *wxGenericGrid::OnCreateCell(void)
|
wxGridCell *wxGenericGrid::OnCreateCell(void)
|
||||||
@@ -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
|
||||||
@@ -2023,10 +2027,10 @@ void wxGenericGrid::SetEditable(bool edit)
|
|||||||
m_textItem->Show(FALSE);
|
m_textItem->Show(FALSE);
|
||||||
m_editingPanel->Show(FALSE);
|
m_editingPanel->Show(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_inPlaceTextItem )
|
if ( m_inPlaceTextItem )
|
||||||
{
|
{
|
||||||
m_inPlaceTextItem->Show(FALSE);
|
m_inPlaceTextItem->Show(FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UpdateDimensions();
|
UpdateDimensions();
|
||||||
@@ -2053,37 +2057,37 @@ void wxGenericGrid::SetEditInPlace(bool edit)
|
|||||||
if ( m_editInPlace != edit )
|
if ( m_editInPlace != 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);
|
|
||||||
|
|
||||||
dc.BeginDrawing();
|
wxClientDC dc(grid);
|
||||||
grid->SetGridClippingRegion(& dc);
|
|
||||||
grid->DrawCellBackground(& dc, &grid->GetCurrentRect(), grid->GetCursorRow(), grid->GetCursorColumn());
|
|
||||||
grid->DrawCellValue(& dc, &grid->GetCurrentRect(), grid->GetCursorRow(), grid->GetCursorColumn());
|
|
||||||
if ( !(m_editable && m_editInPlace ) ) grid->HighlightCell(& dc);
|
|
||||||
dc.DestroyClippingRegion();
|
|
||||||
dc.EndDrawing();
|
|
||||||
|
|
||||||
//grid->OnCellChange(grid->GetCursorRow(), grid->GetCursorColumn());
|
dc.BeginDrawing();
|
||||||
wxGridEvent g_evt(GetId(), wxEVT_GRID_CELL_CHANGE, grid,
|
grid->SetGridClippingRegion(& dc);
|
||||||
grid->GetCursorRow(), grid->GetCursorColumn());
|
grid->DrawCellBackground(& dc, &grid->GetCurrentRect(), grid->GetCursorRow(), grid->GetCursorColumn());
|
||||||
GetEventHandler()->ProcessEvent(g_evt);
|
grid->DrawCellValue(& dc, &grid->GetCurrentRect(), grid->GetCursorRow(), grid->GetCursorColumn());
|
||||||
|
if ( !(m_editable && m_editInPlace ) ) grid->HighlightCell(& dc);
|
||||||
|
dc.DestroyClippingRegion();
|
||||||
|
dc.EndDrawing();
|
||||||
|
|
||||||
// grid->DrawCellText();
|
//grid->OnCellChange(grid->GetCursorRow(), grid->GetCursorColumn());
|
||||||
}
|
wxGridEvent g_evt(GetId(), wxEVT_GRID_CELL_CHANGE, grid,
|
||||||
|
grid->GetCursorRow(), grid->GetCursorColumn());
|
||||||
|
GetEventHandler()->ProcessEvent(g_evt);
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
|
||||||
@@ -2639,10 +2681,10 @@ 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();
|
||||||
}
|
}
|
||||||
|
|
||||||
inScroll = FALSE;
|
inScroll = FALSE;
|
||||||
|
@@ -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;
|
||||||
}
|
}
|
||||||
|
@@ -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);
|
||||||
|
@@ -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
|
||||||
|
|
||||||
|
@@ -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
|
||||||
|
|
||||||
|
@@ -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 \
|
||||||
|
@@ -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
|
||||||
|
@@ -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__
|
||||||
@@ -45,31 +45,31 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit
|
|||||||
m_buttonBitmapOriginal = bitmap;
|
m_buttonBitmapOriginal = bitmap;
|
||||||
m_buttonBitmapSelected = bitmap;
|
m_buttonBitmapSelected = bitmap;
|
||||||
m_buttonBitmapSelectedOriginal = bitmap;
|
m_buttonBitmapSelectedOriginal = bitmap;
|
||||||
|
|
||||||
SetName(name);
|
SetName(name);
|
||||||
SetValidator(validator);
|
SetValidator(validator);
|
||||||
parent->AddChild(this);
|
parent->AddChild(this);
|
||||||
|
|
||||||
m_backgroundColour = parent->GetBackgroundColour() ;
|
m_backgroundColour = parent->GetBackgroundColour() ;
|
||||||
m_foregroundColour = parent->GetForegroundColour() ;
|
m_foregroundColour = parent->GetForegroundColour() ;
|
||||||
m_windowStyle = style;
|
m_windowStyle = style;
|
||||||
m_marginX = 0;
|
m_marginX = 0;
|
||||||
m_marginY = 0;
|
m_marginY = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
int x = pos.x;
|
int x = pos.x;
|
||||||
int y = pos.y;
|
int y = pos.y;
|
||||||
int width = size.x;
|
int width = size.x;
|
||||||
int height = size.y;
|
int height = size.y;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (id == -1)
|
if (id == -1)
|
||||||
m_windowId = NewControlId();
|
m_windowId = NewControlId();
|
||||||
else
|
else
|
||||||
m_windowId = id;
|
m_windowId = id;
|
||||||
|
|
||||||
Widget parentWidget = (Widget) parent->GetClientWidget();
|
Widget parentWidget = (Widget) parent->GetClientWidget();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Patch Note (important)
|
* Patch Note (important)
|
||||||
* There is no major reason to put a defaultButtonThickness here.
|
* There is no major reason to put a defaultButtonThickness here.
|
||||||
@@ -80,7 +80,7 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit
|
|||||||
* in the ::SetDefaultButton method.
|
* in the ::SetDefaultButton method.
|
||||||
*/
|
*/
|
||||||
Widget buttonWidget = XtVaCreateManagedWidget ("button",
|
Widget buttonWidget = XtVaCreateManagedWidget ("button",
|
||||||
|
|
||||||
// Gadget causes problems for default button operation.
|
// Gadget causes problems for default button operation.
|
||||||
#if wxUSE_GADGETS
|
#if wxUSE_GADGETS
|
||||||
xmPushButtonGadgetClass, parentWidget,
|
xmPushButtonGadgetClass, parentWidget,
|
||||||
@@ -89,29 +89,29 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit
|
|||||||
#endif
|
#endif
|
||||||
// XmNdefaultButtonShadowThickness, 1, // See comment for wxButton::SetDefault
|
// XmNdefaultButtonShadowThickness, 1, // See comment for wxButton::SetDefault
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
m_mainWidget = (WXWidget) buttonWidget;
|
m_mainWidget = (WXWidget) buttonWidget;
|
||||||
|
|
||||||
m_font = parent->GetFont();
|
m_font = parent->GetFont();
|
||||||
ChangeFont(FALSE);
|
ChangeFont(FALSE);
|
||||||
|
|
||||||
ChangeBackgroundColour ();
|
ChangeBackgroundColour ();
|
||||||
|
|
||||||
DoSetBitmap();
|
DoSetBitmap();
|
||||||
|
|
||||||
XtAddCallback (buttonWidget, XmNactivateCallback, (XtCallbackProc) wxButtonCallback,
|
XtAddCallback (buttonWidget, XmNactivateCallback, (XtCallbackProc) wxButtonCallback,
|
||||||
(XtPointer) this);
|
(XtPointer) this);
|
||||||
|
|
||||||
SetCanAddEventHandler(TRUE);
|
SetCanAddEventHandler(TRUE);
|
||||||
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
|
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxBitmapButton::~wxBitmapButton()
|
wxBitmapButton::~wxBitmapButton()
|
||||||
{
|
{
|
||||||
SetBitmapLabel(wxNullBitmap);
|
SetBitmapLabel(wxNullBitmap);
|
||||||
|
|
||||||
if (m_insensPixmap)
|
if (m_insensPixmap)
|
||||||
XmDestroyPixmap (DefaultScreenOfDisplay ((Display*) GetXDisplay()), (Pixmap) m_insensPixmap);
|
XmDestroyPixmap (DefaultScreenOfDisplay ((Display*) GetXDisplay()), (Pixmap) m_insensPixmap);
|
||||||
}
|
}
|
||||||
@@ -120,7 +120,7 @@ void wxBitmapButton::SetBitmapLabel(const wxBitmap& bitmap)
|
|||||||
{
|
{
|
||||||
m_buttonBitmapOriginal = bitmap;
|
m_buttonBitmapOriginal = bitmap;
|
||||||
m_buttonBitmap = bitmap;
|
m_buttonBitmap = bitmap;
|
||||||
|
|
||||||
DoSetBitmap();
|
DoSetBitmap();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,7 +128,7 @@ void wxBitmapButton::SetBitmapSelected(const wxBitmap& sel)
|
|||||||
{
|
{
|
||||||
m_buttonBitmapSelected = sel;
|
m_buttonBitmapSelected = sel;
|
||||||
m_buttonBitmapSelectedOriginal = sel;
|
m_buttonBitmapSelectedOriginal = sel;
|
||||||
|
|
||||||
DoSetBitmap();
|
DoSetBitmap();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -142,7 +142,7 @@ void wxBitmapButton::SetBitmapDisabled(const wxBitmap& disabled)
|
|||||||
{
|
{
|
||||||
m_buttonBitmapDisabled = disabled;
|
m_buttonBitmapDisabled = disabled;
|
||||||
m_buttonBitmapDisabledOriginal = disabled;
|
m_buttonBitmapDisabledOriginal = disabled;
|
||||||
|
|
||||||
DoSetBitmap();
|
DoSetBitmap();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -153,7 +153,7 @@ void wxBitmapButton::DoSetBitmap()
|
|||||||
Pixmap pixmap = 0;
|
Pixmap pixmap = 0;
|
||||||
Pixmap insensPixmap = 0;
|
Pixmap insensPixmap = 0;
|
||||||
Pixmap armPixmap = 0;
|
Pixmap armPixmap = 0;
|
||||||
|
|
||||||
// Must re-make the bitmap to have its transparent areas drawn
|
// Must re-make the bitmap to have its transparent areas drawn
|
||||||
// in the current widget background colour.
|
// in the current widget background colour.
|
||||||
if (m_buttonBitmapOriginal.GetMask())
|
if (m_buttonBitmapOriginal.GetMask())
|
||||||
@@ -161,18 +161,18 @@ void wxBitmapButton::DoSetBitmap()
|
|||||||
int backgroundPixel;
|
int backgroundPixel;
|
||||||
XtVaGetValues((Widget) m_mainWidget, XmNbackground, &backgroundPixel,
|
XtVaGetValues((Widget) m_mainWidget, XmNbackground, &backgroundPixel,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
wxColour col;
|
wxColour col;
|
||||||
col.SetPixel(backgroundPixel);
|
col.SetPixel(backgroundPixel);
|
||||||
|
|
||||||
wxBitmap newBitmap = wxCreateMaskedBitmap(m_buttonBitmapOriginal, col);
|
wxBitmap newBitmap = wxCreateMaskedBitmap(m_buttonBitmapOriginal, col);
|
||||||
m_buttonBitmap = newBitmap;
|
m_buttonBitmap = newBitmap;
|
||||||
|
|
||||||
pixmap = (Pixmap) m_buttonBitmap.GetPixmap();
|
pixmap = (Pixmap) m_buttonBitmap.GetPixmap();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
pixmap = (Pixmap) m_buttonBitmap.GetLabelPixmap(m_mainWidget);
|
pixmap = (Pixmap) m_buttonBitmap.GetLabelPixmap(m_mainWidget);
|
||||||
|
|
||||||
if (m_buttonBitmapDisabledOriginal.Ok())
|
if (m_buttonBitmapDisabledOriginal.Ok())
|
||||||
{
|
{
|
||||||
if (m_buttonBitmapDisabledOriginal.GetMask())
|
if (m_buttonBitmapDisabledOriginal.GetMask())
|
||||||
@@ -180,13 +180,13 @@ void wxBitmapButton::DoSetBitmap()
|
|||||||
int backgroundPixel;
|
int backgroundPixel;
|
||||||
XtVaGetValues((Widget) m_mainWidget, XmNbackground, &backgroundPixel,
|
XtVaGetValues((Widget) m_mainWidget, XmNbackground, &backgroundPixel,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
wxColour col;
|
wxColour col;
|
||||||
col.SetPixel(backgroundPixel);
|
col.SetPixel(backgroundPixel);
|
||||||
|
|
||||||
wxBitmap newBitmap = wxCreateMaskedBitmap(m_buttonBitmapDisabledOriginal, col);
|
wxBitmap newBitmap = wxCreateMaskedBitmap(m_buttonBitmapDisabledOriginal, col);
|
||||||
m_buttonBitmapDisabled = newBitmap;
|
m_buttonBitmapDisabled = newBitmap;
|
||||||
|
|
||||||
insensPixmap = (Pixmap) m_buttonBitmapDisabled.GetPixmap();
|
insensPixmap = (Pixmap) m_buttonBitmapDisabled.GetPixmap();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -194,7 +194,7 @@ void wxBitmapButton::DoSetBitmap()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
insensPixmap = (Pixmap) m_buttonBitmap.GetInsensPixmap(m_mainWidget);
|
insensPixmap = (Pixmap) m_buttonBitmap.GetInsensPixmap(m_mainWidget);
|
||||||
|
|
||||||
// Now make the bitmap representing the armed state
|
// Now make the bitmap representing the armed state
|
||||||
if (m_buttonBitmapSelectedOriginal.Ok())
|
if (m_buttonBitmapSelectedOriginal.Ok())
|
||||||
{
|
{
|
||||||
@@ -203,13 +203,13 @@ void wxBitmapButton::DoSetBitmap()
|
|||||||
int backgroundPixel;
|
int backgroundPixel;
|
||||||
XtVaGetValues((Widget) m_mainWidget, XmNarmColor, &backgroundPixel,
|
XtVaGetValues((Widget) m_mainWidget, XmNarmColor, &backgroundPixel,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
wxColour col;
|
wxColour col;
|
||||||
col.SetPixel(backgroundPixel);
|
col.SetPixel(backgroundPixel);
|
||||||
|
|
||||||
wxBitmap newBitmap = wxCreateMaskedBitmap(m_buttonBitmapSelectedOriginal, col);
|
wxBitmap newBitmap = wxCreateMaskedBitmap(m_buttonBitmapSelectedOriginal, col);
|
||||||
m_buttonBitmapSelected = newBitmap;
|
m_buttonBitmapSelected = newBitmap;
|
||||||
|
|
||||||
armPixmap = (Pixmap) m_buttonBitmapSelected.GetPixmap();
|
armPixmap = (Pixmap) m_buttonBitmapSelected.GetPixmap();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -217,14 +217,14 @@ void wxBitmapButton::DoSetBitmap()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
armPixmap = (Pixmap) m_buttonBitmap.GetArmPixmap(m_mainWidget);
|
armPixmap = (Pixmap) m_buttonBitmap.GetArmPixmap(m_mainWidget);
|
||||||
|
|
||||||
if (insensPixmap == pixmap) // <- the Get...Pixmap()-functions return the same pixmap!
|
if (insensPixmap == pixmap) // <- the Get...Pixmap()-functions return the same pixmap!
|
||||||
{
|
{
|
||||||
insensPixmap =
|
insensPixmap =
|
||||||
XCreateInsensitivePixmap(DisplayOfScreen(XtScreen((Widget) m_mainWidget)), pixmap);
|
XCreateInsensitivePixmap(DisplayOfScreen(XtScreen((Widget) m_mainWidget)), pixmap);
|
||||||
m_insensPixmap = (WXPixmap) insensPixmap;
|
m_insensPixmap = (WXPixmap) insensPixmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
XtVaSetValues ((Widget) m_mainWidget,
|
XtVaSetValues ((Widget) m_mainWidget,
|
||||||
XmNlabelPixmap, pixmap,
|
XmNlabelPixmap, pixmap,
|
||||||
XmNlabelInsensitivePixmap, insensPixmap,
|
XmNlabelInsensitivePixmap, insensPixmap,
|
||||||
@@ -248,7 +248,7 @@ void wxBitmapButton::DoSetBitmap()
|
|||||||
void wxBitmapButton::ChangeBackgroundColour()
|
void wxBitmapButton::ChangeBackgroundColour()
|
||||||
{
|
{
|
||||||
DoChangeBackgroundColour(m_mainWidget, m_backgroundColour, TRUE);
|
DoChangeBackgroundColour(m_mainWidget, m_backgroundColour, TRUE);
|
||||||
|
|
||||||
// Must reset the bitmaps since the colours have changed.
|
// Must reset the bitmaps since the colours have changed.
|
||||||
DoSetBitmap();
|
DoSetBitmap();
|
||||||
}
|
}
|
||||||
|
@@ -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>
|
||||||
@@ -41,21 +42,21 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label,
|
|||||||
m_backgroundColour = parent->GetBackgroundColour();
|
m_backgroundColour = parent->GetBackgroundColour();
|
||||||
m_foregroundColour = parent->GetForegroundColour();
|
m_foregroundColour = parent->GetForegroundColour();
|
||||||
m_font = parent->GetFont();
|
m_font = parent->GetFont();
|
||||||
|
|
||||||
parent->AddChild((wxButton *)this);
|
parent->AddChild((wxButton *)this);
|
||||||
|
|
||||||
if (id == -1)
|
if (id == -1)
|
||||||
m_windowId = NewControlId();
|
m_windowId = NewControlId();
|
||||||
else
|
else
|
||||||
m_windowId = id;
|
m_windowId = id;
|
||||||
|
|
||||||
wxString label1(wxStripMenuCodes(label));
|
wxString label1(wxStripMenuCodes(label));
|
||||||
|
|
||||||
XmString text = XmStringCreateSimple ((char*) (const char*) label1);
|
XmString text = XmStringCreateSimple ((char*) (const char*) label1);
|
||||||
Widget parentWidget = (Widget) parent->GetClientWidget();
|
Widget parentWidget = (Widget) parent->GetClientWidget();
|
||||||
|
|
||||||
XmFontList fontList = (XmFontList) m_font.GetFontList(1.0, XtDisplay(parentWidget));
|
XmFontList fontList = (XmFontList) m_font.GetFontList(1.0, XtDisplay(parentWidget));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Patch Note (important)
|
* Patch Note (important)
|
||||||
* There is no major reason to put a defaultButtonThickness here.
|
* There is no major reason to put a defaultButtonThickness here.
|
||||||
@@ -72,29 +73,27 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label,
|
|||||||
XmNlabelString, text,
|
XmNlabelString, text,
|
||||||
// XmNdefaultButtonShadowThickness, 1, // See comment for wxButton::SetDefault
|
// XmNdefaultButtonShadowThickness, 1, // See comment for wxButton::SetDefault
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
XmStringFree (text);
|
XmStringFree (text);
|
||||||
|
|
||||||
XtAddCallback ((Widget) m_mainWidget, XmNactivateCallback, (XtCallbackProc) wxButtonCallback,
|
XtAddCallback ((Widget) m_mainWidget, XmNactivateCallback, (XtCallbackProc) wxButtonCallback,
|
||||||
(XtPointer) this);
|
(XtPointer) this);
|
||||||
|
|
||||||
SetCanAddEventHandler(TRUE);
|
SetCanAddEventHandler(TRUE);
|
||||||
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
|
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
|
||||||
|
|
||||||
ChangeBackgroundColour();
|
ChangeBackgroundColour();
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
||||||
// now -- setting this ressource to 1 for each button in the same row.
|
// now -- setting this ressource to 1 for each button in the same row.
|
||||||
@@ -109,16 +108,16 @@ void wxButton::SetDefault()
|
|||||||
bool managed = XtIsManaged((Widget) item->GetMainWidget());
|
bool managed = XtIsManaged((Widget) item->GetMainWidget());
|
||||||
if (managed)
|
if (managed)
|
||||||
XtUnmanageChild ((Widget) item->GetMainWidget());
|
XtUnmanageChild ((Widget) item->GetMainWidget());
|
||||||
|
|
||||||
XtVaSetValues ((Widget) item->GetMainWidget(),
|
XtVaSetValues ((Widget) item->GetMainWidget(),
|
||||||
XmNdefaultButtonShadowThickness, 1,
|
XmNdefaultButtonShadowThickness, 1,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
@@ -133,7 +132,7 @@ void wxButtonCallback (Widget w, XtPointer clientData, XtPointer WXUNUSED(ptr))
|
|||||||
if (!wxGetWindowFromTable(w))
|
if (!wxGetWindowFromTable(w))
|
||||||
// Widget has been deleted!
|
// Widget has been deleted!
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxButton *item = (wxButton *) clientData;
|
wxButton *item = (wxButton *) clientData;
|
||||||
wxCommandEvent event (wxEVT_COMMAND_BUTTON_CLICKED, item->GetId());
|
wxCommandEvent event (wxEVT_COMMAND_BUTTON_CLICKED, item->GetId());
|
||||||
event.SetEventObject(item);
|
event.SetEventObject(item);
|
||||||
|
@@ -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
|
||||||
|
|
||||||
|
@@ -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
|
||||||
|
@@ -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)
|
||||||
@@ -54,9 +52,9 @@ void wxControl::SetLabel(const wxString& label)
|
|||||||
Widget widget = (Widget) GetLabelWidget() ;
|
Widget widget = (Widget) GetLabelWidget() ;
|
||||||
if (!widget)
|
if (!widget)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxStripMenuCodes((char*) (const char*) label, wxBuffer);
|
wxStripMenuCodes((char*) (const char*) label, wxBuffer);
|
||||||
|
|
||||||
XmString text = XmStringCreateSimple (wxBuffer);
|
XmString text = XmStringCreateSimple (wxBuffer);
|
||||||
XtVaSetValues (widget,
|
XtVaSetValues (widget,
|
||||||
XmNlabelString, text,
|
XmNlabelString, text,
|
||||||
@@ -70,13 +68,13 @@ wxString wxControl::GetLabel() const
|
|||||||
Widget widget = (Widget) GetLabelWidget() ;
|
Widget widget = (Widget) GetLabelWidget() ;
|
||||||
if (!widget)
|
if (!widget)
|
||||||
return wxEmptyString;
|
return wxEmptyString;
|
||||||
|
|
||||||
XmString text;
|
XmString text;
|
||||||
char *s;
|
char *s;
|
||||||
XtVaGetValues (widget,
|
XtVaGetValues (widget,
|
||||||
XmNlabelString, &text,
|
XmNlabelString, &text,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (XmStringGetLtoR (text, XmSTRING_DEFAULT_CHARSET, &s))
|
if (XmStringGetLtoR (text, XmSTRING_DEFAULT_CHARSET, &s))
|
||||||
{
|
{
|
||||||
wxString str(s);
|
wxString str(s);
|
||||||
@@ -110,24 +108,24 @@ void wxControl::ProcessCommand (wxCommandEvent & event)
|
|||||||
void wxControl::Centre (int direction)
|
void wxControl::Centre (int direction)
|
||||||
{
|
{
|
||||||
int x, y, width, height, panel_width, panel_height, new_x, new_y;
|
int x, y, width, height, panel_width, panel_height, new_x, new_y;
|
||||||
|
|
||||||
wxWindow *parent = (wxWindow *) GetParent ();
|
wxWindow *parent = (wxWindow *) GetParent ();
|
||||||
if (!parent)
|
if (!parent)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
parent->GetClientSize (&panel_width, &panel_height);
|
parent->GetClientSize (&panel_width, &panel_height);
|
||||||
GetSize (&width, &height);
|
GetSize (&width, &height);
|
||||||
GetPosition (&x, &y);
|
GetPosition (&x, &y);
|
||||||
|
|
||||||
new_x = x;
|
new_x = x;
|
||||||
new_y = y;
|
new_y = y;
|
||||||
|
|
||||||
if (direction & wxHORIZONTAL)
|
if (direction & wxHORIZONTAL)
|
||||||
new_x = (int) ((panel_width - width) / 2);
|
new_x = (int) ((panel_width - width) / 2);
|
||||||
|
|
||||||
if (direction & wxVERTICAL)
|
if (direction & wxVERTICAL)
|
||||||
new_y = (int) ((panel_height - height) / 2);
|
new_y = (int) ((panel_height - height) / 2);
|
||||||
|
|
||||||
SetSize (new_x, new_y, width, height);
|
SetSize (new_x, new_y, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -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
|
||||||
|
@@ -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__
|
||||||
@@ -94,43 +94,43 @@ bool wxDialog::Create(wxWindow *parent, wxWindowID id,
|
|||||||
m_windowStyle = style;
|
m_windowStyle = style;
|
||||||
m_modalShowing = FALSE;
|
m_modalShowing = FALSE;
|
||||||
m_dialogTitle = title;
|
m_dialogTitle = title;
|
||||||
|
|
||||||
m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);
|
m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);
|
||||||
m_foregroundColour = *wxBLACK;
|
m_foregroundColour = *wxBLACK;
|
||||||
|
|
||||||
SetName(name);
|
SetName(name);
|
||||||
|
|
||||||
if (!parent)
|
if (!parent)
|
||||||
wxTopLevelWindows.Append(this);
|
wxTopLevelWindows.Append(this);
|
||||||
|
|
||||||
if (parent) parent->AddChild(this);
|
if (parent) parent->AddChild(this);
|
||||||
|
|
||||||
if ( id == -1 )
|
if ( id == -1 )
|
||||||
m_windowId = (int)NewControlId();
|
m_windowId = (int)NewControlId();
|
||||||
else
|
else
|
||||||
m_windowId = id;
|
m_windowId = id;
|
||||||
|
|
||||||
Widget parentWidget = (Widget) 0;
|
Widget parentWidget = (Widget) 0;
|
||||||
if (parent)
|
if (parent)
|
||||||
parentWidget = (Widget) parent->GetTopWidget();
|
parentWidget = (Widget) parent->GetTopWidget();
|
||||||
if (!parent)
|
if (!parent)
|
||||||
parentWidget = (Widget) wxTheApp->GetTopLevelWidget();
|
parentWidget = (Widget) wxTheApp->GetTopLevelWidget();
|
||||||
|
|
||||||
wxASSERT_MSG( (parentWidget != (Widget) 0), "Could not find a suitable parent shell for dialog." );
|
wxASSERT_MSG( (parentWidget != (Widget) 0), "Could not find a suitable parent shell for dialog." );
|
||||||
|
|
||||||
Arg args[2];
|
Arg args[2];
|
||||||
XtSetArg (args[0], XmNdefaultPosition, False);
|
XtSetArg (args[0], XmNdefaultPosition, False);
|
||||||
XtSetArg (args[1], XmNautoUnmanage, False);
|
XtSetArg (args[1], XmNautoUnmanage, False);
|
||||||
Widget dialogShell = XmCreateBulletinBoardDialog(parentWidget, (char*) (const char*) name, args, 2);
|
Widget dialogShell = XmCreateBulletinBoardDialog(parentWidget, (char*) (const char*) name, args, 2);
|
||||||
m_mainWidget = (WXWidget) dialogShell;
|
m_mainWidget = (WXWidget) dialogShell;
|
||||||
|
|
||||||
// We don't want margins, since there is enough elsewhere.
|
// We don't want margins, since there is enough elsewhere.
|
||||||
XtVaSetValues(dialogShell,
|
XtVaSetValues(dialogShell,
|
||||||
XmNmarginHeight, 0,
|
XmNmarginHeight, 0,
|
||||||
XmNmarginWidth, 0,
|
XmNmarginWidth, 0,
|
||||||
XmNresizePolicy, XmRESIZE_NONE,
|
XmNresizePolicy, XmRESIZE_NONE,
|
||||||
NULL) ;
|
NULL) ;
|
||||||
|
|
||||||
Widget shell = XtParent(dialogShell) ;
|
Widget shell = XtParent(dialogShell) ;
|
||||||
if (!title.IsNull())
|
if (!title.IsNull())
|
||||||
{
|
{
|
||||||
@@ -140,21 +140,21 @@ bool wxDialog::Create(wxWindow *parent, wxWindowID id,
|
|||||||
NULL);
|
NULL);
|
||||||
XmStringFree(str);
|
XmStringFree(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_font = wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
|
m_font = wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
|
||||||
ChangeFont(FALSE);
|
ChangeFont(FALSE);
|
||||||
|
|
||||||
wxAddWindowToTable(dialogShell, this);
|
wxAddWindowToTable(dialogShell, this);
|
||||||
|
|
||||||
// Intercept CLOSE messages from the window manager
|
// Intercept CLOSE messages from the window manager
|
||||||
Atom WM_DELETE_WINDOW = XmInternAtom(XtDisplay(shell), "WM_DELETE_WINDOW", False);
|
Atom WM_DELETE_WINDOW = XmInternAtom(XtDisplay(shell), "WM_DELETE_WINDOW", False);
|
||||||
|
|
||||||
/* Remove and add WM_DELETE_WINDOW so ours is only handler */
|
/* Remove and add WM_DELETE_WINDOW so ours is only handler */
|
||||||
/* Why do we have to do this for wxDialog, but not wxFrame? */
|
/* Why do we have to do this for wxDialog, but not wxFrame? */
|
||||||
XmRemoveWMProtocols(shell, &WM_DELETE_WINDOW, 1);
|
XmRemoveWMProtocols(shell, &WM_DELETE_WINDOW, 1);
|
||||||
XmAddWMProtocols(shell, &WM_DELETE_WINDOW, 1);
|
XmAddWMProtocols(shell, &WM_DELETE_WINDOW, 1);
|
||||||
XmActivateWMProtocol(shell, WM_DELETE_WINDOW);
|
XmActivateWMProtocol(shell, WM_DELETE_WINDOW);
|
||||||
|
|
||||||
// Modified Steve Hammes for Motif 2.0
|
// Modified Steve Hammes for Motif 2.0
|
||||||
#if (XmREVISION > 1 || XmVERSION > 1)
|
#if (XmREVISION > 1 || XmVERSION > 1)
|
||||||
XmAddWMProtocolCallback(shell, WM_DELETE_WINDOW, (XtCallbackProc) wxCloseDialogCallback, (XtPointer)this);
|
XmAddWMProtocolCallback(shell, WM_DELETE_WINDOW, (XtCallbackProc) wxCloseDialogCallback, (XtPointer)this);
|
||||||
@@ -163,14 +163,14 @@ bool wxDialog::Create(wxWindow *parent, wxWindowID id,
|
|||||||
#else
|
#else
|
||||||
XmAddWMProtocolCallback(shell, WM_DELETE_WINDOW, (void (*)())wxCloseDialogCallback, (caddr_t)this);
|
XmAddWMProtocolCallback(shell, WM_DELETE_WINDOW, (void (*)())wxCloseDialogCallback, (caddr_t)this);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
XtTranslations ptr ;
|
XtTranslations ptr ;
|
||||||
XtOverrideTranslations(dialogShell,
|
XtOverrideTranslations(dialogShell,
|
||||||
ptr = XtParseTranslationTable("<Configure>: resize()"));
|
ptr = XtParseTranslationTable("<Configure>: resize()"));
|
||||||
XtFree((char *)ptr);
|
XtFree((char *)ptr);
|
||||||
|
|
||||||
// Can't remember what this was about... but I think it's necessary.
|
// Can't remember what this was about... but I think it's necessary.
|
||||||
|
|
||||||
if (wxUSE_INVISIBLE_RESIZE)
|
if (wxUSE_INVISIBLE_RESIZE)
|
||||||
{
|
{
|
||||||
if (pos.x > -1)
|
if (pos.x > -1)
|
||||||
@@ -179,13 +179,13 @@ bool wxDialog::Create(wxWindow *parent, wxWindowID id,
|
|||||||
if (pos.y > -1)
|
if (pos.y > -1)
|
||||||
XtVaSetValues(dialogShell, XmNy, pos.y,
|
XtVaSetValues(dialogShell, XmNy, pos.y,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (size.x > -1)
|
if (size.x > -1)
|
||||||
XtVaSetValues(dialogShell, XmNwidth, size.x, NULL);
|
XtVaSetValues(dialogShell, XmNwidth, size.x, NULL);
|
||||||
if (size.y > -1)
|
if (size.y > -1)
|
||||||
XtVaSetValues(dialogShell, XmNheight, size.y, NULL);
|
XtVaSetValues(dialogShell, XmNheight, size.y, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This patch come from Torsten Liermann lier@lier1.muc.de
|
// This patch come from Torsten Liermann lier@lier1.muc.de
|
||||||
if (XmIsMotifWMRunning(shell))
|
if (XmIsMotifWMRunning(shell))
|
||||||
{
|
{
|
||||||
@@ -204,7 +204,7 @@ bool wxDialog::Create(wxWindow *parent, wxWindowID id,
|
|||||||
decor |= MWM_DECOR_MINIMIZE;
|
decor |= MWM_DECOR_MINIMIZE;
|
||||||
if (m_windowStyle & wxMAXIMIZE_BOX)
|
if (m_windowStyle & wxMAXIMIZE_BOX)
|
||||||
decor |= MWM_DECOR_MAXIMIZE;
|
decor |= MWM_DECOR_MAXIMIZE;
|
||||||
|
|
||||||
XtVaSetValues(shell,XmNmwmDecorations,decor,NULL) ;
|
XtVaSetValues(shell,XmNmwmDecorations,decor,NULL) ;
|
||||||
}
|
}
|
||||||
// This allows non-Motif window managers to support at least the
|
// This allows non-Motif window managers to support at least the
|
||||||
@@ -214,18 +214,18 @@ bool wxDialog::Create(wxWindow *parent, wxWindowID id,
|
|||||||
if ((m_windowStyle & wxCAPTION) != wxCAPTION)
|
if ((m_windowStyle & wxCAPTION) != wxCAPTION)
|
||||||
XtVaSetValues((Widget) shell,XmNoverrideRedirect,TRUE,NULL);
|
XtVaSetValues((Widget) shell,XmNoverrideRedirect,TRUE,NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
XtRealizeWidget(dialogShell);
|
XtRealizeWidget(dialogShell);
|
||||||
|
|
||||||
XtAddCallback(dialogShell,XmNunmapCallback,
|
XtAddCallback(dialogShell,XmNunmapCallback,
|
||||||
(XtCallbackProc)wxUnmapBulletinBoard,this) ;
|
(XtCallbackProc)wxUnmapBulletinBoard,this) ;
|
||||||
|
|
||||||
// Positioning of the dialog doesn't work properly unless the dialog
|
// Positioning of the dialog doesn't work properly unless the dialog
|
||||||
// is managed, so we manage without mapping to the screen.
|
// is managed, so we manage without mapping to the screen.
|
||||||
// To show, we map the shell (actually it's parent).
|
// To show, we map the shell (actually it's parent).
|
||||||
if (!wxUSE_INVISIBLE_RESIZE)
|
if (!wxUSE_INVISIBLE_RESIZE)
|
||||||
XtVaSetValues(shell, XmNmappedWhenManaged, FALSE, NULL);
|
XtVaSetValues(shell, XmNmappedWhenManaged, FALSE, NULL);
|
||||||
|
|
||||||
if (!wxUSE_INVISIBLE_RESIZE)
|
if (!wxUSE_INVISIBLE_RESIZE)
|
||||||
{
|
{
|
||||||
XtManageChild(dialogShell);
|
XtManageChild(dialogShell);
|
||||||
@@ -233,15 +233,15 @@ bool wxDialog::Create(wxWindow *parent, wxWindowID id,
|
|||||||
}
|
}
|
||||||
XtAddEventHandler(dialogShell,ExposureMask,FALSE,
|
XtAddEventHandler(dialogShell,ExposureMask,FALSE,
|
||||||
wxUniversalRepaintProc, (XtPointer) this);
|
wxUniversalRepaintProc, (XtPointer) this);
|
||||||
|
|
||||||
XtAddEventHandler(dialogShell,
|
XtAddEventHandler(dialogShell,
|
||||||
ButtonPressMask | ButtonReleaseMask | PointerMotionMask | KeyPressMask,
|
ButtonPressMask | ButtonReleaseMask | PointerMotionMask | KeyPressMask,
|
||||||
FALSE,
|
FALSE,
|
||||||
wxDialogBoxEventHandler,
|
wxDialogBoxEventHandler,
|
||||||
(XtPointer)this);
|
(XtPointer)this);
|
||||||
|
|
||||||
ChangeBackgroundColour();
|
ChangeBackgroundColour();
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,7 +252,7 @@ void wxDialog::SetModal(bool flag)
|
|||||||
else
|
else
|
||||||
if ( m_windowStyle & wxDIALOG_MODAL )
|
if ( m_windowStyle & wxDIALOG_MODAL )
|
||||||
m_windowStyle -= wxDIALOG_MODAL ;
|
m_windowStyle -= wxDIALOG_MODAL ;
|
||||||
|
|
||||||
wxModelessWindows.DeleteObject(this);
|
wxModelessWindows.DeleteObject(this);
|
||||||
if (!flag)
|
if (!flag)
|
||||||
wxModelessWindows.Append(this);
|
wxModelessWindows.Append(this);
|
||||||
@@ -263,29 +263,29 @@ wxDialog::~wxDialog()
|
|||||||
if (m_mainWidget)
|
if (m_mainWidget)
|
||||||
XtRemoveEventHandler((Widget) m_mainWidget, ExposureMask, FALSE,
|
XtRemoveEventHandler((Widget) m_mainWidget, ExposureMask, FALSE,
|
||||||
wxUniversalRepaintProc, (XtPointer) this);
|
wxUniversalRepaintProc, (XtPointer) this);
|
||||||
|
|
||||||
m_modalShowing = FALSE;
|
m_modalShowing = FALSE;
|
||||||
if (!wxUSE_INVISIBLE_RESIZE && m_mainWidget)
|
if (!wxUSE_INVISIBLE_RESIZE && m_mainWidget)
|
||||||
{
|
{
|
||||||
XtUnmapWidget((Widget) m_mainWidget);
|
XtUnmapWidget((Widget) m_mainWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxTopLevelWindows.DeleteObject(this);
|
wxTopLevelWindows.DeleteObject(this);
|
||||||
|
|
||||||
if ( (GetWindowStyleFlag() & wxDIALOG_MODAL) != wxDIALOG_MODAL )
|
if ( (GetWindowStyleFlag() & wxDIALOG_MODAL) != wxDIALOG_MODAL )
|
||||||
wxModelessWindows.DeleteObject(this);
|
wxModelessWindows.DeleteObject(this);
|
||||||
|
|
||||||
// If this is the last top-level window, exit.
|
// If this is the last top-level window, exit.
|
||||||
if (wxTheApp && (wxTopLevelWindows.Number() == 0))
|
if (wxTheApp && (wxTopLevelWindows.Number() == 0))
|
||||||
{
|
{
|
||||||
wxTheApp->SetTopWindow(NULL);
|
wxTheApp->SetTopWindow(NULL);
|
||||||
|
|
||||||
if (wxTheApp->GetExitOnFrameDelete())
|
if (wxTheApp->GetExitOnFrameDelete())
|
||||||
{
|
{
|
||||||
wxTheApp->ExitMainLoop();
|
wxTheApp->ExitMainLoop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// This event-flushing code used to be in wxWindow::PostDestroyChildren (wx_dialog.cpp)
|
// This event-flushing code used to be in wxWindow::PostDestroyChildren (wx_dialog.cpp)
|
||||||
// but I think this should work, if we destroy the children first.
|
// but I think this should work, if we destroy the children first.
|
||||||
// Note that this might need to be done for wxFrame also.
|
// Note that this might need to be done for wxFrame also.
|
||||||
@@ -312,7 +312,7 @@ void wxDialog::OnCharHook(wxKeyEvent& event)
|
|||||||
wxCommandEvent cancelEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
|
wxCommandEvent cancelEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
|
||||||
cancelEvent.SetEventObject( this );
|
cancelEvent.SetEventObject( this );
|
||||||
GetEventHandler()->ProcessEvent(cancelEvent);
|
GetEventHandler()->ProcessEvent(cancelEvent);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// We didn't process this event.
|
// We didn't process this event.
|
||||||
@@ -355,7 +355,7 @@ void wxDialog::SetTitle(const wxString& title)
|
|||||||
if (!title.IsNull())
|
if (!title.IsNull())
|
||||||
{
|
{
|
||||||
XmString str = XmStringCreateSimple((char*) (const char*) title);
|
XmString str = XmStringCreateSimple((char*) (const char*) title);
|
||||||
XtVaSetValues((Widget) m_mainWidget,
|
XtVaSetValues((Widget) m_mainWidget,
|
||||||
XmNtitle, (char*) (const char*) title,
|
XmNtitle, (char*) (const char*) title,
|
||||||
XmNdialogTitle, str, // Roberto Cocchi
|
XmNdialogTitle, str, // Roberto Cocchi
|
||||||
XmNiconName, (char*) (const char*) title,
|
XmNiconName, (char*) (const char*) title,
|
||||||
@@ -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),
|
||||||
@@ -435,16 +406,16 @@ void wxDialog::Lower()
|
|||||||
bool wxDialog::Show(bool show)
|
bool wxDialog::Show(bool show)
|
||||||
{
|
{
|
||||||
m_isShown = show;
|
m_isShown = show;
|
||||||
|
|
||||||
if (show)
|
if (show)
|
||||||
{
|
{
|
||||||
if (!wxUSE_INVISIBLE_RESIZE)
|
if (!wxUSE_INVISIBLE_RESIZE)
|
||||||
XtMapWidget(XtParent((Widget) m_mainWidget));
|
XtMapWidget(XtParent((Widget) m_mainWidget));
|
||||||
else
|
else
|
||||||
XtManageChild((Widget) m_mainWidget) ;
|
XtManageChild((Widget) m_mainWidget) ;
|
||||||
|
|
||||||
XRaiseWindow(XtDisplay((Widget) m_mainWidget), XtWindow((Widget) m_mainWidget));
|
XRaiseWindow(XtDisplay((Widget) m_mainWidget), XtWindow((Widget) m_mainWidget));
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -452,11 +423,11 @@ bool wxDialog::Show(bool show)
|
|||||||
XtUnmapWidget(XtParent((Widget) m_mainWidget));
|
XtUnmapWidget(XtParent((Widget) m_mainWidget));
|
||||||
else
|
else
|
||||||
XtUnmanageChild((Widget) m_mainWidget) ;
|
XtUnmanageChild((Widget) m_mainWidget) ;
|
||||||
|
|
||||||
XFlush(XtDisplay((Widget) wxTheApp->GetTopLevelWidget()));
|
XFlush(XtDisplay((Widget) wxTheApp->GetTopLevelWidget()));
|
||||||
XSync(XtDisplay((Widget) wxTheApp->GetTopLevelWidget()), FALSE);
|
XSync(XtDisplay((Widget) wxTheApp->GetTopLevelWidget()), FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -464,43 +435,43 @@ bool wxDialog::Show(bool show)
|
|||||||
int wxDialog::ShowModal()
|
int wxDialog::ShowModal()
|
||||||
{
|
{
|
||||||
m_windowStyle |= wxDIALOG_MODAL;
|
m_windowStyle |= wxDIALOG_MODAL;
|
||||||
|
|
||||||
Show(TRUE);
|
Show(TRUE);
|
||||||
|
|
||||||
if (m_modalShowing)
|
if (m_modalShowing)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
wxModalShowingStack.Insert((wxObject *)TRUE);
|
wxModalShowingStack.Insert((wxObject *)TRUE);
|
||||||
|
|
||||||
m_modalShowing = TRUE;
|
m_modalShowing = TRUE;
|
||||||
XtAddGrab((Widget) m_mainWidget, TRUE, FALSE);
|
XtAddGrab((Widget) m_mainWidget, TRUE, FALSE);
|
||||||
|
|
||||||
XEvent event;
|
XEvent event;
|
||||||
|
|
||||||
// Loop until we signal that the dialog should be closed
|
// Loop until we signal that the dialog should be closed
|
||||||
while ((wxModalShowingStack.Number() > 0) && ((int)(wxModalShowingStack.First()->Data()) != 0))
|
while ((wxModalShowingStack.Number() > 0) && ((int)(wxModalShowingStack.First()->Data()) != 0))
|
||||||
{
|
{
|
||||||
// XtAppProcessEvent((XtAppContext) wxTheApp->GetAppContext(), XtIMAll);
|
// XtAppProcessEvent((XtAppContext) wxTheApp->GetAppContext(), XtIMAll);
|
||||||
|
|
||||||
XtAppNextEvent((XtAppContext) wxTheApp->GetAppContext(), &event);
|
XtAppNextEvent((XtAppContext) wxTheApp->GetAppContext(), &event);
|
||||||
wxTheApp->ProcessXEvent((WXEvent*) &event);
|
wxTheApp->ProcessXEvent((WXEvent*) &event);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove modal dialog flag from stack
|
// Remove modal dialog flag from stack
|
||||||
wxNode *node = wxModalShowingStack.First();
|
wxNode *node = wxModalShowingStack.First();
|
||||||
if (node)
|
if (node)
|
||||||
delete node;
|
delete node;
|
||||||
|
|
||||||
// Now process all events in case they get sent to a destroyed dialog
|
// Now process all events in case they get sent to a destroyed dialog
|
||||||
XSync(XtDisplay((Widget) wxTheApp->GetTopLevelWidget()), FALSE);
|
XSync(XtDisplay((Widget) wxTheApp->GetTopLevelWidget()), FALSE);
|
||||||
while (XtAppPending((XtAppContext) wxTheApp->GetAppContext()))
|
while (XtAppPending((XtAppContext) wxTheApp->GetAppContext()))
|
||||||
{
|
{
|
||||||
XFlush(XtDisplay((Widget) wxTheApp->GetTopLevelWidget()));
|
XFlush(XtDisplay((Widget) wxTheApp->GetTopLevelWidget()));
|
||||||
XtAppNextEvent((XtAppContext) wxTheApp->GetAppContext(), &event);
|
XtAppNextEvent((XtAppContext) wxTheApp->GetAppContext(), &event);
|
||||||
|
|
||||||
wxTheApp->ProcessXEvent((WXEvent*) &event);
|
wxTheApp->ProcessXEvent((WXEvent*) &event);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: is it safe to call this, if the dialog may have been deleted
|
// TODO: is it safe to call this, if the dialog may have been deleted
|
||||||
// by now? Probably only if we're using delayed deletion of dialogs.
|
// by now? Probably only if we're using delayed deletion of dialogs.
|
||||||
return GetReturnCode();
|
return GetReturnCode();
|
||||||
@@ -510,16 +481,16 @@ void wxDialog::EndModal(int retCode)
|
|||||||
{
|
{
|
||||||
if (!m_modalShowing)
|
if (!m_modalShowing)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SetReturnCode(retCode);
|
SetReturnCode(retCode);
|
||||||
|
|
||||||
// Strangely, we don't seem to need this now.
|
// Strangely, we don't seem to need this now.
|
||||||
// XtRemoveGrab((Widget) m_mainWidget);
|
// XtRemoveGrab((Widget) m_mainWidget);
|
||||||
|
|
||||||
Show(FALSE);
|
Show(FALSE);
|
||||||
|
|
||||||
m_modalShowing = FALSE;
|
m_modalShowing = FALSE;
|
||||||
|
|
||||||
wxNode *node = wxModalShowingStack.First();
|
wxNode *node = wxModalShowingStack.First();
|
||||||
if (node)
|
if (node)
|
||||||
node->SetData((wxObject *)FALSE);
|
node->SetData((wxObject *)FALSE);
|
||||||
@@ -575,12 +546,12 @@ void wxDialog::OnCloseWindow(wxCloseEvent& event)
|
|||||||
// The default OnCancel (above) simply ends a modal dialog, and hides a modeless dialog.
|
// The default OnCancel (above) simply ends a modal dialog, and hides a modeless dialog.
|
||||||
|
|
||||||
static wxList closing;
|
static wxList closing;
|
||||||
|
|
||||||
if ( closing.Member(this) )
|
if ( closing.Member(this) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
closing.Append(this);
|
closing.Append(this);
|
||||||
|
|
||||||
wxCommandEvent cancelEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
|
wxCommandEvent cancelEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
|
||||||
cancelEvent.SetEventObject( this );
|
cancelEvent.SetEventObject( this );
|
||||||
GetEventHandler()->ProcessEvent(cancelEvent); // This may close the dialog
|
GetEventHandler()->ProcessEvent(cancelEvent); // This may close the dialog
|
||||||
@@ -607,29 +578,24 @@ 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))
|
||||||
{
|
{
|
||||||
wxDialog *dialog = (wxDialog *)client_data;
|
wxDialog *dialog = (wxDialog *)client_data;
|
||||||
wxCloseEvent closeEvent(wxEVT_CLOSE_WINDOW, dialog->GetId());
|
wxCloseEvent closeEvent(wxEVT_CLOSE_WINDOW, dialog->GetId());
|
||||||
closeEvent.SetEventObject(dialog);
|
closeEvent.SetEventObject(dialog);
|
||||||
|
|
||||||
// May delete the dialog (with delayed deletion)
|
// May delete the dialog (with delayed deletion)
|
||||||
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -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
|
||||||
|
|
||||||
|
|
||||||
@@ -51,27 +51,27 @@ wxString wxFileSelector(const char *title,
|
|||||||
{
|
{
|
||||||
// If there's a default extension specified but no filter, we create a suitable
|
// If there's a default extension specified but no filter, we create a suitable
|
||||||
// filter.
|
// filter.
|
||||||
|
|
||||||
wxString filter2("");
|
wxString filter2("");
|
||||||
if ( defaultExtension && !filter )
|
if ( defaultExtension && !filter )
|
||||||
filter2 = wxString("*.") + wxString(defaultExtension) ;
|
filter2 = wxString("*.") + wxString(defaultExtension) ;
|
||||||
else if ( filter )
|
else if ( filter )
|
||||||
filter2 = filter;
|
filter2 = filter;
|
||||||
|
|
||||||
wxString defaultDirString;
|
wxString defaultDirString;
|
||||||
if (defaultDir)
|
if (defaultDir)
|
||||||
defaultDirString = defaultDir;
|
defaultDirString = defaultDir;
|
||||||
else
|
else
|
||||||
defaultDirString = "";
|
defaultDirString = "";
|
||||||
|
|
||||||
wxString defaultFilenameString;
|
wxString defaultFilenameString;
|
||||||
if (defaultFileName)
|
if (defaultFileName)
|
||||||
defaultFilenameString = defaultFileName;
|
defaultFilenameString = defaultFileName;
|
||||||
else
|
else
|
||||||
defaultFilenameString = "";
|
defaultFilenameString = "";
|
||||||
|
|
||||||
wxFileDialog fileDialog(parent, title, defaultDirString, defaultFilenameString, filter2, flags, wxPoint(x, y));
|
wxFileDialog fileDialog(parent, title, defaultDirString, defaultFilenameString, filter2, flags, wxPoint(x, y));
|
||||||
|
|
||||||
if ( fileDialog.ShowModal() == wxID_OK )
|
if ( fileDialog.ShowModal() == wxID_OK )
|
||||||
{
|
{
|
||||||
return fileDialog.GetPath();
|
return fileDialog.GetPath();
|
||||||
@@ -89,11 +89,11 @@ wxString wxFileSelectorEx(const char *title,
|
|||||||
wxWindow* parent,
|
wxWindow* parent,
|
||||||
int x,
|
int x,
|
||||||
int y)
|
int y)
|
||||||
|
|
||||||
{
|
{
|
||||||
wxFileDialog fileDialog(parent, title ? title : "", defaultDir ? defaultDir : "",
|
wxFileDialog fileDialog(parent, title ? title : "", defaultDir ? defaultDir : "",
|
||||||
defaultFileName ? defaultFileName : "", filter ? filter : "", flags, wxPoint(x, y));
|
defaultFileName ? defaultFileName : "", filter ? filter : "", flags, wxPoint(x, y));
|
||||||
|
|
||||||
if ( fileDialog.ShowModal() == wxID_OK )
|
if ( fileDialog.ShowModal() == wxID_OK )
|
||||||
{
|
{
|
||||||
*defaultFilterIndex = fileDialog.GetFilterIndex();
|
*defaultFilterIndex = fileDialog.GetFilterIndex();
|
||||||
@@ -106,7 +106,7 @@ wxString wxFileSelectorEx(const char *title,
|
|||||||
wxString wxFileDialog::m_fileSelectorAnswer = "";
|
wxString wxFileDialog::m_fileSelectorAnswer = "";
|
||||||
bool wxFileDialog::m_fileSelectorReturned = FALSE;
|
bool wxFileDialog::m_fileSelectorReturned = FALSE;
|
||||||
|
|
||||||
void wxFileSelCancel( Widget WXUNUSED(fs), XtPointer WXUNUSED(client_data),
|
void wxFileSelCancel( Widget WXUNUSED(fs), XtPointer WXUNUSED(client_data),
|
||||||
XmFileSelectionBoxCallbackStruct *WXUNUSED(cbs) )
|
XmFileSelectionBoxCallbackStruct *WXUNUSED(cbs) )
|
||||||
{
|
{
|
||||||
wxFileDialog::m_fileSelectorAnswer = "";
|
wxFileDialog::m_fileSelectorAnswer = "";
|
||||||
@@ -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;
|
||||||
@@ -157,13 +157,13 @@ static void wxChangeListBoxColours(wxWindow* win, Widget widget)
|
|||||||
XmNhorizontalScrollBar, &hsb,
|
XmNhorizontalScrollBar, &hsb,
|
||||||
XmNverticalScrollBar, &vsb,
|
XmNverticalScrollBar, &vsb,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
/* TODO: should scrollbars be affected? Should probably have separate
|
/* TODO: should scrollbars be affected? Should probably have separate
|
||||||
* 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,
|
||||||
@@ -178,7 +178,7 @@ static void wxChangeListBoxColours(wxWindow* win, Widget widget)
|
|||||||
int wxFileDialog::ShowModal()
|
int wxFileDialog::ShowModal()
|
||||||
{
|
{
|
||||||
wxBeginBusyCursor();
|
wxBeginBusyCursor();
|
||||||
|
|
||||||
// static char fileBuf[512];
|
// static char fileBuf[512];
|
||||||
Widget parentWidget = (Widget) 0;
|
Widget parentWidget = (Widget) 0;
|
||||||
if (m_parent)
|
if (m_parent)
|
||||||
@@ -187,7 +187,7 @@ int wxFileDialog::ShowModal()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
parentWidget = (Widget) wxTheApp->GetTopLevelWidget();
|
parentWidget = (Widget) wxTheApp->GetTopLevelWidget();
|
||||||
|
|
||||||
Widget fileSel = XmCreateFileSelectionDialog(parentWidget, "file_selector", NULL, 0);
|
Widget fileSel = XmCreateFileSelectionDialog(parentWidget, "file_selector", NULL, 0);
|
||||||
XtUnmanageChild(XmFileSelectionBoxGetChild(fileSel, XmDIALOG_HELP_BUTTON));
|
XtUnmanageChild(XmFileSelectionBoxGetChild(fileSel, XmDIALOG_HELP_BUTTON));
|
||||||
|
|
||||||
@@ -195,18 +195,22 @@ 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);
|
||||||
|
|
||||||
if (!m_message.IsNull())
|
if (!m_message.IsNull())
|
||||||
XtVaSetValues(shell, XmNtitle, (char*) (const char*) m_message, NULL);
|
XtVaSetValues(shell, XmNtitle, (char*) (const char*) m_message, NULL);
|
||||||
|
|
||||||
wxString entirePath("");
|
wxString entirePath("");
|
||||||
|
|
||||||
if ((m_dir != "") && (m_fileName != ""))
|
if ((m_dir != "") && (m_fileName != ""))
|
||||||
{
|
{
|
||||||
entirePath = m_dir + wxString("/") + m_fileName;
|
entirePath = m_dir + wxString("/") + m_fileName;
|
||||||
@@ -219,12 +223,12 @@ int wxFileDialog::ShowModal()
|
|||||||
{
|
{
|
||||||
entirePath = m_fileName;
|
entirePath = m_fileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entirePath != "")
|
if (entirePath != "")
|
||||||
{
|
{
|
||||||
XmTextSetString(selectionWidget, (char*) (const char*) entirePath);
|
XmTextSetString(selectionWidget, (char*) (const char*) entirePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_wildCard != "")
|
if (m_wildCard != "")
|
||||||
{
|
{
|
||||||
wxString filter("");
|
wxString filter("");
|
||||||
@@ -232,28 +236,28 @@ int wxFileDialog::ShowModal()
|
|||||||
filter = m_dir + wxString("/") + m_wildCard;
|
filter = m_dir + wxString("/") + m_wildCard;
|
||||||
else
|
else
|
||||||
filter = m_wildCard;
|
filter = m_wildCard;
|
||||||
|
|
||||||
XmTextSetString(filterWidget, (char*) (const char*) filter);
|
XmTextSetString(filterWidget, (char*) (const char*) filter);
|
||||||
XmFileSelectionDoSearch(fileSel, NULL);
|
XmFileSelectionDoSearch(fileSel, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Suggested by Terry Gitnick, 16/9/97, because of change in Motif
|
// Suggested by Terry Gitnick, 16/9/97, because of change in Motif
|
||||||
// file selector on Solaris 1.5.1.
|
// file selector on Solaris 1.5.1.
|
||||||
if ( m_dir != "" )
|
if ( m_dir != "" )
|
||||||
{
|
{
|
||||||
XmString thePath = XmStringCreateLtoR ((char*) (const char*) m_dir,
|
XmString thePath = XmStringCreateLtoR ((char*) (const char*) m_dir,
|
||||||
XmSTRING_DEFAULT_CHARSET);
|
XmSTRING_DEFAULT_CHARSET);
|
||||||
|
|
||||||
XtVaSetValues (fileSel,
|
XtVaSetValues (fileSel,
|
||||||
XmNdirectory, thePath,
|
XmNdirectory, thePath,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
XmStringFree(thePath);
|
XmStringFree(thePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
XtAddCallback(fileSel, XmNcancelCallback, (XtCallbackProc)wxFileSelCancel, (XtPointer)NULL);
|
XtAddCallback(fileSel, XmNcancelCallback, (XtCallbackProc)wxFileSelCancel, (XtPointer)NULL);
|
||||||
XtAddCallback(fileSel, XmNokCallback, (XtCallbackProc)wxFileSelOk, (XtPointer)NULL);
|
XtAddCallback(fileSel, XmNokCallback, (XtCallbackProc)wxFileSelOk, (XtPointer)NULL);
|
||||||
|
|
||||||
//#if XmVersion > 1000
|
//#if XmVersion > 1000
|
||||||
// I'm not sure about what you mean with XmVersion.
|
// I'm not sure about what you mean with XmVersion.
|
||||||
// If this is for Motif1.1/Motif1.2, then check XmVersion>=1200
|
// If this is for Motif1.1/Motif1.2, then check XmVersion>=1200
|
||||||
@@ -273,22 +277,23 @@ 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);
|
||||||
|
|
||||||
XtManageChild(fileSel);
|
XtManageChild(fileSel);
|
||||||
|
|
||||||
m_fileSelectorAnswer = "";
|
m_fileSelectorAnswer = "";
|
||||||
m_fileSelectorReturned = FALSE;
|
m_fileSelectorReturned = FALSE;
|
||||||
|
|
||||||
wxEndBusyCursor();
|
wxEndBusyCursor();
|
||||||
|
|
||||||
XtAddGrab(XtParent(fileSel), TRUE, FALSE);
|
XtAddGrab(XtParent(fileSel), TRUE, FALSE);
|
||||||
XEvent event;
|
XEvent event;
|
||||||
while (!m_fileSelectorReturned)
|
while (!m_fileSelectorReturned)
|
||||||
@@ -296,13 +301,13 @@ int wxFileDialog::ShowModal()
|
|||||||
XtAppProcessEvent((XtAppContext) wxTheApp->GetAppContext(), XtIMAll);
|
XtAppProcessEvent((XtAppContext) wxTheApp->GetAppContext(), XtIMAll);
|
||||||
}
|
}
|
||||||
XtRemoveGrab(XtParent(fileSel));
|
XtRemoveGrab(XtParent(fileSel));
|
||||||
|
|
||||||
XmUpdateDisplay((Widget) wxTheApp->GetTopLevelWidget()); // Experimental
|
XmUpdateDisplay((Widget) wxTheApp->GetTopLevelWidget()); // Experimental
|
||||||
|
|
||||||
// XtDestroyWidget(fileSel);
|
// XtDestroyWidget(fileSel);
|
||||||
XtUnmapWidget(XtParent(fileSel));
|
XtUnmapWidget(XtParent(fileSel));
|
||||||
XtDestroyWidget(XtParent(fileSel));
|
XtDestroyWidget(XtParent(fileSel));
|
||||||
|
|
||||||
// Now process all events, because otherwise
|
// Now process all events, because otherwise
|
||||||
// this might remain on the screen
|
// this might remain on the screen
|
||||||
XSync(XtDisplay((Widget) wxTheApp->GetTopLevelWidget()), FALSE);
|
XSync(XtDisplay((Widget) wxTheApp->GetTopLevelWidget()), FALSE);
|
||||||
@@ -312,11 +317,11 @@ int wxFileDialog::ShowModal()
|
|||||||
XtAppNextEvent((XtAppContext) wxTheApp->GetAppContext(), &event);
|
XtAppNextEvent((XtAppContext) wxTheApp->GetAppContext(), &event);
|
||||||
XtDispatchEvent(&event);
|
XtDispatchEvent(&event);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_path = m_fileSelectorAnswer;
|
m_path = m_fileSelectorAnswer;
|
||||||
m_fileName = wxFileNameFromPath(m_fileSelectorAnswer);
|
m_fileName = wxFileNameFromPath(m_fileSelectorAnswer);
|
||||||
m_dir = wxPathOnly(m_path);
|
m_dir = wxPathOnly(m_path);
|
||||||
|
|
||||||
if (m_fileName == "")
|
if (m_fileName == "")
|
||||||
return wxID_CANCEL;
|
return wxID_CANCEL;
|
||||||
else
|
else
|
||||||
@@ -328,19 +333,20 @@ static wxString
|
|||||||
wxDefaultFileSelector(bool load, const char *what, const char *extension, const char *default_name, wxWindow *parent)
|
wxDefaultFileSelector(bool load, const char *what, const char *extension, const char *default_name, wxWindow *parent)
|
||||||
{
|
{
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ wxFontRefData::wxFontRefData(const wxFontRefData& data)
|
|||||||
m_weight = data.m_weight;
|
m_weight = data.m_weight;
|
||||||
m_underlined = data.m_underlined;
|
m_underlined = data.m_underlined;
|
||||||
m_faceName = data.m_faceName;
|
m_faceName = data.m_faceName;
|
||||||
|
|
||||||
// Don't have to copy actual fonts, because they'll be created
|
// Don't have to copy actual fonts, because they'll be created
|
||||||
// on demand.
|
// on demand.
|
||||||
}
|
}
|
||||||
@@ -91,7 +91,7 @@ wxFont::wxFont()
|
|||||||
wxFont::wxFont(int pointSize, int family, int style, int weight, bool underlined, const wxString& faceName)
|
wxFont::wxFont(int pointSize, int family, int style, int weight, bool underlined, const wxString& faceName)
|
||||||
{
|
{
|
||||||
Create(pointSize, family, style, weight, underlined, faceName);
|
Create(pointSize, family, style, weight, underlined, faceName);
|
||||||
|
|
||||||
if ( wxTheFontList )
|
if ( wxTheFontList )
|
||||||
wxTheFontList->Append(this);
|
wxTheFontList->Append(this);
|
||||||
}
|
}
|
||||||
@@ -100,16 +100,16 @@ bool wxFont::Create(int pointSize, int family, int style, int weight, bool under
|
|||||||
{
|
{
|
||||||
UnRef();
|
UnRef();
|
||||||
m_refData = new wxFontRefData;
|
m_refData = new wxFontRefData;
|
||||||
|
|
||||||
M_FONTDATA->m_family = family;
|
M_FONTDATA->m_family = family;
|
||||||
M_FONTDATA->m_style = style;
|
M_FONTDATA->m_style = style;
|
||||||
M_FONTDATA->m_weight = weight;
|
M_FONTDATA->m_weight = weight;
|
||||||
M_FONTDATA->m_pointSize = pointSize;
|
M_FONTDATA->m_pointSize = pointSize;
|
||||||
M_FONTDATA->m_underlined = underlined;
|
M_FONTDATA->m_underlined = underlined;
|
||||||
M_FONTDATA->m_faceName = faceName;
|
M_FONTDATA->m_faceName = faceName;
|
||||||
|
|
||||||
RealizeResource();
|
RealizeResource();
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,54 +143,54 @@ void wxFont::Unshare()
|
|||||||
void wxFont::SetPointSize(int pointSize)
|
void wxFont::SetPointSize(int pointSize)
|
||||||
{
|
{
|
||||||
Unshare();
|
Unshare();
|
||||||
|
|
||||||
M_FONTDATA->m_pointSize = pointSize;
|
M_FONTDATA->m_pointSize = pointSize;
|
||||||
|
|
||||||
RealizeResource();
|
RealizeResource();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFont::SetFamily(int family)
|
void wxFont::SetFamily(int family)
|
||||||
{
|
{
|
||||||
Unshare();
|
Unshare();
|
||||||
|
|
||||||
M_FONTDATA->m_family = family;
|
M_FONTDATA->m_family = family;
|
||||||
|
|
||||||
RealizeResource();
|
RealizeResource();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFont::SetStyle(int style)
|
void wxFont::SetStyle(int style)
|
||||||
{
|
{
|
||||||
Unshare();
|
Unshare();
|
||||||
|
|
||||||
M_FONTDATA->m_style = style;
|
M_FONTDATA->m_style = style;
|
||||||
|
|
||||||
RealizeResource();
|
RealizeResource();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFont::SetWeight(int weight)
|
void wxFont::SetWeight(int weight)
|
||||||
{
|
{
|
||||||
Unshare();
|
Unshare();
|
||||||
|
|
||||||
M_FONTDATA->m_weight = weight;
|
M_FONTDATA->m_weight = weight;
|
||||||
|
|
||||||
RealizeResource();
|
RealizeResource();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFont::SetFaceName(const wxString& faceName)
|
void wxFont::SetFaceName(const wxString& faceName)
|
||||||
{
|
{
|
||||||
Unshare();
|
Unshare();
|
||||||
|
|
||||||
M_FONTDATA->m_faceName = faceName;
|
M_FONTDATA->m_faceName = faceName;
|
||||||
|
|
||||||
RealizeResource();
|
RealizeResource();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFont::SetUnderlined(bool underlined)
|
void wxFont::SetUnderlined(bool underlined)
|
||||||
{
|
{
|
||||||
Unshare();
|
Unshare();
|
||||||
|
|
||||||
M_FONTDATA->m_underlined = underlined;
|
M_FONTDATA->m_underlined = underlined;
|
||||||
|
|
||||||
RealizeResource();
|
RealizeResource();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -276,10 +276,10 @@ wxXFont* wxFont::GetInternalFont(double scale, WXDisplay* display) const
|
|||||||
{
|
{
|
||||||
if (!Ok())
|
if (!Ok())
|
||||||
return (wxXFont*) NULL;
|
return (wxXFont*) NULL;
|
||||||
|
|
||||||
long intScale = long(scale * 100.0 + 0.5); // key for wxXFont
|
long intScale = long(scale * 100.0 + 0.5); // key for wxXFont
|
||||||
int pointSize = (M_FONTDATA->m_pointSize * 10 * intScale) / 100;
|
int pointSize = (M_FONTDATA->m_pointSize * 10 * intScale) / 100;
|
||||||
|
|
||||||
wxNode* node = M_FONTDATA->m_fonts.First();
|
wxNode* node = M_FONTDATA->m_fonts.First();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
@@ -288,17 +288,17 @@ wxXFont* wxFont::GetInternalFont(double scale, WXDisplay* display) const
|
|||||||
return f;
|
return f;
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
}
|
}
|
||||||
|
|
||||||
WXFontStructPtr font = LoadQueryFont(pointSize, M_FONTDATA->m_family,
|
WXFontStructPtr font = LoadQueryFont(pointSize, M_FONTDATA->m_family,
|
||||||
M_FONTDATA->m_style, M_FONTDATA->m_weight, M_FONTDATA->m_underlined);
|
M_FONTDATA->m_style, M_FONTDATA->m_weight, M_FONTDATA->m_underlined);
|
||||||
|
|
||||||
if (!font)
|
if (!font)
|
||||||
{
|
{
|
||||||
// search up and down by stepsize 10
|
// search up and down by stepsize 10
|
||||||
int max_size = pointSize + 20 * (1 + (pointSize/180));
|
int max_size = pointSize + 20 * (1 + (pointSize/180));
|
||||||
int min_size = pointSize - 20 * (1 + (pointSize/180));
|
int min_size = pointSize - 20 * (1 + (pointSize/180));
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
// Search for smaller size (approx.)
|
// Search for smaller size (approx.)
|
||||||
for (i=pointSize-10; !font && i >= 10 && i >= min_size; i -= 10)
|
for (i=pointSize-10; !font && i >= 10 && i >= min_size; i -= 10)
|
||||||
font = LoadQueryFont(i, M_FONTDATA->m_family, M_FONTDATA->m_style, M_FONTDATA->m_weight, M_FONTDATA->m_underlined);
|
font = LoadQueryFont(i, M_FONTDATA->m_family, M_FONTDATA->m_style, M_FONTDATA->m_weight, M_FONTDATA->m_underlined);
|
||||||
@@ -307,7 +307,7 @@ wxXFont* wxFont::GetInternalFont(double scale, WXDisplay* display) const
|
|||||||
font = LoadQueryFont(i, M_FONTDATA->m_family, M_FONTDATA->m_style, M_FONTDATA->m_weight, M_FONTDATA->m_underlined);
|
font = LoadQueryFont(i, M_FONTDATA->m_family, M_FONTDATA->m_style, M_FONTDATA->m_weight, M_FONTDATA->m_underlined);
|
||||||
// Try default family
|
// Try default family
|
||||||
if (!font && M_FONTDATA->m_family != wxDEFAULT)
|
if (!font && M_FONTDATA->m_family != wxDEFAULT)
|
||||||
font = LoadQueryFont(pointSize, wxDEFAULT, M_FONTDATA->m_style,
|
font = LoadQueryFont(pointSize, wxDEFAULT, M_FONTDATA->m_style,
|
||||||
M_FONTDATA->m_weight, M_FONTDATA->m_underlined);
|
M_FONTDATA->m_weight, M_FONTDATA->m_underlined);
|
||||||
// Bogus font
|
// Bogus font
|
||||||
if (!font)
|
if (!font)
|
||||||
@@ -368,12 +368,12 @@ WXFontStructPtr wxFont::LoadQueryFont(int pointSize, int family, int style,
|
|||||||
default: xweight = "*";
|
default: xweight = "*";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(wxBuffer, "-*-%s-%s-%s-normal-*-*-%d-*-*-*-*-*-*",
|
sprintf(wxBuffer, "-*-%s-%s-%s-normal-*-*-%d-*-*-*-*-*-*",
|
||||||
xfamily, xweight, xstyle, pointSize);
|
xfamily, xweight, xstyle, pointSize);
|
||||||
|
|
||||||
Display *dpy = (Display*) wxGetDisplay();
|
Display *dpy = (Display*) wxGetDisplay();
|
||||||
XFontStruct* font = XLoadQueryFont(dpy, wxBuffer);
|
XFontStruct* font = XLoadQueryFont(dpy, wxBuffer);
|
||||||
|
|
||||||
return (WXFontStructPtr) font;
|
return (WXFontStructPtr) font;
|
||||||
}
|
}
|
||||||
|
@@ -53,9 +53,9 @@
|
|||||||
extern wxHashTable *wxWidgetHashTable;
|
extern wxHashTable *wxWidgetHashTable;
|
||||||
|
|
||||||
void wxCloseFrameCallback(Widget, XtPointer, XmAnyCallbackStruct *cbs);
|
void wxCloseFrameCallback(Widget, XtPointer, XmAnyCallbackStruct *cbs);
|
||||||
void wxFrameFocusProc(Widget workArea, XtPointer clientData,
|
void wxFrameFocusProc(Widget workArea, XtPointer clientData,
|
||||||
XmAnyCallbackStruct *cbs);
|
XmAnyCallbackStruct *cbs);
|
||||||
static void wxFrameMapProc(Widget frameShell, XtPointer clientData,
|
static void wxFrameMapProc(Widget frameShell, XtPointer clientData,
|
||||||
XCrossingEvent * event);
|
XCrossingEvent * event);
|
||||||
|
|
||||||
extern wxList wxModelessWindows;
|
extern wxList wxModelessWindows;
|
||||||
@@ -92,10 +92,10 @@ wxFrame::wxFrame()
|
|||||||
|
|
||||||
m_frameMenuBar = NULL;
|
m_frameMenuBar = NULL;
|
||||||
m_frameStatusBar = NULL;
|
m_frameStatusBar = NULL;
|
||||||
|
|
||||||
m_parent = NULL;
|
m_parent = NULL;
|
||||||
m_iconized = FALSE;
|
m_iconized = FALSE;
|
||||||
|
|
||||||
//// Motif-specific
|
//// Motif-specific
|
||||||
m_frameShell = (WXWidget) NULL;
|
m_frameShell = (WXWidget) NULL;
|
||||||
m_frameWidget = (WXWidget) NULL;;
|
m_frameWidget = (WXWidget) NULL;;
|
||||||
@@ -115,16 +115,16 @@ bool wxFrame::Create(wxWindow *parent,
|
|||||||
{
|
{
|
||||||
if (!parent)
|
if (!parent)
|
||||||
wxTopLevelWindows.Append(this);
|
wxTopLevelWindows.Append(this);
|
||||||
|
|
||||||
SetName(name);
|
SetName(name);
|
||||||
|
|
||||||
m_windowStyle = style;
|
m_windowStyle = style;
|
||||||
m_frameMenuBar = NULL;
|
m_frameMenuBar = NULL;
|
||||||
#if wxUSE_TOOLBAR
|
#if wxUSE_TOOLBAR
|
||||||
m_frameToolBar = NULL ;
|
m_frameToolBar = NULL ;
|
||||||
#endif // wxUSE_TOOLBAR
|
#endif // wxUSE_TOOLBAR
|
||||||
m_frameStatusBar = NULL;
|
m_frameStatusBar = NULL;
|
||||||
|
|
||||||
//// Motif-specific
|
//// Motif-specific
|
||||||
m_frameShell = (WXWidget) NULL;
|
m_frameShell = (WXWidget) NULL;
|
||||||
m_frameWidget = (WXWidget) NULL;;
|
m_frameWidget = (WXWidget) NULL;;
|
||||||
@@ -132,23 +132,23 @@ bool wxFrame::Create(wxWindow *parent,
|
|||||||
m_clientArea = (WXWidget) NULL;;
|
m_clientArea = (WXWidget) NULL;;
|
||||||
m_visibleStatus = TRUE;
|
m_visibleStatus = TRUE;
|
||||||
m_title = "";
|
m_title = "";
|
||||||
|
|
||||||
m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE);
|
m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE);
|
||||||
m_foregroundColour = *wxBLACK;
|
m_foregroundColour = *wxBLACK;
|
||||||
m_font = wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
|
m_font = wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
|
||||||
|
|
||||||
if ( id > -1 )
|
if ( id > -1 )
|
||||||
m_windowId = id;
|
m_windowId = id;
|
||||||
else
|
else
|
||||||
m_windowId = (int)NewControlId();
|
m_windowId = (int)NewControlId();
|
||||||
|
|
||||||
if (parent) parent->AddChild(this);
|
if (parent) parent->AddChild(this);
|
||||||
|
|
||||||
wxModelessWindows.Append(this);
|
wxModelessWindows.Append(this);
|
||||||
|
|
||||||
int x = pos.x; int y = pos.y;
|
int x = pos.x; int y = pos.y;
|
||||||
int width = size.x; int height = size.y;
|
int width = size.x; int height = size.y;
|
||||||
|
|
||||||
if (wxTopLevelUsed)
|
if (wxTopLevelUsed)
|
||||||
// Change suggested by Matthew Flatt
|
// Change suggested by Matthew Flatt
|
||||||
m_frameShell = (WXWidget) XtAppCreateShell(name, wxTheApp->GetClassName(), topLevelShellWidgetClass, (Display*) wxGetDisplay(), NULL, 0);
|
m_frameShell = (WXWidget) XtAppCreateShell(name, wxTheApp->GetClassName(), topLevelShellWidgetClass, (Display*) wxGetDisplay(), NULL, 0);
|
||||||
@@ -157,30 +157,30 @@ bool wxFrame::Create(wxWindow *parent,
|
|||||||
m_frameShell = wxTheApp->GetTopLevelWidget();
|
m_frameShell = wxTheApp->GetTopLevelWidget();
|
||||||
wxTopLevelUsed = TRUE;
|
wxTopLevelUsed = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
XtVaSetValues((Widget) m_frameShell,
|
XtVaSetValues((Widget) m_frameShell,
|
||||||
// Allows menu to resize
|
// Allows menu to resize
|
||||||
XmNallowShellResize, True,
|
XmNallowShellResize, True,
|
||||||
XmNdeleteResponse, XmDO_NOTHING,
|
XmNdeleteResponse, XmDO_NOTHING,
|
||||||
XmNmappedWhenManaged, False,
|
XmNmappedWhenManaged, False,
|
||||||
XmNiconic, (style & wxICONIZE) ? TRUE : FALSE,
|
XmNiconic, (style & wxICONIZE) ? TRUE : FALSE,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (!title.IsNull())
|
if (!title.IsNull())
|
||||||
XtVaSetValues((Widget) m_frameShell,
|
XtVaSetValues((Widget) m_frameShell,
|
||||||
XmNtitle, (const char*) title,
|
XmNtitle, (const char*) title,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
m_frameWidget = (WXWidget) XtVaCreateManagedWidget("main_window",
|
m_frameWidget = (WXWidget) XtVaCreateManagedWidget("main_window",
|
||||||
xmMainWindowWidgetClass, (Widget) m_frameShell,
|
xmMainWindowWidgetClass, (Widget) m_frameShell,
|
||||||
XmNresizePolicy, XmRESIZE_NONE,
|
XmNresizePolicy, XmRESIZE_NONE,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
m_workArea = (WXWidget) XtVaCreateWidget("form",
|
m_workArea = (WXWidget) XtVaCreateWidget("form",
|
||||||
xmFormWidgetClass, (Widget) m_frameWidget,
|
xmFormWidgetClass, (Widget) m_frameWidget,
|
||||||
XmNresizePolicy, XmRESIZE_NONE,
|
XmNresizePolicy, XmRESIZE_NONE,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
m_clientArea = (WXWidget) XtVaCreateWidget("client",
|
m_clientArea = (WXWidget) XtVaCreateWidget("client",
|
||||||
xmBulletinBoardWidgetClass, (Widget) m_workArea,
|
xmBulletinBoardWidgetClass, (Widget) m_workArea,
|
||||||
XmNmarginWidth, 0,
|
XmNmarginWidth, 0,
|
||||||
@@ -194,33 +194,34 @@ bool wxFrame::Create(wxWindow *parent,
|
|||||||
|
|
||||||
XtAddEventHandler((Widget) m_clientArea, ExposureMask,FALSE,
|
XtAddEventHandler((Widget) m_clientArea, ExposureMask,FALSE,
|
||||||
wxUniversalRepaintProc, (XtPointer) this);
|
wxUniversalRepaintProc, (XtPointer) this);
|
||||||
|
|
||||||
XtVaSetValues((Widget) m_frameWidget,
|
XtVaSetValues((Widget) m_frameWidget,
|
||||||
XmNworkWindow, (Widget) m_workArea,
|
XmNworkWindow, (Widget) m_workArea,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
XtTranslations ptr ;
|
XtTranslations ptr ;
|
||||||
|
|
||||||
XtOverrideTranslations((Widget) m_workArea,
|
XtOverrideTranslations((Widget) m_workArea,
|
||||||
ptr = XtParseTranslationTable("<Configure>: resize()"));
|
ptr = XtParseTranslationTable("<Configure>: resize()"));
|
||||||
|
|
||||||
XtFree((char *)ptr);
|
XtFree((char *)ptr);
|
||||||
|
|
||||||
XtAddCallback((Widget) m_workArea, XmNfocusCallback,
|
XtAddCallback((Widget) m_workArea, XmNfocusCallback,
|
||||||
(XtCallbackProc)wxFrameFocusProc, (XtPointer)this);
|
(XtCallbackProc)wxFrameFocusProc, (XtPointer)this);
|
||||||
|
|
||||||
/* Part of show-&-hide fix */
|
/* Part of show-&-hide fix */
|
||||||
XtAddEventHandler((Widget) m_frameShell, StructureNotifyMask,
|
XtAddEventHandler((Widget) m_frameShell, StructureNotifyMask,
|
||||||
False, (XtEventHandler)wxFrameMapProc,
|
False, (XtEventHandler)wxFrameMapProc,
|
||||||
(XtPointer)m_workArea);
|
(XtPointer)m_workArea);
|
||||||
|
|
||||||
if (x > -1)
|
if (x > -1)
|
||||||
XtVaSetValues((Widget) m_frameShell, XmNx, x, NULL);
|
XtVaSetValues((Widget) m_frameShell, XmNx, x, NULL);
|
||||||
if (y > -1)
|
if (y > -1)
|
||||||
@@ -229,11 +230,11 @@ bool wxFrame::Create(wxWindow *parent,
|
|||||||
XtVaSetValues((Widget) m_frameShell, XmNwidth, width, NULL);
|
XtVaSetValues((Widget) m_frameShell, XmNwidth, width, NULL);
|
||||||
if (height > -1)
|
if (height > -1)
|
||||||
XtVaSetValues((Widget) m_frameShell, XmNheight, height, NULL);
|
XtVaSetValues((Widget) m_frameShell, XmNheight, height, NULL);
|
||||||
|
|
||||||
m_mainWidget = m_frameWidget;
|
m_mainWidget = m_frameWidget;
|
||||||
|
|
||||||
ChangeFont(FALSE);
|
ChangeFont(FALSE);
|
||||||
|
|
||||||
// This patch comes from Torsten Liermann lier@lier1.muc.de
|
// This patch comes from Torsten Liermann lier@lier1.muc.de
|
||||||
if (XmIsMotifWMRunning( (Widget) m_frameShell ))
|
if (XmIsMotifWMRunning( (Widget) m_frameShell ))
|
||||||
{
|
{
|
||||||
@@ -264,7 +265,7 @@ bool wxFrame::Create(wxWindow *parent,
|
|||||||
XtVaSetValues((Widget) m_frameShell,XmNoverrideRedirect,TRUE,NULL);
|
XtVaSetValues((Widget) m_frameShell,XmNoverrideRedirect,TRUE,NULL);
|
||||||
}
|
}
|
||||||
XtRealizeWidget((Widget) m_frameShell);
|
XtRealizeWidget((Widget) m_frameShell);
|
||||||
|
|
||||||
// Intercept CLOSE messages from the window manager
|
// Intercept CLOSE messages from the window manager
|
||||||
Atom WM_DELETE_WINDOW = XmInternAtom(XtDisplay((Widget) m_frameShell), "WM_DELETE_WINDOW", False);
|
Atom WM_DELETE_WINDOW = XmInternAtom(XtDisplay((Widget) m_frameShell), "WM_DELETE_WINDOW", False);
|
||||||
#if (XmREVISION > 1 || XmVERSION > 1)
|
#if (XmREVISION > 1 || XmVERSION > 1)
|
||||||
@@ -276,16 +277,16 @@ bool wxFrame::Create(wxWindow *parent,
|
|||||||
XmAddWMProtocolCallback((Widget) m_frameShell, WM_DELETE_WINDOW, (void (*)())wxCloseFrameCallback, (caddr_t)this);
|
XmAddWMProtocolCallback((Widget) m_frameShell, WM_DELETE_WINDOW, (void (*)())wxCloseFrameCallback, (caddr_t)this);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ChangeBackgroundColour();
|
ChangeBackgroundColour();
|
||||||
|
|
||||||
PreResize();
|
PreResize();
|
||||||
|
|
||||||
wxSizeEvent sizeEvent(wxSize(width, height), GetId());
|
wxSizeEvent sizeEvent(wxSize(width, height), GetId());
|
||||||
sizeEvent.SetEventObject(this);
|
sizeEvent.SetEventObject(this);
|
||||||
|
|
||||||
GetEventHandler()->ProcessEvent(sizeEvent);
|
GetEventHandler()->ProcessEvent(sizeEvent);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -301,7 +302,7 @@ wxFrame::~wxFrame()
|
|||||||
if (m_frameMenuBar)
|
if (m_frameMenuBar)
|
||||||
{
|
{
|
||||||
m_frameMenuBar->DestroyMenuBar();
|
m_frameMenuBar->DestroyMenuBar();
|
||||||
|
|
||||||
// Hack to stop core dump on Ultrix, OSF, for some strange reason.
|
// Hack to stop core dump on Ultrix, OSF, for some strange reason.
|
||||||
#if MOTIF_MENUBAR_DELETE_FIX
|
#if MOTIF_MENUBAR_DELETE_FIX
|
||||||
GetMenuBar()->SetMainWidget((WXWidget) NULL);
|
GetMenuBar()->SetMainWidget((WXWidget) NULL);
|
||||||
@@ -309,59 +310,59 @@ wxFrame::~wxFrame()
|
|||||||
delete m_frameMenuBar;
|
delete m_frameMenuBar;
|
||||||
m_frameMenuBar = NULL;
|
m_frameMenuBar = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxTopLevelWindows.DeleteObject(this);
|
wxTopLevelWindows.DeleteObject(this);
|
||||||
wxModelessWindows.DeleteObject(this);
|
wxModelessWindows.DeleteObject(this);
|
||||||
|
|
||||||
if (m_frameStatusBar)
|
if (m_frameStatusBar)
|
||||||
delete m_frameStatusBar;
|
delete m_frameStatusBar;
|
||||||
|
|
||||||
DestroyChildren();
|
DestroyChildren();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < wxMAX_STATUS; i++)
|
for (i = 0; i < wxMAX_STATUS; i++)
|
||||||
if (statusTextWidget[i])
|
if (statusTextWidget[i])
|
||||||
XtDestroyWidget (statusTextWidget[i]);
|
XtDestroyWidget (statusTextWidget[i]);
|
||||||
|
|
||||||
if (statusLineForm)
|
if (statusLineForm)
|
||||||
XtDestroyWidget (statusLineForm);
|
XtDestroyWidget (statusLineForm);
|
||||||
|
|
||||||
if (statusLineWidget)
|
if (statusLineWidget)
|
||||||
XtDestroyWidget (statusLineWidget);
|
XtDestroyWidget (statusLineWidget);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (m_workArea)
|
if (m_workArea)
|
||||||
{
|
{
|
||||||
wxDeleteWindowFromTable((Widget) m_workArea);
|
wxDeleteWindowFromTable((Widget) m_workArea);
|
||||||
|
|
||||||
XtDestroyWidget ((Widget) m_workArea);
|
XtDestroyWidget ((Widget) m_workArea);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_frameWidget)
|
if (m_frameWidget)
|
||||||
{
|
{
|
||||||
wxDeleteWindowFromTable((Widget) m_frameWidget);
|
wxDeleteWindowFromTable((Widget) m_frameWidget);
|
||||||
XtDestroyWidget ((Widget) m_frameWidget);
|
XtDestroyWidget ((Widget) m_frameWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_frameShell)
|
if (m_frameShell)
|
||||||
XtDestroyWidget ((Widget) m_frameShell);
|
XtDestroyWidget ((Widget) m_frameShell);
|
||||||
|
|
||||||
SetMainWidget((WXWidget) NULL);
|
SetMainWidget((WXWidget) NULL);
|
||||||
|
|
||||||
/* Check if it's the last top-level window */
|
/* Check if it's the last top-level window */
|
||||||
|
|
||||||
if (wxTheApp && (wxTopLevelWindows.Number() == 0))
|
if (wxTheApp && (wxTopLevelWindows.Number() == 0))
|
||||||
{
|
{
|
||||||
wxTheApp->SetTopWindow(NULL);
|
wxTheApp->SetTopWindow(NULL);
|
||||||
|
|
||||||
if (wxTheApp->GetExitOnFrameDelete())
|
if (wxTheApp->GetExitOnFrameDelete())
|
||||||
{
|
{
|
||||||
// Signal to the app that we're going to close
|
// Signal to the app that we're going to close
|
||||||
wxTheApp->ExitMainLoop();
|
wxTheApp->ExitMainLoop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get size *available for subwindows* i.e. excluding menu bar, toolbar etc.
|
// Get size *available for subwindows* i.e. excluding menu bar, toolbar etc.
|
||||||
@@ -369,7 +370,7 @@ void wxFrame::GetClientSize(int *x, int *y) const
|
|||||||
{
|
{
|
||||||
Dimension xx, yy;
|
Dimension xx, yy;
|
||||||
XtVaGetValues((Widget) m_workArea, XmNwidth, &xx, XmNheight, &yy, NULL);
|
XtVaGetValues((Widget) m_workArea, XmNwidth, &xx, XmNheight, &yy, NULL);
|
||||||
|
|
||||||
if (m_frameStatusBar)
|
if (m_frameStatusBar)
|
||||||
{
|
{
|
||||||
int sbw, sbh;
|
int sbw, sbh;
|
||||||
@@ -397,7 +398,7 @@ void wxFrame::GetClientSize(int *x, int *y) const
|
|||||||
{
|
{
|
||||||
wxWindow *win = (wxWindow *)node->Data();
|
wxWindow *win = (wxWindow *)node->Data();
|
||||||
hasSubPanel = (win->IsKindOf(CLASSINFO(wxPanel)) && !win->IsKindOf(CLASSINFO(wxDialog)));
|
hasSubPanel = (win->IsKindOf(CLASSINFO(wxPanel)) && !win->IsKindOf(CLASSINFO(wxDialog)));
|
||||||
|
|
||||||
if (hasSubPanel)
|
if (hasSubPanel)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -408,7 +409,7 @@ void wxFrame::GetClientSize(int *x, int *y) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
*x = xx; *y = yy;
|
*x = xx; *y = yy;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -421,7 +422,7 @@ void wxFrame::DoSetClientSize(int width, int height)
|
|||||||
// main window area, and adding on to the new client area
|
// main window area, and adding on to the new client area
|
||||||
if (width > -1)
|
if (width > -1)
|
||||||
XtVaSetValues((Widget) m_workArea, XmNwidth, width, NULL);
|
XtVaSetValues((Widget) m_workArea, XmNwidth, width, NULL);
|
||||||
|
|
||||||
if (height > -1)
|
if (height > -1)
|
||||||
{
|
{
|
||||||
if (m_frameStatusBar)
|
if (m_frameStatusBar)
|
||||||
@@ -441,16 +442,16 @@ void wxFrame::DoSetClientSize(int width, int height)
|
|||||||
height += tbh;
|
height += tbh;
|
||||||
}
|
}
|
||||||
#endif // wxUSE_TOOLBAR
|
#endif // wxUSE_TOOLBAR
|
||||||
|
|
||||||
XtVaSetValues((Widget) m_workArea, XmNheight, height, NULL);
|
XtVaSetValues((Widget) m_workArea, XmNheight, height, NULL);
|
||||||
}
|
}
|
||||||
PreResize();
|
PreResize();
|
||||||
|
|
||||||
wxSizeEvent sizeEvent(wxSize(width, height), GetId());
|
wxSizeEvent sizeEvent(wxSize(width, height), GetId());
|
||||||
sizeEvent.SetEventObject(this);
|
sizeEvent.SetEventObject(this);
|
||||||
|
|
||||||
GetEventHandler()->ProcessEvent(sizeEvent);
|
GetEventHandler()->ProcessEvent(sizeEvent);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFrame::GetSize(int *width, int *height) const
|
void wxFrame::GetSize(int *width, int *height) const
|
||||||
@@ -465,7 +466,7 @@ void wxFrame::GetPosition(int *x, int *y) const
|
|||||||
Window parent_window = XtWindow((Widget) m_frameShell),
|
Window parent_window = XtWindow((Widget) m_frameShell),
|
||||||
next_parent = XtWindow((Widget) m_frameShell),
|
next_parent = XtWindow((Widget) m_frameShell),
|
||||||
root = RootWindowOfScreen(XtScreen((Widget) m_frameShell));
|
root = RootWindowOfScreen(XtScreen((Widget) m_frameShell));
|
||||||
|
|
||||||
// search for the parent that is child of ROOT, because the WM may
|
// search for the parent that is child of ROOT, because the WM may
|
||||||
// reparent twice and notify only the next parent (like FVWM)
|
// reparent twice and notify only the next parent (like FVWM)
|
||||||
while (next_parent != root) {
|
while (next_parent != root) {
|
||||||
@@ -492,14 +493,14 @@ void wxFrame::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
|||||||
XtVaSetValues((Widget) m_frameWidget, XmNwidth, width, NULL);
|
XtVaSetValues((Widget) m_frameWidget, XmNwidth, width, NULL);
|
||||||
if (height > -1)
|
if (height > -1)
|
||||||
XtVaSetValues((Widget) m_frameWidget, XmNheight, height, NULL);
|
XtVaSetValues((Widget) m_frameWidget, XmNheight, height, NULL);
|
||||||
|
|
||||||
if (!(height == -1 && width == -1))
|
if (!(height == -1 && width == -1))
|
||||||
{
|
{
|
||||||
PreResize();
|
PreResize();
|
||||||
|
|
||||||
wxSizeEvent sizeEvent(wxSize(width, height), GetId());
|
wxSizeEvent sizeEvent(wxSize(width, height), GetId());
|
||||||
sizeEvent.SetEventObject(this);
|
sizeEvent.SetEventObject(this);
|
||||||
|
|
||||||
GetEventHandler()->ProcessEvent(sizeEvent);
|
GetEventHandler()->ProcessEvent(sizeEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -508,9 +509,9 @@ bool wxFrame::Show(bool show)
|
|||||||
{
|
{
|
||||||
if (!m_frameShell)
|
if (!m_frameShell)
|
||||||
return wxWindow::Show(show);
|
return wxWindow::Show(show);
|
||||||
|
|
||||||
m_visibleStatus = show; /* show-&-hide fix */
|
m_visibleStatus = show; /* show-&-hide fix */
|
||||||
|
|
||||||
m_isShown = show;
|
m_isShown = show;
|
||||||
if (show) {
|
if (show) {
|
||||||
XtMapWidget((Widget) m_frameShell);
|
XtMapWidget((Widget) m_frameShell);
|
||||||
@@ -526,7 +527,7 @@ void wxFrame::Iconize(bool iconize)
|
|||||||
{
|
{
|
||||||
if (!iconize)
|
if (!iconize)
|
||||||
Show(TRUE);
|
Show(TRUE);
|
||||||
|
|
||||||
if (m_frameShell)
|
if (m_frameShell)
|
||||||
XtVaSetValues((Widget) m_frameShell, XmNiconic, (Boolean)iconize, NULL);
|
XtVaSetValues((Widget) m_frameShell, XmNiconic, (Boolean)iconize, NULL);
|
||||||
}
|
}
|
||||||
@@ -535,7 +536,7 @@ void wxFrame::Iconize(bool iconize)
|
|||||||
void wxFrame::Maximize(bool maximize)
|
void wxFrame::Maximize(bool maximize)
|
||||||
{
|
{
|
||||||
Show(TRUE);
|
Show(TRUE);
|
||||||
|
|
||||||
if (maximize && m_frameShell)
|
if (maximize && m_frameShell)
|
||||||
XtVaSetValues((Widget) m_frameShell, XmNiconic, FALSE, NULL);
|
XtVaSetValues((Widget) m_frameShell, XmNiconic, FALSE, NULL);
|
||||||
}
|
}
|
||||||
@@ -544,7 +545,7 @@ bool wxFrame::IsIconized() const
|
|||||||
{
|
{
|
||||||
if (!m_frameShell)
|
if (!m_frameShell)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
Boolean iconic;
|
Boolean iconic;
|
||||||
XtVaGetValues((Widget) m_frameShell, XmNiconic, &iconic, NULL);
|
XtVaGetValues((Widget) m_frameShell, XmNiconic, &iconic, NULL);
|
||||||
return iconic;
|
return iconic;
|
||||||
@@ -561,11 +562,11 @@ void wxFrame::SetTitle(const wxString& title)
|
|||||||
{
|
{
|
||||||
if (title == m_title)
|
if (title == m_title)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_title = title;
|
m_title = title;
|
||||||
|
|
||||||
if (!title.IsNull())
|
if (!title.IsNull())
|
||||||
XtVaSetValues((Widget) m_frameShell,
|
XtVaSetValues((Widget) m_frameShell,
|
||||||
XmNtitle, (const char*) title,
|
XmNtitle, (const char*) title,
|
||||||
XmNiconName, (const char*) title,
|
XmNiconName, (const char*) title,
|
||||||
NULL);
|
NULL);
|
||||||
@@ -574,13 +575,13 @@ void wxFrame::SetTitle(const wxString& title)
|
|||||||
void wxFrame::SetIcon(const wxIcon& icon)
|
void wxFrame::SetIcon(const wxIcon& icon)
|
||||||
{
|
{
|
||||||
m_icon = icon;
|
m_icon = icon;
|
||||||
|
|
||||||
if (!m_frameShell)
|
if (!m_frameShell)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!icon.Ok() || !icon.GetPixmap())
|
if (!icon.Ok() || !icon.GetPixmap())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
XtVaSetValues((Widget) m_frameShell, XtNiconPixmap, icon.GetPixmap(), NULL);
|
XtVaSetValues((Widget) m_frameShell, XtNiconPixmap, icon.GetPixmap(), NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -588,21 +589,21 @@ wxStatusBar *wxFrame::OnCreateStatusBar(int number, long style, wxWindowID id,
|
|||||||
const wxString& name)
|
const wxString& name)
|
||||||
{
|
{
|
||||||
wxStatusBar *statusBar = NULL;
|
wxStatusBar *statusBar = NULL;
|
||||||
|
|
||||||
statusBar = new wxStatusBar(this, id, wxPoint(0, 0), wxSize(100, 20),
|
statusBar = new wxStatusBar(this, id, wxPoint(0, 0), wxSize(100, 20),
|
||||||
style, name);
|
style, name);
|
||||||
|
|
||||||
// Set the height according to the font and the border size
|
// Set the height according to the font and the border size
|
||||||
wxClientDC dc(statusBar);
|
wxClientDC dc(statusBar);
|
||||||
dc.SetFont(statusBar->GetFont());
|
dc.SetFont(statusBar->GetFont());
|
||||||
|
|
||||||
long x, y;
|
long x, y;
|
||||||
dc.GetTextExtent("X", &x, &y);
|
dc.GetTextExtent("X", &x, &y);
|
||||||
|
|
||||||
int height = (int)( (y * 1.1) + 2* statusBar->GetBorderY());
|
int height = (int)( (y * 1.1) + 2* statusBar->GetBorderY());
|
||||||
|
|
||||||
statusBar->SetSize(-1, -1, 100, height);
|
statusBar->SetSize(-1, -1, 100, height);
|
||||||
|
|
||||||
statusBar->SetFieldsCount(number);
|
statusBar->SetFieldsCount(number);
|
||||||
return statusBar;
|
return statusBar;
|
||||||
}
|
}
|
||||||
@@ -611,9 +612,9 @@ wxStatusBar* wxFrame::CreateStatusBar(int number, long style, wxWindowID id,
|
|||||||
const wxString& name)
|
const wxString& name)
|
||||||
{
|
{
|
||||||
// Calling CreateStatusBar twice is an error.
|
// Calling CreateStatusBar twice is an error.
|
||||||
wxCHECK_MSG( m_frameStatusBar == NULL, FALSE,
|
wxCHECK_MSG( m_frameStatusBar == NULL, FALSE,
|
||||||
"recreating status bar in wxFrame" );
|
"recreating status bar in wxFrame" );
|
||||||
|
|
||||||
m_frameStatusBar = OnCreateStatusBar(number, style, id,
|
m_frameStatusBar = OnCreateStatusBar(number, style, id,
|
||||||
name);
|
name);
|
||||||
if ( m_frameStatusBar )
|
if ( m_frameStatusBar )
|
||||||
@@ -628,14 +629,14 @@ wxStatusBar* wxFrame::CreateStatusBar(int number, long style, wxWindowID id,
|
|||||||
void wxFrame::SetStatusText(const wxString& text, int number)
|
void wxFrame::SetStatusText(const wxString& text, int number)
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_frameStatusBar != NULL, "no statusbar to set text for" );
|
wxCHECK_RET( m_frameStatusBar != NULL, "no statusbar to set text for" );
|
||||||
|
|
||||||
m_frameStatusBar->SetStatusText(text, number);
|
m_frameStatusBar->SetStatusText(text, number);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFrame::SetStatusWidths(int n, const int widths_field[])
|
void wxFrame::SetStatusWidths(int n, const int widths_field[])
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_frameStatusBar != NULL, "no statusbar to set widths for" );
|
wxCHECK_RET( m_frameStatusBar != NULL, "no statusbar to set widths for" );
|
||||||
|
|
||||||
m_frameStatusBar->SetStatusWidths(n, widths_field);
|
m_frameStatusBar->SetStatusWidths(n, widths_field);
|
||||||
PositionStatusBar();
|
PositionStatusBar();
|
||||||
}
|
}
|
||||||
@@ -644,12 +645,12 @@ void wxFrame::PositionStatusBar()
|
|||||||
{
|
{
|
||||||
if (!m_frameStatusBar)
|
if (!m_frameStatusBar)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int w, h;
|
int w, h;
|
||||||
GetClientSize(&w, &h);
|
GetClientSize(&w, &h);
|
||||||
int sw, sh;
|
int sw, sh;
|
||||||
m_frameStatusBar->GetSize(&sw, &sh);
|
m_frameStatusBar->GetSize(&sw, &sh);
|
||||||
|
|
||||||
// Since we wish the status bar to be directly under the client area,
|
// Since we wish the status bar to be directly under the client area,
|
||||||
// we use the adjusted sizes without using wxSIZE_NO_ADJUSTMENTS.
|
// we use the adjusted sizes without using wxSIZE_NO_ADJUSTMENTS.
|
||||||
m_frameStatusBar->SetSize(0, h, w, sh);
|
m_frameStatusBar->SetSize(0, h, w, sh);
|
||||||
@@ -670,16 +671,16 @@ void wxFrame::SetMenuBar(wxMenuBar *menuBar)
|
|||||||
m_frameMenuBar = NULL;
|
m_frameMenuBar = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Currently can't set it twice
|
// Currently can't set it twice
|
||||||
// wxASSERT_MSG( (m_frameMenuBar == (wxMenuBar*) NULL), "Cannot set the menubar more than once");
|
// wxASSERT_MSG( (m_frameMenuBar == (wxMenuBar*) NULL), "Cannot set the menubar more than once");
|
||||||
|
|
||||||
if (m_frameMenuBar)
|
if (m_frameMenuBar)
|
||||||
{
|
{
|
||||||
m_frameMenuBar->DestroyMenuBar();
|
m_frameMenuBar->DestroyMenuBar();
|
||||||
delete m_frameMenuBar;
|
delete m_frameMenuBar;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_frameMenuBar = menuBar;
|
m_frameMenuBar = menuBar;
|
||||||
m_frameMenuBar->CreateMenuBar(this);
|
m_frameMenuBar->CreateMenuBar(this);
|
||||||
}
|
}
|
||||||
@@ -694,7 +695,7 @@ void wxFrame::Fit()
|
|||||||
{
|
{
|
||||||
// Find a child that's a subwindow, but not a dialog box.
|
// Find a child that's a subwindow, but not a dialog box.
|
||||||
wxWindow *win = (wxWindow *)node->Data();
|
wxWindow *win = (wxWindow *)node->Data();
|
||||||
|
|
||||||
if (!win->IsKindOf(CLASSINFO(wxFrame)) &&
|
if (!win->IsKindOf(CLASSINFO(wxFrame)) &&
|
||||||
!win->IsKindOf(CLASSINFO(wxDialog)))
|
!win->IsKindOf(CLASSINFO(wxDialog)))
|
||||||
{
|
{
|
||||||
@@ -702,7 +703,7 @@ void wxFrame::Fit()
|
|||||||
int x, y;
|
int x, y;
|
||||||
win->GetSize(&width, &height);
|
win->GetSize(&width, &height);
|
||||||
win->GetPosition(&x, &y);
|
win->GetPosition(&x, &y);
|
||||||
|
|
||||||
if ((x + width) > max_width)
|
if ((x + width) > max_width)
|
||||||
max_width = x + width;
|
max_width = x + width;
|
||||||
if ((y + height) > max_height)
|
if ((y + height) > max_height)
|
||||||
@@ -718,14 +719,14 @@ void wxFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
|
|||||||
{
|
{
|
||||||
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE));
|
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE));
|
||||||
Refresh();
|
Refresh();
|
||||||
|
|
||||||
if ( m_frameStatusBar )
|
if ( m_frameStatusBar )
|
||||||
{
|
{
|
||||||
wxSysColourChangedEvent event2;
|
wxSysColourChangedEvent event2;
|
||||||
event2.SetEventObject( m_frameStatusBar );
|
event2.SetEventObject( m_frameStatusBar );
|
||||||
m_frameStatusBar->ProcessEvent(event2);
|
m_frameStatusBar->ProcessEvent(event2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Propagate the event to the non-top-level children
|
// Propagate the event to the non-top-level children
|
||||||
wxWindow::OnSysColourChanged(event);
|
wxWindow::OnSysColourChanged(event);
|
||||||
}
|
}
|
||||||
@@ -741,14 +742,14 @@ void wxFrame::OnSize(wxSizeEvent& event)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// do we have _exactly_ one child?
|
// do we have _exactly_ one child?
|
||||||
wxWindow *child = NULL;
|
wxWindow *child = NULL;
|
||||||
for ( wxNode *node = GetChildren().First(); node; node = node->Next() )
|
for ( wxNode *node = GetChildren().First(); node; node = node->Next() )
|
||||||
{
|
{
|
||||||
wxWindow *win = (wxWindow *)node->Data();
|
wxWindow *win = (wxWindow *)node->Data();
|
||||||
if ( !win->IsKindOf(CLASSINFO(wxFrame)) &&
|
if ( !win->IsKindOf(CLASSINFO(wxFrame)) &&
|
||||||
!win->IsKindOf(CLASSINFO(wxDialog)) &&
|
!win->IsKindOf(CLASSINFO(wxDialog)) &&
|
||||||
(win != GetStatusBar())
|
(win != GetStatusBar())
|
||||||
#if wxUSE_TOOLBAR
|
#if wxUSE_TOOLBAR
|
||||||
&& (win != GetToolBar())
|
&& (win != GetToolBar())
|
||||||
@@ -760,15 +761,15 @@ void wxFrame::OnSize(wxSizeEvent& event)
|
|||||||
child = win;
|
child = win;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( child ) {
|
if ( child ) {
|
||||||
// we have exactly one child - set it's size to fill the whole frame
|
// we have exactly one child - set it's size to fill the whole frame
|
||||||
int clientW, clientH;
|
int clientW, clientH;
|
||||||
GetClientSize(&clientW, &clientH);
|
GetClientSize(&clientW, &clientH);
|
||||||
|
|
||||||
int x = 0;
|
int x = 0;
|
||||||
int y = 0;
|
int y = 0;
|
||||||
|
|
||||||
child->SetSize(x, y, clientW, clientH);
|
child->SetSize(x, y, clientW, clientH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -835,15 +836,15 @@ void wxFrame::Centre(int direction)
|
|||||||
{
|
{
|
||||||
int display_width, display_height, width, height, x, y;
|
int display_width, display_height, width, height, x, y;
|
||||||
wxDisplaySize(&display_width, &display_height);
|
wxDisplaySize(&display_width, &display_height);
|
||||||
|
|
||||||
GetSize(&width, &height);
|
GetSize(&width, &height);
|
||||||
GetPosition(&x, &y);
|
GetPosition(&x, &y);
|
||||||
|
|
||||||
if (direction & wxHORIZONTAL)
|
if (direction & wxHORIZONTAL)
|
||||||
x = (int)((display_width - width)/2);
|
x = (int)((display_width - width)/2);
|
||||||
if (direction & wxVERTICAL)
|
if (direction & wxVERTICAL)
|
||||||
y = (int)((display_height - height)/2);
|
y = (int)((display_height - height)/2);
|
||||||
|
|
||||||
SetSize(x, y, width, height);
|
SetSize(x, y, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -885,7 +886,7 @@ wxPoint wxFrame::GetClientAreaOrigin() const
|
|||||||
{
|
{
|
||||||
int w, h;
|
int w, h;
|
||||||
GetToolBar()->GetSize(& w, & h);
|
GetToolBar()->GetSize(& w, & h);
|
||||||
|
|
||||||
if (GetToolBar()->GetWindowStyleFlag() & wxTB_VERTICAL)
|
if (GetToolBar()->GetWindowStyleFlag() & wxTB_VERTICAL)
|
||||||
{
|
{
|
||||||
pt.x += w;
|
pt.x += w;
|
||||||
@@ -903,7 +904,7 @@ wxPoint wxFrame::GetClientAreaOrigin() const
|
|||||||
void wxFrame::ScreenToClient(int *x, int *y) const
|
void wxFrame::ScreenToClient(int *x, int *y) const
|
||||||
{
|
{
|
||||||
wxWindow::ScreenToClient(x, y);
|
wxWindow::ScreenToClient(x, y);
|
||||||
|
|
||||||
// We may be faking the client origin.
|
// We may be faking the client origin.
|
||||||
// So a window that's really at (0, 30) may appear
|
// So a window that's really at (0, 30) may appear
|
||||||
// (to wxWin apps) to be at (0, 0).
|
// (to wxWin apps) to be at (0, 0).
|
||||||
@@ -920,7 +921,7 @@ void wxFrame::ClientToScreen(int *x, int *y) const
|
|||||||
wxPoint pt1(GetClientAreaOrigin());
|
wxPoint pt1(GetClientAreaOrigin());
|
||||||
*x += pt1.x;
|
*x += pt1.x;
|
||||||
*y += pt1.y;
|
*y += pt1.y;
|
||||||
|
|
||||||
wxWindow::ClientToScreen(x, y);
|
wxWindow::ClientToScreen(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -929,7 +930,7 @@ wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& nam
|
|||||||
{
|
{
|
||||||
wxCHECK_MSG( m_frameToolBar == NULL, FALSE,
|
wxCHECK_MSG( m_frameToolBar == NULL, FALSE,
|
||||||
"recreating toolbar in wxFrame" );
|
"recreating toolbar in wxFrame" );
|
||||||
|
|
||||||
wxToolBar* toolBar = OnCreateToolBar(style, id, name);
|
wxToolBar* toolBar = OnCreateToolBar(style, id, name);
|
||||||
if (toolBar)
|
if (toolBar)
|
||||||
{
|
{
|
||||||
@@ -961,14 +962,14 @@ wxToolBar *wxFrame::GetToolBar() const
|
|||||||
void wxFrame::PositionToolBar()
|
void wxFrame::PositionToolBar()
|
||||||
{
|
{
|
||||||
int cw, ch;
|
int cw, ch;
|
||||||
|
|
||||||
GetClientSize(& cw, &ch);
|
GetClientSize(& cw, &ch);
|
||||||
|
|
||||||
if (GetToolBar())
|
if (GetToolBar())
|
||||||
{
|
{
|
||||||
int tw, th;
|
int tw, th;
|
||||||
GetToolBar()->GetSize(& tw, & th);
|
GetToolBar()->GetSize(& tw, & th);
|
||||||
|
|
||||||
if (GetToolBar()->GetWindowStyleFlag() & wxTB_VERTICAL)
|
if (GetToolBar()->GetWindowStyleFlag() & wxTB_VERTICAL)
|
||||||
{
|
{
|
||||||
// Use the 'real' position. wxSIZE_NO_ADJUSTMENTS
|
// Use the 'real' position. wxSIZE_NO_ADJUSTMENTS
|
||||||
@@ -989,7 +990,7 @@ void wxFrame::CaptureMouse()
|
|||||||
{
|
{
|
||||||
if (m_winCaptured)
|
if (m_winCaptured)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (GetMainWidget())
|
if (GetMainWidget())
|
||||||
XtAddGrab((Widget) m_frameShell, TRUE, FALSE);
|
XtAddGrab((Widget) m_frameShell, TRUE, FALSE);
|
||||||
m_winCaptured = TRUE;
|
m_winCaptured = TRUE;
|
||||||
@@ -999,7 +1000,7 @@ void wxFrame::ReleaseMouse()
|
|||||||
{
|
{
|
||||||
if (!m_winCaptured)
|
if (!m_winCaptured)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (GetMainWidget())
|
if (GetMainWidget())
|
||||||
XtRemoveGrab((Widget) m_frameShell);
|
XtRemoveGrab((Widget) m_frameShell);
|
||||||
m_winCaptured = FALSE;
|
m_winCaptured = FALSE;
|
||||||
@@ -1039,25 +1040,24 @@ void wxFrame::Lower(void)
|
|||||||
XLowerWindow(XtDisplay((Widget) m_frameShell), parent_window);
|
XLowerWindow(XtDisplay((Widget) m_frameShell), parent_window);
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
if (e->xany.type == MapNotify)
|
if (e->xany.type == MapNotify)
|
||||||
{
|
{
|
||||||
// Iconize fix
|
// Iconize fix
|
||||||
@@ -1109,10 +1109,10 @@ void wxFrame::ChangeForegroundColour()
|
|||||||
void wxCloseFrameCallback(Widget widget, XtPointer client_data, XmAnyCallbackStruct *cbs)
|
void wxCloseFrameCallback(Widget widget, XtPointer client_data, XmAnyCallbackStruct *cbs)
|
||||||
{
|
{
|
||||||
wxFrame *frame = (wxFrame *)client_data;
|
wxFrame *frame = (wxFrame *)client_data;
|
||||||
|
|
||||||
wxCloseEvent closeEvent(wxEVT_CLOSE_WINDOW, frame->GetId());
|
wxCloseEvent closeEvent(wxEVT_CLOSE_WINDOW, frame->GetId());
|
||||||
closeEvent.SetEventObject(frame);
|
closeEvent.SetEventObject(frame);
|
||||||
|
|
||||||
// May delete the frame (with delayed deletion)
|
// May delete the frame (with delayed deletion)
|
||||||
frame->GetEventHandler()->ProcessEvent(closeEvent);
|
frame->GetEventHandler()->ProcessEvent(closeEvent);
|
||||||
}
|
}
|
||||||
|
@@ -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__
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
extern wxList wxModelessWindows;
|
extern wxList wxModelessWindows;
|
||||||
|
|
||||||
// Implemented in frame.cpp
|
// Implemented in frame.cpp
|
||||||
extern void wxFrameFocusProc(Widget workArea, XtPointer clientData,
|
extern void wxFrameFocusProc(Widget workArea, XtPointer clientData,
|
||||||
XmAnyCallbackStruct *cbs);
|
XmAnyCallbackStruct *cbs);
|
||||||
|
|
||||||
#define wxID_NOTEBOOK_CLIENT_AREA wxID_HIGHEST + 100
|
#define wxID_NOTEBOOK_CLIENT_AREA wxID_HIGHEST + 100
|
||||||
@@ -76,19 +76,19 @@ bool wxMDIParentFrame::Create(wxWindow *parent,
|
|||||||
m_clientWindow = (wxMDIClientWindow*) NULL;
|
m_clientWindow = (wxMDIClientWindow*) NULL;
|
||||||
m_activeChild = (wxMDIChildFrame*) NULL;
|
m_activeChild = (wxMDIChildFrame*) NULL;
|
||||||
m_activeMenuBar = (wxMenuBar*) NULL;
|
m_activeMenuBar = (wxMenuBar*) NULL;
|
||||||
|
|
||||||
bool success = wxFrame::Create(parent, id, title, pos, size, style, name);
|
bool success = wxFrame::Create(parent, id, title, pos, size, style, name);
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
// TODO: app cannot override OnCreateClient since
|
// TODO: app cannot override OnCreateClient since
|
||||||
// wxMDIParentFrame::OnCreateClient will still be called
|
// wxMDIParentFrame::OnCreateClient will still be called
|
||||||
// (we're in the constructor). How to resolve?
|
// (we're in the constructor). How to resolve?
|
||||||
|
|
||||||
m_clientWindow = OnCreateClient();
|
m_clientWindow = OnCreateClient();
|
||||||
|
|
||||||
// Uses own style for client style
|
// Uses own style for client style
|
||||||
m_clientWindow->CreateClient(this, GetWindowStyleFlag());
|
m_clientWindow->CreateClient(this, GetWindowStyleFlag());
|
||||||
|
|
||||||
int w, h;
|
int w, h;
|
||||||
GetClientSize(& w, & h);
|
GetClientSize(& w, & h);
|
||||||
m_clientWindow->SetSize(0, 0, w, h);
|
m_clientWindow->SetSize(0, 0, w, h);
|
||||||
@@ -102,9 +102,9 @@ wxMDIParentFrame::~wxMDIParentFrame()
|
|||||||
{
|
{
|
||||||
// Make sure we delete the client window last of all
|
// Make sure we delete the client window last of all
|
||||||
RemoveChild(m_clientWindow);
|
RemoveChild(m_clientWindow);
|
||||||
|
|
||||||
DestroyChildren();
|
DestroyChildren();
|
||||||
|
|
||||||
delete m_clientWindow;
|
delete m_clientWindow;
|
||||||
m_clientWindow = NULL;
|
m_clientWindow = NULL;
|
||||||
}
|
}
|
||||||
@@ -112,7 +112,7 @@ wxMDIParentFrame::~wxMDIParentFrame()
|
|||||||
void wxMDIParentFrame::SetMenuBar(wxMenuBar *menu_bar)
|
void wxMDIParentFrame::SetMenuBar(wxMenuBar *menu_bar)
|
||||||
{
|
{
|
||||||
m_frameMenuBar = menu_bar;
|
m_frameMenuBar = menu_bar;
|
||||||
|
|
||||||
SetChildMenuBar((wxMDIChildFrame*) NULL);
|
SetChildMenuBar((wxMDIChildFrame*) NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,7 +126,7 @@ void wxMDIParentFrame::OnSize(wxSizeEvent& event)
|
|||||||
int y = 0;
|
int y = 0;
|
||||||
int width, height;
|
int width, height;
|
||||||
GetClientSize(&width, &height);
|
GetClientSize(&width, &height);
|
||||||
|
|
||||||
if ( GetClientWindow() )
|
if ( GetClientWindow() )
|
||||||
GetClientWindow()->SetSize(x, y, width, height);
|
GetClientWindow()->SetSize(x, y, width, height);
|
||||||
}
|
}
|
||||||
@@ -158,14 +158,14 @@ wxMDIClientWindow *wxMDIParentFrame::OnCreateClient()
|
|||||||
void wxMDIParentFrame::SetChildMenuBar(wxMDIChildFrame* child)
|
void wxMDIParentFrame::SetChildMenuBar(wxMDIChildFrame* child)
|
||||||
{
|
{
|
||||||
wxMenuBar* oldMenuBar = m_activeMenuBar;
|
wxMenuBar* oldMenuBar = m_activeMenuBar;
|
||||||
|
|
||||||
if (child == (wxMDIChildFrame*) NULL) // No child: use parent frame
|
if (child == (wxMDIChildFrame*) NULL) // No child: use parent frame
|
||||||
{
|
{
|
||||||
if (GetMenuBar() && (GetMenuBar() != m_activeMenuBar))
|
if (GetMenuBar() && (GetMenuBar() != m_activeMenuBar))
|
||||||
{
|
{
|
||||||
// if (m_activeMenuBar)
|
// if (m_activeMenuBar)
|
||||||
// m_activeMenuBar->DestroyMenuBar();
|
// m_activeMenuBar->DestroyMenuBar();
|
||||||
|
|
||||||
m_activeMenuBar = GetMenuBar();
|
m_activeMenuBar = GetMenuBar();
|
||||||
m_activeMenuBar->CreateMenuBar(this);
|
m_activeMenuBar->CreateMenuBar(this);
|
||||||
/*
|
/*
|
||||||
@@ -174,7 +174,7 @@ void wxMDIParentFrame::SetChildMenuBar(wxMDIChildFrame* child)
|
|||||||
*/
|
*/
|
||||||
if (oldMenuBar && oldMenuBar->GetMainWidget())
|
if (oldMenuBar && oldMenuBar->GetMainWidget())
|
||||||
XtUnmapWidget((Widget) oldMenuBar->GetMainWidget());
|
XtUnmapWidget((Widget) oldMenuBar->GetMainWidget());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (child->GetMenuBar() == (wxMenuBar*) NULL) // No child menu bar: use parent frame
|
else if (child->GetMenuBar() == (wxMenuBar*) NULL) // No child menu bar: use parent frame
|
||||||
@@ -199,7 +199,7 @@ void wxMDIParentFrame::SetChildMenuBar(wxMDIChildFrame* child)
|
|||||||
{
|
{
|
||||||
// if (m_activeMenuBar)
|
// if (m_activeMenuBar)
|
||||||
// m_activeMenuBar->DestroyMenuBar();
|
// m_activeMenuBar->DestroyMenuBar();
|
||||||
|
|
||||||
m_activeMenuBar = child->GetMenuBar();
|
m_activeMenuBar = child->GetMenuBar();
|
||||||
m_activeMenuBar->CreateMenuBar(this);
|
m_activeMenuBar->CreateMenuBar(this);
|
||||||
/*
|
/*
|
||||||
@@ -219,20 +219,20 @@ bool wxMDIParentFrame::ProcessEvent(wxEvent& event)
|
|||||||
static wxEventType inEvent = wxEVT_NULL;
|
static wxEventType inEvent = wxEVT_NULL;
|
||||||
if (inEvent == event.GetEventType())
|
if (inEvent == event.GetEventType())
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
inEvent = event.GetEventType();
|
inEvent = event.GetEventType();
|
||||||
|
|
||||||
bool res = FALSE;
|
bool res = FALSE;
|
||||||
if (m_activeChild && event.IsKindOf(CLASSINFO(wxCommandEvent)))
|
if (m_activeChild && event.IsKindOf(CLASSINFO(wxCommandEvent)))
|
||||||
{
|
{
|
||||||
res = m_activeChild->GetEventHandler()->ProcessEvent(event);
|
res = m_activeChild->GetEventHandler()->ProcessEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!res)
|
if (!res)
|
||||||
res = GetEventHandler()->wxEvtHandler::ProcessEvent(event);
|
res = GetEventHandler()->wxEvtHandler::ProcessEvent(event);
|
||||||
|
|
||||||
inEvent = wxEVT_NULL;
|
inEvent = wxEVT_NULL;
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,7 +252,7 @@ void wxMDIParentFrame::DoSetClientSize(int width, int height)
|
|||||||
void wxMDIParentFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
|
void wxMDIParentFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
// Propagate the event to the non-top-level children
|
// Propagate the event to the non-top-level children
|
||||||
wxFrame::OnSysColourChanged(event);
|
wxFrame::OnSysColourChanged(event);
|
||||||
}
|
}
|
||||||
@@ -299,31 +299,31 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
|
|||||||
const wxString& name)
|
const wxString& name)
|
||||||
{
|
{
|
||||||
SetName(name);
|
SetName(name);
|
||||||
|
|
||||||
m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE);
|
m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE);
|
||||||
m_foregroundColour = *wxBLACK;
|
m_foregroundColour = *wxBLACK;
|
||||||
m_font = wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
|
m_font = wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
|
||||||
|
|
||||||
if ( id > -1 )
|
if ( id > -1 )
|
||||||
m_windowId = id;
|
m_windowId = id;
|
||||||
else
|
else
|
||||||
m_windowId = (int)NewControlId();
|
m_windowId = (int)NewControlId();
|
||||||
|
|
||||||
wxMDIClientWindow* clientWindow = parent->GetClientWindow();
|
wxMDIClientWindow* clientWindow = parent->GetClientWindow();
|
||||||
|
|
||||||
wxASSERT_MSG( (clientWindow != (wxWindow*) NULL), "Missing MDI client window.");
|
wxASSERT_MSG( (clientWindow != (wxWindow*) NULL), "Missing MDI client window.");
|
||||||
|
|
||||||
if (clientWindow) clientWindow->AddChild(this);
|
if (clientWindow) clientWindow->AddChild(this);
|
||||||
|
|
||||||
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)
|
||||||
height = 200; // TODO: give reasonable default
|
height = 200; // TODO: give reasonable default
|
||||||
|
|
||||||
// We're deactivating the old child
|
// We're deactivating the old child
|
||||||
wxMDIChildFrame* oldActiveChild = parent->GetActiveChild();
|
wxMDIChildFrame* oldActiveChild = parent->GetActiveChild();
|
||||||
if (oldActiveChild)
|
if (oldActiveChild)
|
||||||
@@ -332,13 +332,13 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
|
|||||||
event.SetEventObject( oldActiveChild );
|
event.SetEventObject( oldActiveChild );
|
||||||
oldActiveChild->GetEventHandler()->ProcessEvent(event);
|
oldActiveChild->GetEventHandler()->ProcessEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is the currently active child
|
// This is the currently active child
|
||||||
parent->SetActiveChild((wxMDIChildFrame*) this);
|
parent->SetActiveChild((wxMDIChildFrame*) this);
|
||||||
|
|
||||||
// This time we'll try a bog-standard bulletin board for
|
// This time we'll try a bog-standard bulletin board for
|
||||||
// the 'frame'. A main window doesn't seem to work.
|
// the 'frame'. A main window doesn't seem to work.
|
||||||
|
|
||||||
m_mainWidget = (WXWidget) XtVaCreateWidget("client",
|
m_mainWidget = (WXWidget) XtVaCreateWidget("client",
|
||||||
xmBulletinBoardWidgetClass, (Widget) clientWindow->GetTopWidget(),
|
xmBulletinBoardWidgetClass, (Widget) clientWindow->GetTopWidget(),
|
||||||
XmNmarginWidth, 0,
|
XmNmarginWidth, 0,
|
||||||
@@ -354,22 +354,22 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
|
|||||||
|
|
||||||
XtAddEventHandler((Widget) m_mainWidget, ExposureMask,FALSE,
|
XtAddEventHandler((Widget) m_mainWidget, ExposureMask,FALSE,
|
||||||
wxUniversalRepaintProc, (XtPointer) this);
|
wxUniversalRepaintProc, (XtPointer) this);
|
||||||
|
|
||||||
SetCanAddEventHandler(TRUE);
|
SetCanAddEventHandler(TRUE);
|
||||||
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
|
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
|
||||||
|
|
||||||
ChangeBackgroundColour();
|
ChangeBackgroundColour();
|
||||||
|
|
||||||
XtManageChild((Widget) m_mainWidget);
|
XtManageChild((Widget) m_mainWidget);
|
||||||
|
|
||||||
SetTitle(title);
|
SetTitle(title);
|
||||||
|
|
||||||
clientWindow->AddPage(this, title, TRUE);
|
clientWindow->AddPage(this, title, TRUE);
|
||||||
clientWindow->Refresh();
|
clientWindow->Refresh();
|
||||||
|
|
||||||
// Positions the toolbar and status bar -- but we don't have any.
|
// Positions the toolbar and status bar -- but we don't have any.
|
||||||
// PreResize();
|
// PreResize();
|
||||||
|
|
||||||
wxModelessWindows.Append(this);
|
wxModelessWindows.Append(this);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -380,19 +380,19 @@ wxMDIChildFrame::~wxMDIChildFrame()
|
|||||||
if (m_mainWidget)
|
if (m_mainWidget)
|
||||||
XtRemoveEventHandler((Widget) m_mainWidget, ExposureMask,FALSE,
|
XtRemoveEventHandler((Widget) m_mainWidget, ExposureMask,FALSE,
|
||||||
wxUniversalRepaintProc, (XtPointer) this);
|
wxUniversalRepaintProc, (XtPointer) this);
|
||||||
|
|
||||||
if (GetMDIParentFrame())
|
if (GetMDIParentFrame())
|
||||||
{
|
{
|
||||||
wxMDIParentFrame* parentFrame = GetMDIParentFrame();
|
wxMDIParentFrame* parentFrame = GetMDIParentFrame();
|
||||||
|
|
||||||
if (parentFrame->GetActiveChild() == this)
|
if (parentFrame->GetActiveChild() == this)
|
||||||
parentFrame->SetActiveChild((wxMDIChildFrame*) NULL);
|
parentFrame->SetActiveChild((wxMDIChildFrame*) NULL);
|
||||||
wxMDIClientWindow* clientWindow = parentFrame->GetClientWindow();
|
wxMDIClientWindow* clientWindow = parentFrame->GetClientWindow();
|
||||||
|
|
||||||
// Remove page if still there
|
// Remove page if still there
|
||||||
if (clientWindow->RemovePage(this))
|
if (clientWindow->RemovePage(this))
|
||||||
clientWindow->Refresh();
|
clientWindow->Refresh();
|
||||||
|
|
||||||
// Set the selection to the first remaining page
|
// Set the selection to the first remaining page
|
||||||
if (clientWindow->GetPageCount() > 0)
|
if (clientWindow->GetPageCount() > 0)
|
||||||
{
|
{
|
||||||
@@ -415,14 +415,14 @@ void wxMDIChildFrame::OnRaise()
|
|||||||
wxMDIParentFrame* parentFrame = (wxMDIParentFrame*) GetParent() ;
|
wxMDIParentFrame* parentFrame = (wxMDIParentFrame*) GetParent() ;
|
||||||
wxMDIChildFrame* oldActiveChild = parentFrame->GetActiveChild();
|
wxMDIChildFrame* oldActiveChild = parentFrame->GetActiveChild();
|
||||||
parentFrame->SetActiveChild(this);
|
parentFrame->SetActiveChild(this);
|
||||||
|
|
||||||
if (oldActiveChild)
|
if (oldActiveChild)
|
||||||
{
|
{
|
||||||
wxActivateEvent event(wxEVT_ACTIVATE, FALSE, oldActiveChild->GetId());
|
wxActivateEvent event(wxEVT_ACTIVATE, FALSE, oldActiveChild->GetId());
|
||||||
event.SetEventObject( oldActiveChild );
|
event.SetEventObject( oldActiveChild );
|
||||||
oldActiveChild->GetEventHandler()->ProcessEvent(event);
|
oldActiveChild->GetEventHandler()->ProcessEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxActivateEvent event(wxEVT_ACTIVATE, TRUE, this->GetId());
|
wxActivateEvent event(wxEVT_ACTIVATE, TRUE, this->GetId());
|
||||||
event.SetEventObject( this );
|
event.SetEventObject( this );
|
||||||
this->GetEventHandler()->ProcessEvent(event);
|
this->GetEventHandler()->ProcessEvent(event);
|
||||||
@@ -432,7 +432,7 @@ void wxMDIChildFrame::OnLower()
|
|||||||
{
|
{
|
||||||
wxMDIParentFrame* parentFrame = (wxMDIParentFrame*) GetParent() ;
|
wxMDIParentFrame* parentFrame = (wxMDIParentFrame*) GetParent() ;
|
||||||
wxMDIChildFrame* oldActiveChild = parentFrame->GetActiveChild();
|
wxMDIChildFrame* oldActiveChild = parentFrame->GetActiveChild();
|
||||||
|
|
||||||
if (oldActiveChild == this)
|
if (oldActiveChild == this)
|
||||||
{
|
{
|
||||||
wxActivateEvent event(wxEVT_ACTIVATE, FALSE, oldActiveChild->GetId());
|
wxActivateEvent event(wxEVT_ACTIVATE, FALSE, oldActiveChild->GetId());
|
||||||
@@ -483,7 +483,7 @@ void wxMDIChildFrame::SetMenuBar(wxMenuBar *menuBar)
|
|||||||
// Don't create the underlying menubar yet; need to recreate
|
// Don't create the underlying menubar yet; need to recreate
|
||||||
// it every time the child is activated.
|
// it every time the child is activated.
|
||||||
m_frameMenuBar = menuBar;
|
m_frameMenuBar = menuBar;
|
||||||
|
|
||||||
// We make the assumption that if you're setting the menubar,
|
// We make the assumption that if you're setting the menubar,
|
||||||
// this is the currently active child.
|
// this is the currently active child.
|
||||||
GetMDIParentFrame()->SetChildMenuBar(this);
|
GetMDIParentFrame()->SetChildMenuBar(this);
|
||||||
@@ -495,7 +495,7 @@ void wxMDIChildFrame::SetIcon(const wxIcon& icon)
|
|||||||
m_icon = icon;
|
m_icon = icon;
|
||||||
if (m_icon.Ok())
|
if (m_icon.Ok())
|
||||||
{
|
{
|
||||||
// Not appropriate since there are no icons in
|
// Not appropriate since there are no icons in
|
||||||
// a tabbed window
|
// a tabbed window
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -577,7 +577,7 @@ wxMDIClientWindow::~wxMDIClientWindow()
|
|||||||
// By the time this destructor is called, the child frames will have been
|
// By the time this destructor is called, the child frames will have been
|
||||||
// deleted and removed from the notebook/client window.
|
// deleted and removed from the notebook/client window.
|
||||||
DestroyChildren();
|
DestroyChildren();
|
||||||
|
|
||||||
m_mainWidget = (WXWidget) 0;
|
m_mainWidget = (WXWidget) 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -585,7 +585,7 @@ bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long style)
|
|||||||
{
|
{
|
||||||
// m_windowParent = parent;
|
// m_windowParent = parent;
|
||||||
// m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE);
|
// m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE);
|
||||||
|
|
||||||
bool success = wxNotebook::Create(parent, wxID_NOTEBOOK_CLIENT_AREA, wxPoint(0, 0), wxSize(100, 100), 0);
|
bool success = wxNotebook::Create(parent, wxID_NOTEBOOK_CLIENT_AREA, wxPoint(0, 0), wxSize(100, 100), 0);
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
@@ -653,7 +653,7 @@ void wxMDIClientWindow::OnPageChanged(wxNotebookEvent& event)
|
|||||||
wxActivateEvent event(wxEVT_ACTIVATE, TRUE, activeChild->GetId());
|
wxActivateEvent event(wxEVT_ACTIVATE, TRUE, activeChild->GetId());
|
||||||
event.SetEventObject( activeChild );
|
event.SetEventObject( activeChild );
|
||||||
activeChild->GetEventHandler()->ProcessEvent(event);
|
activeChild->GetEventHandler()->ProcessEvent(event);
|
||||||
|
|
||||||
if (activeChild->GetMDIParentFrame())
|
if (activeChild->GetMDIParentFrame())
|
||||||
{
|
{
|
||||||
activeChild->GetMDIParentFrame()->SetActiveChild(activeChild);
|
activeChild->GetMDIParentFrame()->SetActiveChild(activeChild);
|
||||||
|
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user