Motif compile fixes

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2873 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling 1999-06-23 10:03:44 +00:00
parent 2d9f55970b
commit da175b2ce4
34 changed files with 521 additions and 272 deletions

View File

@ -1,44 +1,29 @@
wxPython README
---------------
Introduction
------------
The code in this subtree is a Python Extension Module that enables the
use of wxWindows from the Python language. So what is Python? Go to
http://www.python.org to learn more but in a nutshell, it's an
extremly cool object oriented language. It's easier than Perl and
nearly as powerful. It runs on more platforms than Java, and by some
reports, is even faster than Java with a JIT compiler!
Welcome to the wonderful world of wxPython!
So why would you want to use wxPython over just C++ and wxWindows?
Personally I prefer using Python for everything. I only use C++ when
I absolutly have to eek more performance out of an algorithm, and even
then I ususally code it as an extension module and leave the majority
of the program in Python. Another good thing to use wxPython for is
quick prototyping of your wxWindows apps. With C++ you have to
continuously go though the edit-compile-link-run cycle, which can be
quite time comsuming. With Python it is only an edit-run cycle. You
can easily build an application in a few hours with Python that would
normally take a few days with C++. Converting a wxPython app to a
C++/wxWindows app should be a straight forward task.
Once you have installed the wxPython extension module, you can try it
out by going to the [install dir]\wxPython\demo directory and typing:
This extension module attempts to mirror the class heiarchy of
wxWindows as closely as possble. This means that there is a wxFrame
class in wxPython that looks, smells, tastes and acts almost the same
as the wxFrame class in the C++ version. Unfortunatly, I wasn't able
to match things exactly because of differences in the languages, but
the differences should be easy to absorb because they are natural to
Python. For example, some methods that return mutliple values via
argument pointers in C++ will return a tuple of values in Python.
These differences have not been documented yet so if something isn't
working the same as described in the wxWindows documents the best
thing to do is to scan through the wxPython sources, especially the .i
files, as that is where the interfaces for wxPython are defined.
python demo.py
I have reports of successfully embedding wxPython within a wxWindows
C++ app on GTK. It hasn't yet been attempted on MSW (to my knowledge)
so I don't know how successful such an attempt would be. However it
is certainly possible.
There are also some other sample files there for you to play with and
learn from.
If you selected to install the documentation then point your browser
to [install dir]\wxPython\docs\index.htm and you will then be looking
at the docs for wxWindows. For the most part you can use the C++ docs
as most classes and methods are used identically. Where there are
differences they are documented with a "wxPython Note."
On Win32 systems the binary self-installer creates a program group on
the Start Menu that contains a link to running the demo and a link to
the help file. To help you save disk space I'm now using Microsoft's
HTML Help format. If your system doesn't know what to do with the help
file, you can install the HTML Help Viewer as part of IE 4+, NT
Service Pack 4+, or the HTML Workshop at
http://msdn.microsoft.com/workshop/author/htmlhelp/download.asp.
@ -57,6 +42,33 @@ Or you can send mail directly to the list using this address:
wxpython-users@starship.python.net
----------------------------------------------------------------------
What's new in 2.1b1
--------------------
Fixed wxComboBox.SetSelection so that it actually sets the selected
item. (Actually just removed it from wxPython and let it default to
wxChoice.SetSelection which was already doing the right thing.)
Added the Printing Framework.
Switched back to using the wxWindows DLL for the pre-built Win32
version. The problem was needing to reinitialize static class info
data after loading each extension module.
Lots of little tweaks and additions to reflect changes to various
wxWindows classes.
Fixed a bug with attaching objects to tree items. Actually was a
symptom of a larger problem with not obtaining the interpreter lock
when doing any Py_DECREFs.
wxSizer and friends. Sizers are layout tools that manage a colection
of windows and sizers. Different types of sizers apply different
types of layout algorithms. You saw it here first! These classes are
not even in the wxWindows C++ library yet!
What's new in 2.0b9

View File

@ -36,8 +36,8 @@ TARGETDIR=$(BINLIBDEST)/wxPython
wxc wx.cpp helpers.cpp windows.cpp events.cpp misc.cpp gdi.cpp \
mdi.cpp controls.cpp controls2.cpp windows2.cpp cmndlgs.cpp \
frames.cpp stattool.cpp windows3.cpp image.cpp \
utils.cpp \
frames.cpp stattool.cpp windows3.cpp image.cpp misc2.cpp \
utils.cpp printfw.cpp \
## comment out the next line to disable wxGLCanvas
##_glcanvas.cpp glcanvas.cpp -DWITH_GLCANVAS -lGL -lGLU \
-I. $(WX_CONFIG_CFLAGS) -I/usr/local/lib/glib/include \

View File

@ -269,6 +269,8 @@ cp ./src/gtk/* ~/wxgtk_dist/wxGTK/utils/wxPython/src/gtk
mkdir ~/wxgtk_dist/wxGTK/utils/wxPython/lib
cp ./lib/*.py ~/wxgtk_dist/wxGTK/utils/wxPython/lib
mkdir ~/wxgtk_dist/wxGTK/utils/wxPython/lib/sizers
cp ./lib/sizers/*.py ~/wxgtk_dist/wxGTK/utils/wxPython/lib/sizers
mkdir ~/wxgtk_dist/wxGTK/utils/wxPython/tests
cp ./tests/README.txt ~/wxgtk_dist/wxGTK/utils/wxPython/tests

View File

@ -13,53 +13,6 @@
#define _WX_DATAOBJ_H_BASE_
#if defined(__WXMSW__)
// ----------------------------------------------------------------------------
// wxDataFormat identifies the single format of data
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxDataFormat
{
public:
// the clipboard formats under Win32 are UINTs
typedef unsigned int NativeFormat;
wxDataFormat(NativeFormat format = wxDF_INVALID) { m_format = format; }
wxDataFormat& operator=(NativeFormat format)
{ m_format = format; return *this; }
// defautl copy ctor/assignment operators ok
// comparison (must have both versions)
bool operator==(wxDataFormatId format) const
{ return m_format == (NativeFormat)format; }
bool operator!=(wxDataFormatId format) const
{ return m_format != (NativeFormat)format; }
bool operator==(const wxDataFormat& format) const
{ return m_format == format.m_format; }
bool operator!=(const wxDataFormat& format) const
{ return m_format != format.m_format; }
// explicit and implicit conversions to NativeFormat which is one of
// standard data types (implicit conversion is useful for preserving the
// compatibility with old code)
NativeFormat GetFormatId() const { return m_format; }
operator NativeFormat() const { return m_format; }
// this only works with standard ids
void SetId(wxDataFormatId format) { m_format = format; }
// string ids are used for custom types - this SetId() must be used for
// application-specific formats
wxString GetId() const;
void SetId(const wxChar *format);
private:
// returns TRUE if the format is one of those defined in wxDataFormatId
bool IsStandard() const { return m_format > 0 && m_format < wxDF_MAX; }
NativeFormat m_format;
};
#include "wx/msw/ole/dataobj.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/dataobj.h"
@ -81,7 +34,7 @@ private:
class WXDLLEXPORT wxPrivateDataObject : public wxDataObject
{
#ifdef __WXGTK__
#if defined(__WXGTK__) || defined(__WXMOTIF__)
DECLARE_DYNAMIC_CLASS( wxPrivateDataObject )
#endif

View File

@ -1347,6 +1347,9 @@ typedef void* WXFont;
typedef void* WXImage;
typedef void* WXCursor;
typedef void* WXFontList;
typedef unsigned long Atom; /* this might fail on a few architectures */
#endif // Motif
#ifdef __WXGTK__

View File

@ -22,6 +22,8 @@
#include "wx/defs.h"
#include "wx/setup.h"
#include "wx/dataobj.h"
#include "wx/list.h"
#include "wx/module.h"
@ -69,10 +71,15 @@ public:
// clears wxTheClipboard and the system's clipboard if possible
virtual void Clear();
/// If primary == TRUE, use primary selection in all further ops,
/// primary=FALSE resets it.
inline void UsePrimarySelection(bool primary = TRUE) { m_usePrimary = primary; }
// implementation
bool m_open;
wxList m_data;
bool m_usePrimary;
};
/* The clipboard */

View File

@ -23,149 +23,124 @@
// classes
//-------------------------------------------------------------------------
class WXDLLEXPORT wxDataObject;
class WXDLLEXPORT wxTextDataObject;
class WXDLLEXPORT wxBitmapDataObject;
class WXDLLEXPORT wxPrivateDataObject;
class WXDLLEXPORT wxFileDataObject;
class wxDataFormat;
class wxDataObject;
class wxTextDataObject;
//-------------------------------------------------------------------------
// wxDataObject
// wxDataFormat
//-------------------------------------------------------------------------
class WXDLLEXPORT wxDataObject: public wxObject
class wxDataFormat : public wxObject
{
DECLARE_ABSTRACT_CLASS( wxDataObject )
DECLARE_CLASS( wxDataFormat )
public:
wxDataFormat();
wxDataFormat( wxDataFormatId type );
wxDataFormat( const wxString &id );
wxDataFormat( const wxChar *id );
wxDataFormat( const wxDataFormat &format );
wxDataFormat( const Atom atom );
void SetType( wxDataFormatId type );
wxDataFormatId GetType() const;
/* the string Id identifies the format of clipboard or DnD data. a word
* processor would e.g. add a wxTextDataObject and a wxPrivateDataObject
* to the clipboard - the latter with the Id "application/wxword", an
* image manipulation program would put a wxBitmapDataObject and a
* wxPrivateDataObject to the clipboard - the latter with "image/png". */
wxString GetId() const;
void SetId( const wxChar *id );
Atom GetAtom();
void SetAtom(Atom atom) { m_hasAtom = TRUE; m_atom = atom; }
// implicit conversion to wxDataFormatId
operator wxDataFormatId() const { return m_type; }
bool operator==(wxDataFormatId type) const { return m_type == type; }
bool operator!=(wxDataFormatId type) const { return m_type != type; }
private:
wxDataFormatId m_type;
wxString m_id;
bool m_hasAtom;
Atom m_atom;
};
//----------------------------------------------------------------------------
// wxDataObject to be placed in wxDataBroker
//----------------------------------------------------------------------------
class wxDataObject : public wxObject
{
DECLARE_DYNAMIC_CLASS( wxDataObject )
public:
wxDataObject() {}
~wxDataObject() {}
/* constructor */
wxDataObject();
virtual wxDataFormat GetFormat() const = 0;
// implementation
/* destructor */
~wxDataObject();
/* write data to dest */
virtual void WriteData( void *dest ) const = 0;
/* get size of data */
virtual size_t GetSize() const = 0;
/* implementation */
wxDataFormat &GetFormat();
wxDataFormatId GetFormatType() const;
wxString GetFormatId() const;
Atom GetFormatAtom() const;
wxDataFormat m_format;
};
// ----------------------------------------------------------------------------
//----------------------------------------------------------------------------
// wxTextDataObject is a specialization of wxDataObject for text data
// ----------------------------------------------------------------------------
//----------------------------------------------------------------------------
class WXDLLEXPORT wxTextDataObject : public wxDataObject
class wxTextDataObject : public wxDataObject
{
DECLARE_DYNAMIC_CLASS( wxTextDataObject )
public:
wxTextDataObject() {}
wxTextDataObject( const wxString& strText )
: m_strText(strText) { }
virtual wxDataFormat GetFormat() const
{ return wxDF_TEXT; }
void SetText( const wxString& strText)
{ m_strText = strText; }
wxString GetText() const
{ return m_strText; }
/* default constructor. call SetText() later or override
WriteData() and GetSize() for working on-demand */
wxTextDataObject();
private:
wxString m_strText;
/* constructor */
wxTextDataObject( const wxString& data );
};
/* set current text data */
void SetText( const wxString& data );
// ----------------------------------------------------------------------------
// wxFileDataObject is a specialization of wxDataObject for file names
// ----------------------------------------------------------------------------
/* get current text data */
wxString GetText() const;
class WXDLLEXPORT wxFileDataObject : public wxDataObject
{
DECLARE_DYNAMIC_CLASS( wxFileDataObject )
/* by default calls WriteString() with string set by constructor or
by SetText(). can be overridden for working on-demand */
virtual void WriteData( void *dest ) const;
public:
/* by default, returns length of string as set by constructor or
by SetText(). can be overridden for working on-demand */
virtual size_t GetSize() const;
wxFileDataObject(void) {}
virtual wxDataFormat GetFormat() const
{ return wxDF_FILENAME; }
void AddFile( const wxString &file )
{ m_files += file; m_files += (char)0; }
wxString GetFiles() const
{ return m_files; }
private:
wxString m_files;
};
/* write string to dest */
void WriteString( const wxString &str, void *dest ) const;
// ----------------------------------------------------------------------------
// wxBitmapDataObject is a specialization of wxDataObject for bitmaps
// ----------------------------------------------------------------------------
/* implementation */
class WXDLLEXPORT wxBitmapDataObject : public wxDataObject
{
DECLARE_DYNAMIC_CLASS( wxBitmapDataObject )
public:
wxBitmapDataObject(void) {}
virtual wxDataFormat GetFormat() const
{ return wxDF_BITMAP; }
void SetBitmap( const wxBitmap &bitmap )
{ m_bitmap = bitmap; }
wxBitmap GetBitmap() const
{ return m_bitmap; }
private:
wxBitmap m_bitmap;
};
// ----------------------------------------------------------------------------
// wxPrivateDataObject is a specialization of wxDataObject for app specific data
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxPrivateDataObject : public wxDataObject
{
DECLARE_DYNAMIC_CLASS( wxPrivateDataObject )
public:
wxPrivateDataObject();
~wxPrivateDataObject();
virtual wxDataFormat GetFormat() const
{ return wxDF_PRIVATE; }
// the string ID identifies the format of clipboard or DnD data. a word
// processor would e.g. add a wxTextDataObject and a wxPrivateDataObject
// to the clipboard - the latter with the Id "WXWORD_FORMAT".
void SetId( const wxString& id )
{ m_id = id; }
wxString GetId() const
{ return m_id; }
// will make internal copy
void SetData( const char *data, size_t size );
size_t GetDataSize() const
{ return m_size; }
char* GetData() const
{ return m_data; }
private:
size_t m_size;
char* m_data;
wxString m_id;
wxString m_data;
};

View File

@ -84,6 +84,9 @@ public:
virtual int ShowModal();
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);
@ -104,6 +107,7 @@ public:
//// Motif-specific
bool m_modalShowing;
wxString m_dialogTitle;
int m_returnCode;
protected:
virtual void DoSetSize(int x, int y,

View File

@ -209,6 +209,7 @@ protected:
int GetPixmapWidth() const { return m_pixmapWidth; }
int GetPixmapHeight() const { return m_pixmapHeight; }
public:
// Change properties
virtual void ChangeFont(bool keepOriginalSize = TRUE); // Change to the current font (often overridden)
virtual void DoChangeForegroundColour(WXWidget widget, wxColour& foregroundColour);
@ -220,6 +221,7 @@ protected:
// Change foreground colour using current foreground colour setting
virtual void ChangeForegroundColour();
protected:
// Adds the widget to the hash table and adds event handlers.
bool AttachWidget(wxWindow* parent, WXWidget mainWidget,
WXWidget formWidget, int x, int y, int width, int height);

View File

@ -12,6 +12,53 @@
#ifndef _WX_OLEDATAOBJ_H
#define _WX_OLEDATAOBJ_H
// ----------------------------------------------------------------------------
// wxDataFormat identifies the single format of data
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxDataFormat
{
public:
// the clipboard formats under Win32 are UINTs
typedef unsigned int NativeFormat;
wxDataFormat(NativeFormat format = wxDF_INVALID) { m_format = format; }
wxDataFormat& operator=(NativeFormat format)
{ m_format = format; return *this; }
// defautl copy ctor/assignment operators ok
// comparison (must have both versions)
bool operator==(wxDataFormatId format) const
{ return m_format == (NativeFormat)format; }
bool operator!=(wxDataFormatId format) const
{ return m_format != (NativeFormat)format; }
bool operator==(const wxDataFormat& format) const
{ return m_format == format.m_format; }
bool operator!=(const wxDataFormat& format) const
{ return m_format != format.m_format; }
// explicit and implicit conversions to NativeFormat which is one of
// standard data types (implicit conversion is useful for preserving the
// compatibility with old code)
NativeFormat GetFormatId() const { return m_format; }
operator NativeFormat() const { return m_format; }
// this only works with standard ids
void SetId(wxDataFormatId format) { m_format = format; }
// string ids are used for custom types - this SetId() must be used for
// application-specific formats
wxString GetId() const;
void SetId(const wxChar *format);
private:
// returns TRUE if the format is one of those defined in wxDataFormatId
bool IsStandard() const { return m_format > 0 && m_format < wxDF_MAX; }
NativeFormat m_format;
};
// ----------------------------------------------------------------------------
// forward declarations
// ----------------------------------------------------------------------------

View File

@ -149,7 +149,8 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
SetIcon(wxICON(mondrian));
// create a menu bar
wxMenu *menuFile = new wxMenu(wxMENU_TEAROFF);
wxMenu *menuFile = new wxMenu;
// wxMenu *menuFile = new wxMenu(wxMENU_TEAROFF);
menuFile->Append(Minimal_About, "&About...\tCtrl-A", "Show about dialog");
menuFile->AppendSeparator();

View File

@ -178,13 +178,11 @@ libwx_motif_la_SOURCES = \
spinbutt.cpp \
statbmp.cpp \
statbox.cpp \
statline.cpp \
stattext.cpp \
textctrl.cpp \
timer.cpp \
tooltip.cpp \
utilsres.cpp \
wave.cpp \
toolbar.cpp \
utils.cpp \
window.cpp
# propform.cpp \

View File

@ -92,7 +92,7 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit
m_mainWidget = (WXWidget) buttonWidget;
m_windowFont = parent->GetFont();
m_font = parent->GetFont();
ChangeFont(FALSE);
ChangeBackgroundColour ();

View File

@ -40,7 +40,7 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label,
m_windowStyle = style;
m_backgroundColour = parent->GetBackgroundColour();
m_foregroundColour = parent->GetForegroundColour();
m_windowFont = parent->GetFont();
m_font = parent->GetFont();
parent->AddChild((wxButton *)this);
@ -54,7 +54,7 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label,
XmString text = XmStringCreateSimple ((char*) (const char*) label1);
Widget parentWidget = (Widget) parent->GetClientWidget();
XmFontList fontList = (XmFontList) m_windowFont.GetFontList(1.0, XtDisplay(parentWidget));
XmFontList fontList = (XmFontList) m_font.GetFontList(1.0, XtDisplay(parentWidget));
/*
* Patch Note (important)
@ -89,8 +89,11 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label,
void wxButton::SetDefault()
{
wxWindow *parent = (wxWindow *)GetParent();
/*
TODO
if (parent)
parent->SetDefaultItem(this);
*/
// We initially do not set XmNdefaultShadowThickness, to have small buttons.
// Unfortunately, buttons are now mis-aligned. We try to correct this

View File

@ -43,7 +43,7 @@ bool wxCheckBox::Create(wxWindow *parent, wxWindowID id, const wxString& label,
m_windowStyle = style;
m_backgroundColour = parent->GetBackgroundColour();
m_foregroundColour = parent->GetForegroundColour();
m_windowFont = parent->GetFont();
m_font = parent->GetFont();
if (parent) parent->AddChild(this);
@ -56,7 +56,7 @@ bool wxCheckBox::Create(wxWindow *parent, wxWindowID id, const wxString& label,
XmString text = XmStringCreateSimple (label1);
Widget parentWidget = (Widget) parent->GetClientWidget();
XmFontList fontList = (XmFontList) m_windowFont.GetFontList(1.0, XtDisplay(parentWidget));
XmFontList fontList = (XmFontList) m_font.GetFontList(1.0, XtDisplay(parentWidget));
m_mainWidget = (WXWidget) XtVaCreateManagedWidget ("toggle",
xmToggleButtonWidgetClass, parentWidget,

View File

@ -66,7 +66,7 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id,
m_backgroundColour = parent->GetBackgroundColour();
m_foregroundColour = parent->GetForegroundColour();
m_windowFont = parent->GetFont();
m_font = parent->GetFont();
Widget parentWidget = (Widget) parent->GetClientWidget();
@ -174,9 +174,9 @@ void wxChoice::Append(const wxString& item)
DoChangeBackgroundColour((WXWidget) w, m_backgroundColour);
if (m_windowFont.Ok())
if (m_font.Ok())
XtVaSetValues (w,
XmNfontList, (XmFontList) m_windowFont.GetFontList(1.0, XtDisplay((Widget) m_formWidget)),
XmNfontList, (XmFontList) m_font.GetFontList(1.0, XtDisplay((Widget) m_formWidget)),
NULL);
WXWidget *new_widgetList = new WXWidget[m_noStrings + 1];
@ -436,12 +436,12 @@ void wxChoice::ChangeFont(bool keepOriginalSize)
// Note that this causes the widget to be resized back
// to its original size! We therefore have to set the size
// back again. TODO: a better way in Motif?
if (m_windowFont.Ok())
if (m_font.Ok())
{
int width, height, width1, height1;
GetSize(& width, & height);
XmFontList fontList = (XmFontList) m_windowFont.GetFontList(1.0, XtDisplay((Widget) m_mainWidget));
XmFontList fontList = (XmFontList) m_font.GetFontList(1.0, XtDisplay((Widget) m_mainWidget));
XtVaSetValues ((Widget) m_mainWidget, XmNfontList, fontList, NULL);
XtVaSetValues ((Widget) m_buttonWidget, XmNfontList, fontList, NULL);

View File

@ -203,16 +203,16 @@ wxObject *wxGetClipboardData(wxDataFormat dataFormat, long *len)
wxDataFormat wxEnumClipboardFormats(wxDataFormat dataFormat)
{
// Only wxDF_TEXT supported
if (dataFormat == (wxDataFormat) 0)
if (dataFormat == wxDF_TEXT)
return wxDF_TEXT;
else
return (wxDataFormat) 0;
return wxDF_INVALID;
}
wxDataFormat wxRegisterClipboardFormat(char *formatName)
{
// Not supported
return (wxDataFormat) 0;
return (wxDataFormat) wxDF_INVALID;
}
bool wxGetClipboardFormatName(wxDataFormat dataFormat, char *formatName, int maxCount)
@ -281,6 +281,7 @@ bool wxClipboard::SetData( wxDataObject *data )
return wxSetClipboardData(data->GetFormat(), (wxObject*) (const char*) str);
break;
}
/*
case wxDF_BITMAP:
case wxDF_DIB:
{
@ -289,6 +290,7 @@ bool wxClipboard::SetData( wxDataObject *data )
return wxSetClipboardData(data->GetFormat(), & bitmap);
break;
}
*/
default:
{
return FALSE;
@ -332,6 +334,7 @@ bool wxClipboard::GetData( wxDataObject *data )
return FALSE;
break;
}
/*
case wxDF_BITMAP:
case wxDF_DIB:
{
@ -347,6 +350,7 @@ bool wxClipboard::GetData( wxDataObject *data )
return FALSE;
break;
}
*/
default:
{
return FALSE;

View File

@ -84,7 +84,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
SetValue(value);
m_windowFont = parent->GetFont();
m_font = parent->GetFont();
ChangeFont(FALSE);
SetCanAddEventHandler(TRUE);

View File

@ -38,12 +38,15 @@ wxControl::~wxControl()
{
// If we delete an item, we should initialize the parent panel,
// because it could now be invalid.
/*
TODO
wxWindow *parent = (wxWindow *)GetParent();
if (parent)
{
if (parent->GetDefaultItem() == (wxButton*) this)
parent->SetDefaultItem((wxButton*) NULL);
}
*/
}
void wxControl::SetLabel(const wxString& label)

View File

@ -14,29 +14,241 @@
#include "wx/dataobj.h"
#include "wx/app.h"
#include <Xm/Xm.h>
#include "wx/utils.h"
//-------------------------------------------------------------------------
// global data
//-------------------------------------------------------------------------
Atom g_textAtom = 0;
//-------------------------------------------------------------------------
// wxDataFormat
//-------------------------------------------------------------------------
IMPLEMENT_CLASS(wxDataFormat, wxObject)
wxDataFormat::wxDataFormat()
{
if (!g_textAtom) g_textAtom = XInternAtom( (Display*) wxGetDisplay(), "STRING", FALSE );
m_type = wxDF_INVALID;
m_hasAtom = FALSE;
m_atom = (Atom) 0;
}
wxDataFormat::wxDataFormat( wxDataFormatId type )
{
if (!g_textAtom) g_textAtom = XInternAtom( (Display*) wxGetDisplay(), "STRING", FALSE );
SetType( type );
}
wxDataFormat::wxDataFormat( const wxChar *id )
{
if (!g_textAtom) g_textAtom = XInternAtom( (Display*) wxGetDisplay(), "STRING", FALSE );
SetId( id );
}
wxDataFormat::wxDataFormat( const wxString &id )
{
if (!g_textAtom) g_textAtom = XInternAtom( (Display*) wxGetDisplay(), "STRING", FALSE );
SetId( id );
}
wxDataFormat::wxDataFormat( const wxDataFormat &format )
{
if (!g_textAtom) g_textAtom = XInternAtom( (Display*) wxGetDisplay(), "STRING", FALSE );
m_type = format.GetType();
m_id = format.GetId();
m_hasAtom = TRUE;
m_atom = ((wxDataFormat &)format).GetAtom(); // const_cast
}
wxDataFormat::wxDataFormat( const Atom atom )
{
if (!g_textAtom) g_textAtom = XInternAtom( (Display*) wxGetDisplay(), "STRING", FALSE );
m_hasAtom = TRUE;
m_atom = atom;
if (m_atom == g_textAtom)
{
m_type = wxDF_TEXT;
} else
/*
if (m_atom == GDK_TARGET_BITMAP)
{
m_type = wxDF_BITMAP;
} else
*/
{
m_type = wxDF_PRIVATE;
m_id = XGetAtomName( (Display*) wxGetDisplay(), m_atom );
if (m_id == _T("file:ALL"))
{
m_type = wxDF_FILENAME;
}
}
}
void wxDataFormat::SetType( wxDataFormatId type )
{
m_type = type;
if (m_type == wxDF_TEXT)
{
m_id = _T("STRING");
}
else
if (m_type == wxDF_BITMAP)
{
m_id = _T("BITMAP");
}
else
if (m_type == wxDF_FILENAME)
{
m_id = _T("file:ALL");
}
else
{
wxFAIL_MSG( _T("invalid dataformat") );
}
m_hasAtom = FALSE;
}
wxDataFormatId wxDataFormat::GetType() const
{
return m_type;
}
wxString wxDataFormat::GetId() const
{
return m_id;
}
void wxDataFormat::SetId( const wxChar *id )
{
m_type = wxDF_PRIVATE;
m_id = id;
m_hasAtom = FALSE;
}
Atom wxDataFormat::GetAtom()
{
if (!m_hasAtom)
{
m_hasAtom = TRUE;
if (m_type == wxDF_TEXT)
{
m_atom = g_textAtom;
}
else
/*
if (m_type == wxDF_BITMAP)
{
m_atom = GDK_TARGET_BITMAP;
}
else
*/
if (m_type == wxDF_PRIVATE)
{
m_atom = XInternAtom( (Display*) wxGetDisplay(), MBSTRINGCAST m_id.mbc_str(), FALSE );
}
else
if (m_type == wxDF_FILENAME)
{
m_atom = XInternAtom( (Display*) wxGetDisplay(), "file:ALL", FALSE );
}
else
{
m_hasAtom = FALSE;
m_atom = (Atom) 0;
}
}
return m_atom;
}
//-------------------------------------------------------------------------
// wxDataObject
//-------------------------------------------------------------------------
IMPLEMENT_ABSTRACT_CLASS( wxDataObject, wxObject )
wxDataObject::wxDataObject()
{
}
wxDataObject::~wxDataObject()
{
}
wxDataFormat &wxDataObject::GetFormat()
{
return m_format;
}
wxDataFormatId wxDataObject::GetFormatType() const
{
return m_format.GetType();
}
wxString wxDataObject::GetFormatId() const
{
return m_format.GetId();
}
Atom wxDataObject::GetFormatAtom() const
{
Atom ret = ((wxDataObject*) this)->m_format.GetAtom();
return ret;
}
// ----------------------------------------------------------------------------
// wxTextDataObject
// ----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS( wxTextDataObject, wxDataObject )
// ----------------------------------------------------------------------------
// wxFileDataObject
// ----------------------------------------------------------------------------
wxTextDataObject::wxTextDataObject()
{
m_format.SetType( wxDF_TEXT );
}
IMPLEMENT_DYNAMIC_CLASS( wxFileDataObject, wxDataObject )
wxTextDataObject::wxTextDataObject( const wxString& data )
{
m_format.SetType( wxDF_TEXT );
// ----------------------------------------------------------------------------
// wxBitmapDataObject
// ----------------------------------------------------------------------------
m_data = data;
}
IMPLEMENT_DYNAMIC_CLASS( wxBitmapDataObject, wxDataObject )
void wxTextDataObject::SetText( const wxString& data )
{
m_data = data;
}
wxString wxTextDataObject::GetText() const
{
return m_data;
}
void wxTextDataObject::WriteData( void *dest ) const
{
WriteString( m_data, dest );
}
size_t wxTextDataObject::GetSize() const
{
return m_data.Len() + 1;
}
void wxTextDataObject::WriteString( const wxString &str, void *dest ) const
{
memcpy( dest, str.mb_str(), str.Len()+1 );
}
// ----------------------------------------------------------------------------
// wxPrivateDataObject
@ -44,26 +256,45 @@ IMPLEMENT_DYNAMIC_CLASS( wxBitmapDataObject, wxDataObject )
IMPLEMENT_DYNAMIC_CLASS( wxPrivateDataObject, wxDataObject )
wxPrivateDataObject::wxPrivateDataObject()
{
m_size = 0;
m_data = (char*) NULL;
m_id = wxTheApp->GetAppName();
}
wxPrivateDataObject::~wxPrivateDataObject()
{
if (m_data) delete[] m_data;
}
void wxPrivateDataObject::SetData( const char *data, size_t size )
void wxPrivateDataObject::Free()
{
m_size = size;
if (m_data) delete[] m_data;
m_data = new char[size];
memcpy( m_data, data, size );
if ( m_data )
free(m_data);
}
wxPrivateDataObject::wxPrivateDataObject()
{
wxString id = _T("application/");
id += wxTheApp->GetAppName();
m_format.SetId( id );
m_size = 0;
m_data = (void *)NULL;
}
void wxPrivateDataObject::SetData( const void *data, size_t size )
{
Free();
m_size = size;
m_data = malloc(size);
memcpy( m_data, data, size );
}
void wxPrivateDataObject::WriteData( void *dest ) const
{
WriteData( m_data, dest );
}
size_t wxPrivateDataObject::GetSize() const
{
return m_size;
}
void wxPrivateDataObject::WriteData( const void *data, void *dest ) const
{
memcpy( dest, data, GetSize() );
}

View File

@ -60,6 +60,8 @@ wxList wxModalDialogs;
wxList wxModelessWindows; // Frames and modeless dialogs
extern wxList wxPendingDelete;
extern wxHashTable *wxWidgetHashTable;
#define wxUSE_INVISIBLE_RESIZE 1
#if !USE_SHARED_LIBRARY
@ -139,7 +141,7 @@ bool wxDialog::Create(wxWindow *parent, wxWindowID id,
XmStringFree(str);
}
m_windowFont = wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
m_font = wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
ChangeFont(FALSE);
wxAddWindowToTable(dialogShell, this);

View File

@ -50,6 +50,8 @@
#include "wx/motif/private.h"
extern wxHashTable *wxWidgetHashTable;
void wxCloseFrameCallback(Widget, XtPointer, XmAnyCallbackStruct *cbs);
void wxFrameFocusProc(Widget workArea, XtPointer clientData,
XmAnyCallbackStruct *cbs);
@ -91,7 +93,7 @@ wxFrame::wxFrame()
m_frameMenuBar = NULL;
m_frameStatusBar = NULL;
m_windowParent = NULL;
m_parent = NULL;
m_iconized = FALSE;
//// Motif-specific
@ -133,7 +135,7 @@ bool wxFrame::Create(wxWindow *parent,
m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE);
m_foregroundColour = *wxBLACK;
m_windowFont = wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
m_font = wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
if ( id > -1 )
m_windowId = id;

View File

@ -123,7 +123,7 @@ bool wxGauge::Create(wxWindow *parent, wxWindowID id,
if (height == -1)
height = 80;
m_windowFont = parent->GetFont();
m_font = parent->GetFont();
ChangeFont(FALSE);
SetCanAddEventHandler(TRUE);

View File

@ -111,7 +111,7 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
XtAddCallback (listWidget, XmNdefaultActionCallback, (XtCallbackProc) wxListBoxDefaultActionProc,
(XtPointer) this);
m_windowFont = parent->GetFont();
m_font = parent->GetFont();
ChangeFont(FALSE);
SetCanAddEventHandler(TRUE);

View File

@ -302,7 +302,7 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE);
m_foregroundColour = *wxBLACK;
m_windowFont = wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
m_font = wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
if ( id > -1 )
m_windowId = id;

View File

@ -63,7 +63,7 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
m_radioButtonLabels = (wxString*) NULL;
m_backgroundColour = parent->GetBackgroundColour();
m_foregroundColour = parent->GetForegroundColour();
m_windowFont = parent->GetFont();
m_font = parent->GetFont();
SetName(name);
SetValidator(val);
@ -98,7 +98,7 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
m_formWidget = (WXWidget) formWidget;
XmFontList fontList = (XmFontList) m_windowFont.GetFontList(1.0, XtDisplay(parentWidget));
XmFontList fontList = (XmFontList) m_font.GetFontList(1.0, XtDisplay(parentWidget));
if (label1 != "")
{
text = XmStringCreateSimple ((char*) (const char*) label1);
@ -177,7 +177,7 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
}
SetSelection (0);
m_windowFont = parent->GetFont();
m_font = parent->GetFont();
ChangeFont(FALSE);
// XtManageChild((Widget) m_formWidget);
@ -424,7 +424,7 @@ void wxRadioBox::ChangeFont(bool keepOriginalSize)
{
wxWindow::ChangeFont(keepOriginalSize);
XmFontList fontList = (XmFontList) m_windowFont.GetFontList(1.0, XtDisplay((Widget) GetTopWidget()));
XmFontList fontList = (XmFontList) m_font.GetFontList(1.0, XtDisplay((Widget) GetTopWidget()));
int i;
for (i = 0; i < m_noItems; i++)

View File

@ -47,7 +47,7 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id,
SetValidator(validator);
m_backgroundColour = parent->GetBackgroundColour();
m_foregroundColour = parent->GetForegroundColour();
m_windowFont = parent->GetFont();
m_font = parent->GetFont();
if (parent) parent->AddChild(this);
@ -64,7 +64,7 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id,
XmString text = XmStringCreateSimple ((char*) (const char*) label1);
XmFontList fontList = (XmFontList) m_windowFont.GetFontList(1.0, XtDisplay(parentWidget));
XmFontList fontList = (XmFontList) m_font.GetFontList(1.0, XtDisplay(parentWidget));
Widget radioButtonWidget = XtVaCreateManagedWidget ("toggle",
#if wxUSE_GADGETS

View File

@ -99,7 +99,7 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
XtAddCallback (sliderWidget, XmNdragCallback, (XtCallbackProc) wxSliderCallback, (XtPointer) this);
m_windowFont = parent->GetFont();
m_font = parent->GetFont();
ChangeFont(FALSE);
SetCanAddEventHandler(TRUE);

View File

@ -66,7 +66,7 @@ bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID id,
XmNlabelType, XmPIXMAP,
NULL);
m_windowFont = parent->GetFont();
m_font = parent->GetFont();
ChangeFont(FALSE);
SetCanAddEventHandler(TRUE);

View File

@ -27,7 +27,7 @@
IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl)
BEGIN_EVENT_TABLE(wxStaticBox, wxControl)
EVT_ERASE_BACKGROUND(wxStaticBox::OnEraseBackground)
// EVT_ERASE_BACKGROUND(wxStaticBox::OnEraseBackground)
END_EVENT_TABLE()
#endif
@ -53,7 +53,7 @@ bool wxStaticBox::Create(wxWindow *parent, wxWindowID id,
m_labelWidget = (WXWidget) 0;
m_backgroundColour = parent->GetBackgroundColour();
m_foregroundColour = parent->GetForegroundColour();
m_windowFont = parent->GetFont();
m_font = parent->GetFont();
SetName(name);
@ -79,7 +79,7 @@ bool wxStaticBox::Create(wxWindow *parent, wxWindowID id,
if (hasLabel)
{
XmFontList fontList = (XmFontList) m_windowFont.GetFontList(1.0, XtDisplay(parentWidget));
XmFontList fontList = (XmFontList) m_font.GetFontList(1.0, XtDisplay(parentWidget));
wxString label1(wxStripMenuCodes(label));
XmString text = XmStringCreateSimple ((char*) (const char*) label1);

View File

@ -45,7 +45,7 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
m_windowId = id;
m_windowStyle = style;
m_windowFont = parent->GetFont();
m_font = parent->GetFont();
char* label1 = (label.IsNull() ? "" : (char*) (const char*) label);
@ -56,7 +56,7 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
// XmString text = XmStringCreateSimple (label1);
XmString text = XmStringCreateLtoR (label1, XmSTRING_DEFAULT_CHARSET);
XmFontList fontList = (XmFontList) m_windowFont.GetFontList(1.0, XtDisplay(parentWidget));
XmFontList fontList = (XmFontList) m_font.GetFontList(1.0, XtDisplay(parentWidget));
m_mainWidget = (WXWidget) XtVaCreateManagedWidget ((char*) (const char*) name,
xmLabelWidgetClass,

View File

@ -185,7 +185,7 @@ bool wxTextCtrl::Create(wxWindow *parent,
XtAddCallback((Widget) m_mainWidget, XmNlosingFocusCallback, (XtCallbackProc)wxTextWindowLoseFocusProc, (XtPointer)this);
// font
m_windowFont = parent->GetFont();
m_font = parent->GetFont();
ChangeFont(FALSE);
SetCanAddEventHandler(TRUE);

View File

@ -106,7 +106,7 @@ bool wxToolBar::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, cons
m_mainWidget = (WXWidget) toolbar;
m_windowFont = parent->GetFont();
m_font = parent->GetFont();
ChangeFont(FALSE);
SetCanAddEventHandler(TRUE);

View File

@ -541,8 +541,8 @@ wxXSetBusyCursor (wxWindow * win, wxCursor * cursor)
else
{
// Restore old cursor
if (win->GetCursor()->Ok())
attrs.cursor = (Cursor) win->GetCursor()->GetXCursor(display);
if (win->GetCursor().Ok())
attrs.cursor = (Cursor) win->GetCursor().GetXCursor(display);
else
attrs.cursor = None;
}