stream compile fixes
bitmap, icon, imaglist work (broken) notebook client resize fixed (ugly) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@237 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -47,7 +47,7 @@ class wxImageList: public wxObject
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
wxImageList::wxImageList() { }
|
wxImageList::wxImageList() { }
|
||||||
wxImageList(int width, int height, bool mask = TRUE, int initialCount = 1);
|
wxImageList( int width, int height, bool mask = TRUE, int initialCount = 1 );
|
||||||
~wxImageList();
|
~wxImageList();
|
||||||
bool Create();
|
bool Create();
|
||||||
int GetImageCount() const;
|
int GetImageCount() const;
|
||||||
@@ -62,6 +62,8 @@ class wxImageList: public wxObject
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
wxList m_images;
|
wxList m_images;
|
||||||
|
int m_width;
|
||||||
|
int m_height;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __IMAGELISTH_G__
|
#endif // __IMAGELISTH_G__
|
||||||
|
@@ -102,6 +102,8 @@ class wxBitmap: public wxObject
|
|||||||
wxMask *GetMask(void) const;
|
wxMask *GetMask(void) const;
|
||||||
void SetMask( wxMask *mask );
|
void SetMask( wxMask *mask );
|
||||||
|
|
||||||
|
void Resize( int height, int width );
|
||||||
|
|
||||||
bool SaveFile( const wxString &name, int type, wxPalette *palette = NULL );
|
bool SaveFile( const wxString &name, int type, wxPalette *palette = NULL );
|
||||||
bool LoadFile( const wxString &name, int type );
|
bool LoadFile( const wxString &name, int type );
|
||||||
|
|
||||||
@@ -121,6 +123,10 @@ class wxBitmap: public wxObject
|
|||||||
GdkPixmap *GetPixmap(void) const;
|
GdkPixmap *GetPixmap(void) const;
|
||||||
GdkBitmap *GetBitmap(void) const;
|
GdkBitmap *GetBitmap(void) const;
|
||||||
|
|
||||||
|
void DestroyImage(void);
|
||||||
|
void RecreateImage(void);
|
||||||
|
void Render(void);
|
||||||
|
|
||||||
// no data :-)
|
// no data :-)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -70,7 +70,9 @@ class wxFrame: public wxWindow
|
|||||||
wxString GetTitle(void) const;
|
wxString GetTitle(void) const;
|
||||||
void OnActivate( wxActivateEvent &WXUNUSED(event) ) {};
|
void OnActivate( wxActivateEvent &WXUNUSED(event) ) {};
|
||||||
|
|
||||||
void GtkOnSize( int width, int height );
|
//private:
|
||||||
|
|
||||||
|
void GtkOnSize( int x, int y, int width, int height );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@@ -40,11 +40,8 @@ public:
|
|||||||
|
|
||||||
inline wxIcon(const wxIcon& icon) { Ref(icon); }
|
inline wxIcon(const wxIcon& icon) { Ref(icon); }
|
||||||
inline wxIcon(const wxIcon* icon) { if (icon) Ref(*icon); }
|
inline wxIcon(const wxIcon* icon) { if (icon) Ref(*icon); }
|
||||||
|
wxIcon( char **bits, int width=-1, int height=-1 );
|
||||||
|
|
||||||
// Don't change this. Robert.
|
|
||||||
wxIcon( char **bits, int WXUNUSED(width), int WXUNUSED(height) ) :
|
|
||||||
wxBitmap( bits ) {};
|
|
||||||
|
|
||||||
inline wxIcon& operator = (const wxIcon& icon) { if (*this == icon) return (*this); Ref(icon); return *this; }
|
inline wxIcon& operator = (const wxIcon& icon) { if (*this == icon) return (*this); Ref(icon); return *this; }
|
||||||
inline bool operator == (const wxIcon& icon) { return m_refData == icon.m_refData; }
|
inline bool operator == (const wxIcon& icon) { return m_refData == icon.m_refData; }
|
||||||
inline bool operator != (const wxIcon& icon) { return m_refData != icon.m_refData; }
|
inline bool operator != (const wxIcon& icon) { return m_refData != icon.m_refData; }
|
||||||
|
@@ -31,6 +31,7 @@ class wxNotebookPage;
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// notebook events
|
// notebook events
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
class wxNotebookEvent : public wxCommandEvent
|
class wxNotebookEvent : public wxCommandEvent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -139,10 +140,6 @@ public:
|
|||||||
// base class virtuals
|
// base class virtuals
|
||||||
virtual void AddChild(wxWindow *child);
|
virtual void AddChild(wxWindow *child);
|
||||||
|
|
||||||
protected:
|
|
||||||
// wxWin callbacks
|
|
||||||
void OnSize(wxSizeEvent& event);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// common part of all ctors
|
// common part of all ctors
|
||||||
void Init();
|
void Init();
|
||||||
|
@@ -102,6 +102,8 @@ class wxBitmap: public wxObject
|
|||||||
wxMask *GetMask(void) const;
|
wxMask *GetMask(void) const;
|
||||||
void SetMask( wxMask *mask );
|
void SetMask( wxMask *mask );
|
||||||
|
|
||||||
|
void Resize( int height, int width );
|
||||||
|
|
||||||
bool SaveFile( const wxString &name, int type, wxPalette *palette = NULL );
|
bool SaveFile( const wxString &name, int type, wxPalette *palette = NULL );
|
||||||
bool LoadFile( const wxString &name, int type );
|
bool LoadFile( const wxString &name, int type );
|
||||||
|
|
||||||
@@ -121,6 +123,10 @@ class wxBitmap: public wxObject
|
|||||||
GdkPixmap *GetPixmap(void) const;
|
GdkPixmap *GetPixmap(void) const;
|
||||||
GdkBitmap *GetBitmap(void) const;
|
GdkBitmap *GetBitmap(void) const;
|
||||||
|
|
||||||
|
void DestroyImage(void);
|
||||||
|
void RecreateImage(void);
|
||||||
|
void Render(void);
|
||||||
|
|
||||||
// no data :-)
|
// no data :-)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -70,7 +70,9 @@ class wxFrame: public wxWindow
|
|||||||
wxString GetTitle(void) const;
|
wxString GetTitle(void) const;
|
||||||
void OnActivate( wxActivateEvent &WXUNUSED(event) ) {};
|
void OnActivate( wxActivateEvent &WXUNUSED(event) ) {};
|
||||||
|
|
||||||
void GtkOnSize( int width, int height );
|
//private:
|
||||||
|
|
||||||
|
void GtkOnSize( int x, int y, int width, int height );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@@ -40,11 +40,8 @@ public:
|
|||||||
|
|
||||||
inline wxIcon(const wxIcon& icon) { Ref(icon); }
|
inline wxIcon(const wxIcon& icon) { Ref(icon); }
|
||||||
inline wxIcon(const wxIcon* icon) { if (icon) Ref(*icon); }
|
inline wxIcon(const wxIcon* icon) { if (icon) Ref(*icon); }
|
||||||
|
wxIcon( char **bits, int width=-1, int height=-1 );
|
||||||
|
|
||||||
// Don't change this. Robert.
|
|
||||||
wxIcon( char **bits, int WXUNUSED(width), int WXUNUSED(height) ) :
|
|
||||||
wxBitmap( bits ) {};
|
|
||||||
|
|
||||||
inline wxIcon& operator = (const wxIcon& icon) { if (*this == icon) return (*this); Ref(icon); return *this; }
|
inline wxIcon& operator = (const wxIcon& icon) { if (*this == icon) return (*this); Ref(icon); return *this; }
|
||||||
inline bool operator == (const wxIcon& icon) { return m_refData == icon.m_refData; }
|
inline bool operator == (const wxIcon& icon) { return m_refData == icon.m_refData; }
|
||||||
inline bool operator != (const wxIcon& icon) { return m_refData != icon.m_refData; }
|
inline bool operator != (const wxIcon& icon) { return m_refData != icon.m_refData; }
|
||||||
|
@@ -31,6 +31,7 @@ class wxNotebookPage;
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// notebook events
|
// notebook events
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
class wxNotebookEvent : public wxCommandEvent
|
class wxNotebookEvent : public wxCommandEvent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -139,10 +140,6 @@ public:
|
|||||||
// base class virtuals
|
// base class virtuals
|
||||||
virtual void AddChild(wxWindow *child);
|
virtual void AddChild(wxWindow *child);
|
||||||
|
|
||||||
protected:
|
|
||||||
// wxWin callbacks
|
|
||||||
void OnSize(wxSizeEvent& event);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// common part of all ctors
|
// common part of all ctors
|
||||||
void Init();
|
void Init();
|
||||||
|
@@ -11,7 +11,8 @@
|
|||||||
#ifndef __WXMMSTREAM_H__
|
#ifndef __WXMMSTREAM_H__
|
||||||
#define __WXMMSTREAM_H__
|
#define __WXMMSTREAM_H__
|
||||||
|
|
||||||
#include <wx/stream.h>
|
#include "wx/object.h"
|
||||||
|
#include "wx/stream.h"
|
||||||
|
|
||||||
class wxMemoryStreamBase: public wxStream {
|
class wxMemoryStreamBase: public wxStream {
|
||||||
DECLARE_CLASS(wxMemoryStreamBase)
|
DECLARE_CLASS(wxMemoryStreamBase)
|
||||||
|
@@ -91,7 +91,7 @@ class wxFilterInputStream: public wxInputStream {
|
|||||||
wxInputStream *m_parent_i_stream;
|
wxInputStream *m_parent_i_stream;
|
||||||
};
|
};
|
||||||
|
|
||||||
class wxFilterOuputStream: pubilc wxOutputStream {
|
class wxFilterOutputStream: public wxOutputStream {
|
||||||
DECLARE_CLASS(wxFilterOutputStream)
|
DECLARE_CLASS(wxFilterOutputStream)
|
||||||
public:
|
public:
|
||||||
wxFilterOutputStream(wxOutputStream& stream);
|
wxFilterOutputStream(wxOutputStream& stream);
|
||||||
@@ -102,8 +102,8 @@ class wxFilterOuputStream: pubilc wxOutputStream {
|
|||||||
virtual size_t SeekO(int pos, wxWhenceType whence = wxBeginPosition)
|
virtual size_t SeekO(int pos, wxWhenceType whence = wxBeginPosition)
|
||||||
{ return m_parent_o_stream->SeekO(pos, whence); }
|
{ return m_parent_o_stream->SeekO(pos, whence); }
|
||||||
|
|
||||||
virtual bool Eof() const { return m_parent_o_sream->Eof(); }
|
virtual bool Bad() const { return m_parent_o_stream->Bad(); }
|
||||||
virtual size_t LastRead() const { return m_parent_o_stream->LastRead(); }
|
virtual size_t LastWrite() const { return m_parent_o_stream->LastWrite(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
wxOutputStream *m_parent_o_stream;
|
wxOutputStream *m_parent_o_stream;
|
||||||
|
@@ -133,6 +133,8 @@ const ID_CHOICE_APPEND = 124;
|
|||||||
|
|
||||||
const ID_COMBO = 140;
|
const ID_COMBO = 140;
|
||||||
|
|
||||||
|
const ID_TEXT = 150;
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(MyPanel, wxPanel)
|
BEGIN_EVENT_TABLE(MyPanel, wxPanel)
|
||||||
EVT_SIZE ( MyPanel::OnSize)
|
EVT_SIZE ( MyPanel::OnSize)
|
||||||
EVT_LISTBOX (ID_LISTBOX, MyPanel::OnListBox)
|
EVT_LISTBOX (ID_LISTBOX, MyPanel::OnListBox)
|
||||||
@@ -177,6 +179,9 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) :
|
|||||||
panel = new wxPanel(m_notebook);
|
panel = new wxPanel(m_notebook);
|
||||||
m_combo = new wxComboBox( panel, ID_COMBO, "This", wxPoint(10,10), wxSize(120,-1), 9, choices );
|
m_combo = new wxComboBox( panel, ID_COMBO, "This", wxPoint(10,10), wxSize(120,-1), 9, choices );
|
||||||
m_notebook->AddPage(panel, "wxComboBox");
|
m_notebook->AddPage(panel, "wxComboBox");
|
||||||
|
|
||||||
|
wxTextCtrl *text = new wxTextCtrl( m_notebook, ID_TEXT, "Write text here.", wxPoint(0,20), wxSize(120,100), wxTE_MULTILINE );
|
||||||
|
m_notebook->AddPage( text, "wxTextCtrl" );
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyPanel::OnSize( wxSizeEvent& WXUNUSED(event) )
|
void MyPanel::OnSize( wxSizeEvent& WXUNUSED(event) )
|
||||||
|
@@ -44,7 +44,7 @@ unsigned long wxDataInputStream::Read32()
|
|||||||
{
|
{
|
||||||
char buf[4];
|
char buf[4];
|
||||||
|
|
||||||
if (!m_istream)
|
if (!m_parent_i_stream)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
Read(buf, 4);
|
Read(buf, 4);
|
||||||
@@ -59,7 +59,7 @@ unsigned short wxDataInputStream::Read16()
|
|||||||
{
|
{
|
||||||
char buf[2];
|
char buf[2];
|
||||||
|
|
||||||
if (!m_istream)
|
if (!m_parent_i_stream)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
Read(buf, 2);
|
Read(buf, 2);
|
||||||
@@ -72,7 +72,7 @@ unsigned char wxDataInputStream::Read8()
|
|||||||
{
|
{
|
||||||
char buf;
|
char buf;
|
||||||
|
|
||||||
if (!m_istream)
|
if (!m_parent_i_stream)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
Read(&buf, 1);
|
Read(&buf, 1);
|
||||||
@@ -87,7 +87,7 @@ double wxDataInputStream::ReadDouble()
|
|||||||
#if USE_APPLE_IEEE
|
#if USE_APPLE_IEEE
|
||||||
char buf[10];
|
char buf[10];
|
||||||
|
|
||||||
if (!m_istream)
|
if (!m_parent_i_stream)
|
||||||
return 0.0;
|
return 0.0;
|
||||||
|
|
||||||
Read(buf, 10);
|
Read(buf, 10);
|
||||||
@@ -101,7 +101,7 @@ wxString wxDataInputStream::ReadLine()
|
|||||||
{
|
{
|
||||||
char i_strg[255];
|
char i_strg[255];
|
||||||
|
|
||||||
if (!m_istream)
|
if (!m_parent_i_stream)
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
// TODO: Implement ReadLine
|
// TODO: Implement ReadLine
|
||||||
@@ -114,7 +114,7 @@ wxString wxDataInputStream::ReadString()
|
|||||||
char *string;
|
char *string;
|
||||||
unsigned long len;
|
unsigned long len;
|
||||||
|
|
||||||
if (!m_istream)
|
if (!m_parent_i_stream)
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
len = Read32();
|
len = Read32();
|
||||||
@@ -138,7 +138,7 @@ void wxDataOutputStream::Write32(unsigned long i)
|
|||||||
{
|
{
|
||||||
char buf[4];
|
char buf[4];
|
||||||
|
|
||||||
if (!m_ostream)
|
if (!m_parent_o_stream)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
buf[0] = i & 0xff;
|
buf[0] = i & 0xff;
|
||||||
@@ -152,7 +152,7 @@ void wxDataOutputStream::Write16(unsigned short i)
|
|||||||
{
|
{
|
||||||
char buf[2];
|
char buf[2];
|
||||||
|
|
||||||
if (!m_ostream)
|
if (!m_parent_o_stream)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
buf[0] = i & 0xff;
|
buf[0] = i & 0xff;
|
||||||
@@ -162,7 +162,7 @@ void wxDataOutputStream::Write16(unsigned short i)
|
|||||||
|
|
||||||
void wxDataOutputStream::Write8(unsigned char i)
|
void wxDataOutputStream::Write8(unsigned char i)
|
||||||
{
|
{
|
||||||
if (!m_ostream)
|
if (!m_parent_o_stream)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Write(&i, 1);
|
Write(&i, 1);
|
||||||
@@ -176,7 +176,7 @@ void wxDataOutputStream::WriteLine(const wxString& line)
|
|||||||
wxString tmp_string = line + '\n';
|
wxString tmp_string = line + '\n';
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!m_ostream)
|
if (!m_parent_o_stream)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Write((const char *) tmp_string, tmp_string.Length());
|
Write((const char *) tmp_string, tmp_string.Length());
|
||||||
@@ -184,7 +184,7 @@ void wxDataOutputStream::WriteLine(const wxString& line)
|
|||||||
|
|
||||||
void wxDataOutputStream::WriteString(const wxString& string)
|
void wxDataOutputStream::WriteString(const wxString& string)
|
||||||
{
|
{
|
||||||
if (!m_ostream)
|
if (!m_parent_o_stream)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Write32(string.Length());
|
Write32(string.Length());
|
||||||
@@ -198,7 +198,7 @@ void wxDataOutputStream::WriteDouble(double d)
|
|||||||
{
|
{
|
||||||
char buf[10];
|
char buf[10];
|
||||||
|
|
||||||
if (!m_ostream)
|
if (!m_parent_o_stream)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#if USE_APPLE_IEEE
|
#if USE_APPLE_IEEE
|
||||||
|
@@ -14,14 +14,14 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <wx/stream.h>
|
#include "wx/stream.h"
|
||||||
#include <wx/mstream.h>
|
#include "wx/mstream.h"
|
||||||
|
|
||||||
#if !USE_SHARED_LIBRARY
|
#if !USE_SHARED_LIBRARY
|
||||||
IMPLEMENT_CLASS(wxMemoryStreamBase, wxStream)
|
IMPLEMENT_CLASS(wxMemoryStreamBase, wxStream)
|
||||||
IMPLEMENT_CLASS(wxMemoryInputStream, wxMemoryStreamBase)
|
IMPLEMENT_CLASS(wxMemoryInputStream, wxMemoryStreamBase)
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxMemoryOutputStream, wxMemoryStreamBase)
|
//IMPLEMENT_DYNAMIC_CLASS(wxMemoryOutputStream, wxMemoryStreamBase)
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxMemoryStream, wxMemoryStreamBase)
|
//IMPLEMENT_DYNAMIC_CLASS(wxMemoryStream, wxMemoryStreamBase)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wxMemoryStreamBase::wxMemoryStreamBase(char *data, size_t length, int iolimit)
|
wxMemoryStreamBase::wxMemoryStreamBase(char *data, size_t length, int iolimit)
|
||||||
|
@@ -13,8 +13,8 @@
|
|||||||
#pragma implementation "stream.h"
|
#pragma implementation "stream.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <wx/object.h>
|
#include "wx/object.h"
|
||||||
#include "stream.h"
|
#include "wx/stream.h"
|
||||||
|
|
||||||
#if !USE_SHARED_LIBRARY
|
#if !USE_SHARED_LIBRARY
|
||||||
IMPLEMENT_ABSTRACT_CLASS(wxInputStream, wxObject)
|
IMPLEMENT_ABSTRACT_CLASS(wxInputStream, wxObject)
|
||||||
@@ -65,9 +65,19 @@ wxOutputStream& wxOutputStream::Write(wxInputStream& stream_in)
|
|||||||
wxFilterInputStream::wxFilterInputStream(wxInputStream& stream)
|
wxFilterInputStream::wxFilterInputStream(wxInputStream& stream)
|
||||||
: wxInputStream()
|
: wxInputStream()
|
||||||
{
|
{
|
||||||
m_parent_stream = &stream;
|
m_parent_i_stream = &stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxFilterInputStream::~wxFilterInputStream()
|
wxFilterInputStream::~wxFilterInputStream()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxFilterOutputStream::wxFilterOutputStream(wxOutputStream& stream)
|
||||||
|
: wxOutputStream()
|
||||||
|
{
|
||||||
|
m_parent_o_stream = &stream;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxFilterOutputStream::~wxFilterOutputStream()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@@ -20,8 +20,10 @@
|
|||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxImageList, wxObject)
|
IMPLEMENT_DYNAMIC_CLASS(wxImageList, wxObject)
|
||||||
|
|
||||||
wxImageList::wxImageList(int width, int height, bool mask, int initialCount)
|
wxImageList::wxImageList( int width, int height, bool WXUNUSED(mask), int WXUNUSED(initialCount) )
|
||||||
{
|
{
|
||||||
|
m_width = width;
|
||||||
|
m_height = height;
|
||||||
Create();
|
Create();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -81,6 +83,15 @@ bool wxImageList::RemoveAll()
|
|||||||
|
|
||||||
bool wxImageList::GetSize( int index, int &width, int &height ) const
|
bool wxImageList::GetSize( int index, int &width, int &height ) const
|
||||||
{
|
{
|
||||||
|
#ifdef __WXGTK__
|
||||||
|
|
||||||
|
width = m_width;
|
||||||
|
height = m_height;
|
||||||
|
|
||||||
|
return (m_images.Nth( index ) != NULL);
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
wxNode *node = m_images.Nth( index );
|
wxNode *node = m_images.Nth( index );
|
||||||
if (node)
|
if (node)
|
||||||
{
|
{
|
||||||
@@ -95,17 +106,33 @@ bool wxImageList::GetSize( int index, int &width, int &height ) const
|
|||||||
height = 0;
|
height = 0;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
bool wxImageList::Draw( int index, wxDC &dc,
|
bool wxImageList::Draw( int index, wxDC &dc, int x, int y,
|
||||||
int x, int y,
|
int flags, bool WXUNUSED(solidBackground) )
|
||||||
int WXUNUSED(flags), bool WXUNUSED(solidBackground) )
|
|
||||||
{
|
{
|
||||||
wxNode *node = m_images.Nth( index );
|
wxNode *node = m_images.Nth( index );
|
||||||
if (!node) return FALSE;
|
if (!node) return FALSE;
|
||||||
wxBitmap *bm = (wxBitmap*)node->Data();
|
wxBitmap *bm = (wxBitmap*)node->Data();
|
||||||
|
|
||||||
|
#ifdef __WXGTK__
|
||||||
|
|
||||||
|
// As X doesn't have a standard size for icons, we resize here.
|
||||||
|
// Otherwise we'd simply have to forbid different bitmap sizes.
|
||||||
|
|
||||||
|
if ((m_width != bm->GetWidth()) ||
|
||||||
|
(m_height != bm->GetHeight()))
|
||||||
|
{
|
||||||
|
bm->Resize( m_width, m_height );
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
wxIcon *icon = (wxIcon*)bm;
|
wxIcon *icon = (wxIcon*)bm;
|
||||||
dc.DrawIcon( *icon, x, y );
|
dc.DrawIcon( *icon, x, y, (flags & wxIMAGELIST_DRAW_TRANSPARENT) > 0 );
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -74,6 +74,9 @@ class wxBitmapRefData: public wxObjectRefData
|
|||||||
int m_width;
|
int m_width;
|
||||||
int m_height;
|
int m_height;
|
||||||
int m_bpp;
|
int m_bpp;
|
||||||
|
#ifdef USE_GDK_IMLIB
|
||||||
|
GdkImlibImage *m_image;
|
||||||
|
#endif
|
||||||
wxPalette *m_palette;
|
wxPalette *m_palette;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -92,10 +95,11 @@ wxBitmapRefData::~wxBitmapRefData(void)
|
|||||||
{
|
{
|
||||||
#ifdef USE_GDK_IMLIB
|
#ifdef USE_GDK_IMLIB
|
||||||
if (m_pixmap) gdk_imlib_free_pixmap( m_pixmap );
|
if (m_pixmap) gdk_imlib_free_pixmap( m_pixmap );
|
||||||
|
if (m_image) gdk_imlib_destroy_image( m_image );
|
||||||
#else
|
#else
|
||||||
if (m_pixmap) gdk_pixmap_unref( m_pixmap );
|
if (m_pixmap) gdk_pixmap_unref( m_pixmap );
|
||||||
if (m_bitmap) gdk_bitmap_unref( m_bitmap );
|
|
||||||
#endif
|
#endif
|
||||||
|
if (m_bitmap) gdk_bitmap_unref( m_bitmap );
|
||||||
if (m_mask) delete m_mask;
|
if (m_mask) delete m_mask;
|
||||||
if (m_palette) delete m_palette;
|
if (m_palette) delete m_palette;
|
||||||
};
|
};
|
||||||
@@ -126,22 +130,26 @@ wxBitmap::wxBitmap( int width, int height, int depth )
|
|||||||
wxBitmap::wxBitmap( char **bits )
|
wxBitmap::wxBitmap( char **bits )
|
||||||
{
|
{
|
||||||
m_refData = new wxBitmapRefData();
|
m_refData = new wxBitmapRefData();
|
||||||
|
|
||||||
GdkBitmap *mask = NULL;
|
|
||||||
|
|
||||||
#ifndef USE_GDK_IMLIB
|
#ifndef USE_GDK_IMLIB
|
||||||
|
|
||||||
|
GdkBitmap *mask = NULL;
|
||||||
|
|
||||||
M_BMPDATA->m_pixmap =
|
M_BMPDATA->m_pixmap =
|
||||||
gdk_pixmap_create_from_xpm_d( (GdkWindow*) &gdk_root_parent, &mask, NULL, (gchar **) bits );
|
gdk_pixmap_create_from_xpm_d( (GdkWindow*) &gdk_root_parent, &mask, NULL, (gchar **) bits );
|
||||||
#else
|
|
||||||
M_BMPDATA->m_pixmap = NULL;
|
|
||||||
int res = gdk_imlib_data_to_pixmap( bits, &M_BMPDATA->m_pixmap, &mask );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (mask)
|
if (mask)
|
||||||
{
|
{
|
||||||
M_BMPDATA->m_mask = new wxMask();
|
M_BMPDATA->m_mask = new wxMask();
|
||||||
M_BMPDATA->m_mask->m_bitmap = mask;
|
M_BMPDATA->m_mask->m_bitmap = mask;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
M_BMPDATA->m_image = gdk_imlib_create_image_from_xpm_data( bits );
|
||||||
|
Render();
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
gdk_window_get_size( M_BMPDATA->m_pixmap, &(M_BMPDATA->m_width), &(M_BMPDATA->m_height) );
|
gdk_window_get_size( M_BMPDATA->m_pixmap, &(M_BMPDATA->m_width), &(M_BMPDATA->m_height) );
|
||||||
M_BMPDATA->m_bpp = 24; // ?
|
M_BMPDATA->m_bpp = 24; // ?
|
||||||
@@ -248,19 +256,57 @@ void wxBitmap::SetDepth( int depth )
|
|||||||
wxMask *wxBitmap::GetMask(void) const
|
wxMask *wxBitmap::GetMask(void) const
|
||||||
{
|
{
|
||||||
if (!Ok()) return NULL;
|
if (!Ok()) return NULL;
|
||||||
|
|
||||||
return M_BMPDATA->m_mask;
|
return M_BMPDATA->m_mask;
|
||||||
};
|
};
|
||||||
|
|
||||||
void wxBitmap::SetMask( wxMask *mask )
|
void wxBitmap::SetMask( wxMask *mask )
|
||||||
{
|
{
|
||||||
if (!Ok()) return;
|
if (!Ok()) return;
|
||||||
|
|
||||||
if (M_BMPDATA->m_mask) delete M_BMPDATA->m_mask;
|
if (M_BMPDATA->m_mask) delete M_BMPDATA->m_mask;
|
||||||
M_BMPDATA->m_mask = mask;
|
M_BMPDATA->m_mask = mask;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool wxBitmap::SaveFile( const wxString &WXUNUSED(name), int WXUNUSED(type),
|
void wxBitmap::Resize( int height, int width )
|
||||||
|
{
|
||||||
|
if (!Ok()) return;
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
#ifdef USE_GDK_IMLIB
|
||||||
|
|
||||||
|
if (M_BMPDATA->m_bitmap) return; // not supported for bitmaps
|
||||||
|
|
||||||
|
if (!M_BMPDATA->m_image) RecreateImage();
|
||||||
|
|
||||||
|
if (M_BMPDATA->m_pixmap) gdk_imlib_free_pixmap( M_BMPDATA->m_pixmap );
|
||||||
|
if (M_BMPDATA->m_mask) delete M_BMPDATA->m_mask;
|
||||||
|
|
||||||
|
GdkImlibImage* image = gdk_imlib_clone_scaled_image( M_BMPDATA->m_image, height, width );
|
||||||
|
gdk_imlib_destroy_image( M_BMPDATA->m_image );
|
||||||
|
M_BMPDATA->m_image = image;
|
||||||
|
M_BMPDATA->m_height = height;
|
||||||
|
M_BMPDATA->m_width = width;
|
||||||
|
|
||||||
|
Render();
|
||||||
|
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
bool wxBitmap::SaveFile( const wxString &name, int WXUNUSED(type),
|
||||||
wxPalette *WXUNUSED(palette) )
|
wxPalette *WXUNUSED(palette) )
|
||||||
{
|
{
|
||||||
|
#ifdef USE_GDK_IMLIB
|
||||||
|
|
||||||
|
if (!Ok()) return FALSE;
|
||||||
|
|
||||||
|
if (!M_BMPDATA->m_image) RecreateImage();
|
||||||
|
|
||||||
|
return gdk_imlib_save_image( M_BMPDATA->m_image, WXSTRINGCAST name, NULL );
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -270,23 +316,16 @@ bool wxBitmap::LoadFile( const wxString &name, int WXUNUSED(type) )
|
|||||||
|
|
||||||
UnRef();
|
UnRef();
|
||||||
m_refData = new wxBitmapRefData();
|
m_refData = new wxBitmapRefData();
|
||||||
M_BMPDATA->m_mask = NULL;
|
|
||||||
|
|
||||||
GdkBitmap *mask = NULL;
|
|
||||||
|
|
||||||
int res = gdk_imlib_load_file_to_pixmap( WXSTRINGCAST name, &M_BMPDATA->m_pixmap, &mask );
|
M_BMPDATA->m_image = gdk_imlib_load_image( WXSTRINGCAST name );
|
||||||
|
|
||||||
if (res != 1)
|
if (!M_BMPDATA->m_image)
|
||||||
{
|
{
|
||||||
UnRef();
|
UnRef();
|
||||||
return FALSE;
|
return FALSE;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mask)
|
Render();
|
||||||
{
|
|
||||||
M_BMPDATA->m_mask = new wxMask();
|
|
||||||
M_BMPDATA->m_mask->m_bitmap = mask;
|
|
||||||
}
|
|
||||||
|
|
||||||
gdk_window_get_size( M_BMPDATA->m_pixmap, &(M_BMPDATA->m_width), &(M_BMPDATA->m_height) );
|
gdk_window_get_size( M_BMPDATA->m_pixmap, &(M_BMPDATA->m_width), &(M_BMPDATA->m_height) );
|
||||||
M_BMPDATA->m_bpp = 24; // ?
|
M_BMPDATA->m_bpp = 24; // ?
|
||||||
@@ -312,6 +351,42 @@ GdkPixmap *wxBitmap::GetPixmap(void) const
|
|||||||
GdkBitmap *wxBitmap::GetBitmap(void) const
|
GdkBitmap *wxBitmap::GetBitmap(void) const
|
||||||
{
|
{
|
||||||
if (!Ok()) return NULL;
|
if (!Ok()) return NULL;
|
||||||
|
|
||||||
return M_BMPDATA->m_bitmap;
|
return M_BMPDATA->m_bitmap;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void wxBitmap::DestroyImage(void)
|
||||||
|
{
|
||||||
|
if (!Ok()) return;
|
||||||
|
|
||||||
|
if (M_BMPDATA->m_image)
|
||||||
|
{
|
||||||
|
gdk_imlib_destroy_image( M_BMPDATA->m_image );
|
||||||
|
M_BMPDATA->m_image = NULL;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
void wxBitmap::RecreateImage(void)
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
void wxBitmap::Render(void)
|
||||||
|
{
|
||||||
|
if (!Ok()) return;
|
||||||
|
|
||||||
|
#ifdef USE_GDK_IMLIB
|
||||||
|
|
||||||
|
gdk_imlib_render( M_BMPDATA->m_image, M_BMPDATA->m_image->rgb_width, M_BMPDATA->m_image->rgb_height );
|
||||||
|
|
||||||
|
M_BMPDATA->m_pixmap = gdk_imlib_move_image( M_BMPDATA->m_image );
|
||||||
|
GdkBitmap *mask = gdk_imlib_move_mask( M_BMPDATA->m_image );
|
||||||
|
if (mask)
|
||||||
|
{
|
||||||
|
M_BMPDATA->m_mask = new wxMask();
|
||||||
|
M_BMPDATA->m_mask->m_bitmap = mask;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -42,7 +42,7 @@ void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc,
|
|||||||
printf( ".\n" );
|
printf( ".\n" );
|
||||||
*/
|
*/
|
||||||
|
|
||||||
win->GtkOnSize( alloc->width, alloc->height );
|
win->GtkOnSize( alloc->x, alloc->y, alloc->width, alloc->height );
|
||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -194,8 +194,11 @@ void wxFrame::GetClientSize( int *width, int *height ) const
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
void wxFrame::GtkOnSize( int width, int height )
|
void wxFrame::GtkOnSize( int x, int y, int width, int height )
|
||||||
{
|
{
|
||||||
|
m_x = x;
|
||||||
|
m_y = y;
|
||||||
|
|
||||||
if ((m_height == height) && (m_width == width) &&
|
if ((m_height == height) && (m_width == width) &&
|
||||||
(m_sizeSet)) return;
|
(m_sizeSet)) return;
|
||||||
if (!m_mainWindow) return;
|
if (!m_mainWindow) return;
|
||||||
|
@@ -20,3 +20,8 @@
|
|||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxIcon,wxBitmap)
|
IMPLEMENT_DYNAMIC_CLASS(wxIcon,wxBitmap)
|
||||||
|
|
||||||
|
wxIcon::wxIcon( char **bits, int WXUNUSED(width), int WXUNUSED(height) ) :
|
||||||
|
wxBitmap( bits )
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
@@ -19,13 +19,40 @@
|
|||||||
#include "wx/intl.h"
|
#include "wx/intl.h"
|
||||||
#include "wx/log.h"
|
#include "wx/log.h"
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// wxNotebookPage
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class wxNotebookPage: public wxObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxNotebookPage()
|
||||||
|
{
|
||||||
|
m_id = -1;
|
||||||
|
m_text = "";
|
||||||
|
m_image = -1;
|
||||||
|
m_page = NULL;
|
||||||
|
m_client = NULL;
|
||||||
|
m_parent = NULL;
|
||||||
|
};
|
||||||
|
|
||||||
|
//private:
|
||||||
|
int m_id;
|
||||||
|
wxString m_text;
|
||||||
|
int m_image;
|
||||||
|
GtkNotebookPage *m_page;
|
||||||
|
GtkLabel *m_label;
|
||||||
|
wxWindow *m_client;
|
||||||
|
GtkNotebook *m_parent;
|
||||||
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// GTK callbacks
|
// GTK callbacks
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// page change callback
|
// page change callback
|
||||||
static void gtk_notebook_page_change_callback(GtkNotebook *widget,
|
static void gtk_notebook_page_change_callback(GtkNotebook *WXUNUSED(widget),
|
||||||
GtkNotebookPage *page,
|
GtkNotebookPage *WXUNUSED(page),
|
||||||
gint nPage,
|
gint nPage,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
@@ -42,29 +69,24 @@ static void gtk_notebook_page_change_callback(GtkNotebook *widget,
|
|||||||
notebook->ProcessEvent(event);
|
notebook->ProcessEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
static void gtk_notebook_client_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc,
|
||||||
// wxNotebookPage
|
wxNotebookPage *page )
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class wxNotebookPage: public wxObject
|
|
||||||
{
|
{
|
||||||
public:
|
if (!page->m_client->HasVMT()) return;
|
||||||
wxNotebookPage()
|
|
||||||
{
|
|
||||||
m_id = -1;
|
|
||||||
m_text = "";
|
|
||||||
m_image = -1;
|
|
||||||
m_page = NULL;
|
|
||||||
m_clientPanel = NULL;
|
|
||||||
};
|
|
||||||
|
|
||||||
//private:
|
/*
|
||||||
int m_id;
|
printf( "OnResize from " );
|
||||||
wxString m_text;
|
if (page->m_client->GetClassInfo() && page->m_client->GetClassInfo()->GetClassName())
|
||||||
int m_image;
|
printf( page->m_client->GetClassInfo()->GetClassName() );
|
||||||
GtkNotebookPage *m_page;
|
printf( ".\n" );
|
||||||
GtkLabel *m_label;
|
|
||||||
wxWindow *m_clientPanel;
|
printf( " New: X: %d Y: %d ", alloc->x, alloc->y );
|
||||||
|
printf( " W: %d H: %d ", alloc->width, alloc->height );
|
||||||
|
printf( " .\n" );
|
||||||
|
*/
|
||||||
|
|
||||||
|
page->m_client->SetSize( alloc->x, alloc->y+26,
|
||||||
|
alloc->width, alloc->height );
|
||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -195,7 +217,7 @@ wxNotebookPage* wxNotebook::GetNotebookPage(int page) const
|
|||||||
node = node->Next();
|
node = node->Next();
|
||||||
};
|
};
|
||||||
|
|
||||||
wxLogDebug("Notebook page %d not found!", page);
|
wxLogDebug( "Notebook page %d not found!", page );
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
};
|
};
|
||||||
@@ -305,7 +327,7 @@ bool wxNotebook::DeletePage( int page )
|
|||||||
|
|
||||||
wxASSERT( child );
|
wxASSERT( child );
|
||||||
|
|
||||||
delete nb_page->m_clientPanel;
|
delete nb_page->m_client;
|
||||||
|
|
||||||
// Amazingly, this is not necessary
|
// Amazingly, this is not necessary
|
||||||
// gtk_notebook_remove_page( GTK_NOTEBOOK(m_widget), page_num );
|
// gtk_notebook_remove_page( GTK_NOTEBOOK(m_widget), page_num );
|
||||||
@@ -328,7 +350,7 @@ bool wxNotebook::AddPage(wxWindow* win, const wxString& text,
|
|||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
page = (wxNotebookPage*)node->Data();
|
page = (wxNotebookPage*)node->Data();
|
||||||
if ( page->m_clientPanel == win )
|
if ( page->m_client == win )
|
||||||
break; // found
|
break; // found
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
};
|
};
|
||||||
@@ -356,29 +378,36 @@ wxWindow *wxNotebook::GetPage( int page ) const
|
|||||||
if (!nb_page)
|
if (!nb_page)
|
||||||
return NULL;
|
return NULL;
|
||||||
else
|
else
|
||||||
return nb_page->m_clientPanel;
|
return nb_page->m_client;
|
||||||
};
|
};
|
||||||
|
|
||||||
void wxNotebook::AddChild( wxWindow *win )
|
void wxNotebook::AddChild( wxWindow *win )
|
||||||
{
|
{
|
||||||
// @@@ normally done in wxWindow::AddChild but for some reason wxNotebook
|
// @@@ normally done in wxWindow::AddChild but for some reason wxNotebook
|
||||||
// case is special there (Robert?)
|
// case is special there (Robert?)
|
||||||
|
// Robert: Don't you think the code below looks different from the one
|
||||||
|
// in wxWindow::AddChild :-)
|
||||||
|
|
||||||
m_children.Append(win);
|
m_children.Append(win);
|
||||||
|
|
||||||
|
|
||||||
wxNotebookPage *page = new wxNotebookPage();
|
wxNotebookPage *page = new wxNotebookPage();
|
||||||
|
|
||||||
page->m_id = GetPageCount();
|
page->m_id = GetPageCount();
|
||||||
page->m_label = (GtkLabel *)gtk_label_new("no caption");
|
page->m_label = (GtkLabel *)gtk_label_new("Handle");
|
||||||
page->m_clientPanel = win;
|
page->m_client = win;
|
||||||
gtk_notebook_append_page(GTK_NOTEBOOK(m_widget), win->m_widget,
|
gtk_notebook_append_page( GTK_NOTEBOOK(m_widget), win->m_widget,
|
||||||
(GtkWidget *)page->m_label);
|
(GtkWidget *)page->m_label);
|
||||||
gtk_misc_set_alignment(GTK_MISC(page->m_label), 0.0, 0.5);
|
gtk_misc_set_alignment(GTK_MISC(page->m_label), 0.0, 0.5);
|
||||||
|
|
||||||
page->m_page = (GtkNotebookPage*)
|
page->m_page =
|
||||||
(
|
(GtkNotebookPage*) (g_list_last(GTK_NOTEBOOK(m_widget)->children)->data);
|
||||||
g_list_last(GTK_NOTEBOOK(m_widget)->children)->data
|
|
||||||
);
|
page->m_parent = GTK_NOTEBOOK(m_widget);
|
||||||
|
|
||||||
|
gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
|
||||||
|
GTK_SIGNAL_FUNC(gtk_notebook_client_size_callback), (gpointer)page );
|
||||||
|
|
||||||
if (!page->m_page)
|
if (!page->m_page)
|
||||||
{
|
{
|
||||||
wxLogFatalError( "Notebook page creation error" );
|
wxLogFatalError( "Notebook page creation error" );
|
||||||
@@ -388,22 +417,6 @@ void wxNotebook::AddChild( wxWindow *win )
|
|||||||
m_pages.Append( page );
|
m_pages.Append( page );
|
||||||
};
|
};
|
||||||
|
|
||||||
void wxNotebook::OnSize(wxSizeEvent& event)
|
|
||||||
{
|
|
||||||
// forward this event to all pages
|
|
||||||
wxNode *node = m_pages.First();
|
|
||||||
while (node)
|
|
||||||
{
|
|
||||||
wxNotebookPage *page = (wxNotebookPage*)node->Data();
|
|
||||||
// @@@@ This -50 is completely wrong - instead, we should substract
|
|
||||||
// the height of the tabs
|
|
||||||
page->m_clientPanel->SetSize(event.GetSize().GetX(),
|
|
||||||
event.GetSize().GetY() - 50);
|
|
||||||
|
|
||||||
node = node->Next();
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxNotebookEvent
|
// wxNotebookEvent
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@@ -74,6 +74,9 @@ class wxBitmapRefData: public wxObjectRefData
|
|||||||
int m_width;
|
int m_width;
|
||||||
int m_height;
|
int m_height;
|
||||||
int m_bpp;
|
int m_bpp;
|
||||||
|
#ifdef USE_GDK_IMLIB
|
||||||
|
GdkImlibImage *m_image;
|
||||||
|
#endif
|
||||||
wxPalette *m_palette;
|
wxPalette *m_palette;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -92,10 +95,11 @@ wxBitmapRefData::~wxBitmapRefData(void)
|
|||||||
{
|
{
|
||||||
#ifdef USE_GDK_IMLIB
|
#ifdef USE_GDK_IMLIB
|
||||||
if (m_pixmap) gdk_imlib_free_pixmap( m_pixmap );
|
if (m_pixmap) gdk_imlib_free_pixmap( m_pixmap );
|
||||||
|
if (m_image) gdk_imlib_destroy_image( m_image );
|
||||||
#else
|
#else
|
||||||
if (m_pixmap) gdk_pixmap_unref( m_pixmap );
|
if (m_pixmap) gdk_pixmap_unref( m_pixmap );
|
||||||
if (m_bitmap) gdk_bitmap_unref( m_bitmap );
|
|
||||||
#endif
|
#endif
|
||||||
|
if (m_bitmap) gdk_bitmap_unref( m_bitmap );
|
||||||
if (m_mask) delete m_mask;
|
if (m_mask) delete m_mask;
|
||||||
if (m_palette) delete m_palette;
|
if (m_palette) delete m_palette;
|
||||||
};
|
};
|
||||||
@@ -126,22 +130,26 @@ wxBitmap::wxBitmap( int width, int height, int depth )
|
|||||||
wxBitmap::wxBitmap( char **bits )
|
wxBitmap::wxBitmap( char **bits )
|
||||||
{
|
{
|
||||||
m_refData = new wxBitmapRefData();
|
m_refData = new wxBitmapRefData();
|
||||||
|
|
||||||
GdkBitmap *mask = NULL;
|
|
||||||
|
|
||||||
#ifndef USE_GDK_IMLIB
|
#ifndef USE_GDK_IMLIB
|
||||||
|
|
||||||
|
GdkBitmap *mask = NULL;
|
||||||
|
|
||||||
M_BMPDATA->m_pixmap =
|
M_BMPDATA->m_pixmap =
|
||||||
gdk_pixmap_create_from_xpm_d( (GdkWindow*) &gdk_root_parent, &mask, NULL, (gchar **) bits );
|
gdk_pixmap_create_from_xpm_d( (GdkWindow*) &gdk_root_parent, &mask, NULL, (gchar **) bits );
|
||||||
#else
|
|
||||||
M_BMPDATA->m_pixmap = NULL;
|
|
||||||
int res = gdk_imlib_data_to_pixmap( bits, &M_BMPDATA->m_pixmap, &mask );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (mask)
|
if (mask)
|
||||||
{
|
{
|
||||||
M_BMPDATA->m_mask = new wxMask();
|
M_BMPDATA->m_mask = new wxMask();
|
||||||
M_BMPDATA->m_mask->m_bitmap = mask;
|
M_BMPDATA->m_mask->m_bitmap = mask;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
M_BMPDATA->m_image = gdk_imlib_create_image_from_xpm_data( bits );
|
||||||
|
Render();
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
gdk_window_get_size( M_BMPDATA->m_pixmap, &(M_BMPDATA->m_width), &(M_BMPDATA->m_height) );
|
gdk_window_get_size( M_BMPDATA->m_pixmap, &(M_BMPDATA->m_width), &(M_BMPDATA->m_height) );
|
||||||
M_BMPDATA->m_bpp = 24; // ?
|
M_BMPDATA->m_bpp = 24; // ?
|
||||||
@@ -248,19 +256,57 @@ void wxBitmap::SetDepth( int depth )
|
|||||||
wxMask *wxBitmap::GetMask(void) const
|
wxMask *wxBitmap::GetMask(void) const
|
||||||
{
|
{
|
||||||
if (!Ok()) return NULL;
|
if (!Ok()) return NULL;
|
||||||
|
|
||||||
return M_BMPDATA->m_mask;
|
return M_BMPDATA->m_mask;
|
||||||
};
|
};
|
||||||
|
|
||||||
void wxBitmap::SetMask( wxMask *mask )
|
void wxBitmap::SetMask( wxMask *mask )
|
||||||
{
|
{
|
||||||
if (!Ok()) return;
|
if (!Ok()) return;
|
||||||
|
|
||||||
if (M_BMPDATA->m_mask) delete M_BMPDATA->m_mask;
|
if (M_BMPDATA->m_mask) delete M_BMPDATA->m_mask;
|
||||||
M_BMPDATA->m_mask = mask;
|
M_BMPDATA->m_mask = mask;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool wxBitmap::SaveFile( const wxString &WXUNUSED(name), int WXUNUSED(type),
|
void wxBitmap::Resize( int height, int width )
|
||||||
|
{
|
||||||
|
if (!Ok()) return;
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
#ifdef USE_GDK_IMLIB
|
||||||
|
|
||||||
|
if (M_BMPDATA->m_bitmap) return; // not supported for bitmaps
|
||||||
|
|
||||||
|
if (!M_BMPDATA->m_image) RecreateImage();
|
||||||
|
|
||||||
|
if (M_BMPDATA->m_pixmap) gdk_imlib_free_pixmap( M_BMPDATA->m_pixmap );
|
||||||
|
if (M_BMPDATA->m_mask) delete M_BMPDATA->m_mask;
|
||||||
|
|
||||||
|
GdkImlibImage* image = gdk_imlib_clone_scaled_image( M_BMPDATA->m_image, height, width );
|
||||||
|
gdk_imlib_destroy_image( M_BMPDATA->m_image );
|
||||||
|
M_BMPDATA->m_image = image;
|
||||||
|
M_BMPDATA->m_height = height;
|
||||||
|
M_BMPDATA->m_width = width;
|
||||||
|
|
||||||
|
Render();
|
||||||
|
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
bool wxBitmap::SaveFile( const wxString &name, int WXUNUSED(type),
|
||||||
wxPalette *WXUNUSED(palette) )
|
wxPalette *WXUNUSED(palette) )
|
||||||
{
|
{
|
||||||
|
#ifdef USE_GDK_IMLIB
|
||||||
|
|
||||||
|
if (!Ok()) return FALSE;
|
||||||
|
|
||||||
|
if (!M_BMPDATA->m_image) RecreateImage();
|
||||||
|
|
||||||
|
return gdk_imlib_save_image( M_BMPDATA->m_image, WXSTRINGCAST name, NULL );
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -270,23 +316,16 @@ bool wxBitmap::LoadFile( const wxString &name, int WXUNUSED(type) )
|
|||||||
|
|
||||||
UnRef();
|
UnRef();
|
||||||
m_refData = new wxBitmapRefData();
|
m_refData = new wxBitmapRefData();
|
||||||
M_BMPDATA->m_mask = NULL;
|
|
||||||
|
|
||||||
GdkBitmap *mask = NULL;
|
|
||||||
|
|
||||||
int res = gdk_imlib_load_file_to_pixmap( WXSTRINGCAST name, &M_BMPDATA->m_pixmap, &mask );
|
M_BMPDATA->m_image = gdk_imlib_load_image( WXSTRINGCAST name );
|
||||||
|
|
||||||
if (res != 1)
|
if (!M_BMPDATA->m_image)
|
||||||
{
|
{
|
||||||
UnRef();
|
UnRef();
|
||||||
return FALSE;
|
return FALSE;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mask)
|
Render();
|
||||||
{
|
|
||||||
M_BMPDATA->m_mask = new wxMask();
|
|
||||||
M_BMPDATA->m_mask->m_bitmap = mask;
|
|
||||||
}
|
|
||||||
|
|
||||||
gdk_window_get_size( M_BMPDATA->m_pixmap, &(M_BMPDATA->m_width), &(M_BMPDATA->m_height) );
|
gdk_window_get_size( M_BMPDATA->m_pixmap, &(M_BMPDATA->m_width), &(M_BMPDATA->m_height) );
|
||||||
M_BMPDATA->m_bpp = 24; // ?
|
M_BMPDATA->m_bpp = 24; // ?
|
||||||
@@ -312,6 +351,42 @@ GdkPixmap *wxBitmap::GetPixmap(void) const
|
|||||||
GdkBitmap *wxBitmap::GetBitmap(void) const
|
GdkBitmap *wxBitmap::GetBitmap(void) const
|
||||||
{
|
{
|
||||||
if (!Ok()) return NULL;
|
if (!Ok()) return NULL;
|
||||||
|
|
||||||
return M_BMPDATA->m_bitmap;
|
return M_BMPDATA->m_bitmap;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void wxBitmap::DestroyImage(void)
|
||||||
|
{
|
||||||
|
if (!Ok()) return;
|
||||||
|
|
||||||
|
if (M_BMPDATA->m_image)
|
||||||
|
{
|
||||||
|
gdk_imlib_destroy_image( M_BMPDATA->m_image );
|
||||||
|
M_BMPDATA->m_image = NULL;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
void wxBitmap::RecreateImage(void)
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
void wxBitmap::Render(void)
|
||||||
|
{
|
||||||
|
if (!Ok()) return;
|
||||||
|
|
||||||
|
#ifdef USE_GDK_IMLIB
|
||||||
|
|
||||||
|
gdk_imlib_render( M_BMPDATA->m_image, M_BMPDATA->m_image->rgb_width, M_BMPDATA->m_image->rgb_height );
|
||||||
|
|
||||||
|
M_BMPDATA->m_pixmap = gdk_imlib_move_image( M_BMPDATA->m_image );
|
||||||
|
GdkBitmap *mask = gdk_imlib_move_mask( M_BMPDATA->m_image );
|
||||||
|
if (mask)
|
||||||
|
{
|
||||||
|
M_BMPDATA->m_mask = new wxMask();
|
||||||
|
M_BMPDATA->m_mask->m_bitmap = mask;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -42,7 +42,7 @@ void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc,
|
|||||||
printf( ".\n" );
|
printf( ".\n" );
|
||||||
*/
|
*/
|
||||||
|
|
||||||
win->GtkOnSize( alloc->width, alloc->height );
|
win->GtkOnSize( alloc->x, alloc->y, alloc->width, alloc->height );
|
||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -194,8 +194,11 @@ void wxFrame::GetClientSize( int *width, int *height ) const
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
void wxFrame::GtkOnSize( int width, int height )
|
void wxFrame::GtkOnSize( int x, int y, int width, int height )
|
||||||
{
|
{
|
||||||
|
m_x = x;
|
||||||
|
m_y = y;
|
||||||
|
|
||||||
if ((m_height == height) && (m_width == width) &&
|
if ((m_height == height) && (m_width == width) &&
|
||||||
(m_sizeSet)) return;
|
(m_sizeSet)) return;
|
||||||
if (!m_mainWindow) return;
|
if (!m_mainWindow) return;
|
||||||
|
@@ -20,3 +20,8 @@
|
|||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxIcon,wxBitmap)
|
IMPLEMENT_DYNAMIC_CLASS(wxIcon,wxBitmap)
|
||||||
|
|
||||||
|
wxIcon::wxIcon( char **bits, int WXUNUSED(width), int WXUNUSED(height) ) :
|
||||||
|
wxBitmap( bits )
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
@@ -19,13 +19,40 @@
|
|||||||
#include "wx/intl.h"
|
#include "wx/intl.h"
|
||||||
#include "wx/log.h"
|
#include "wx/log.h"
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// wxNotebookPage
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class wxNotebookPage: public wxObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxNotebookPage()
|
||||||
|
{
|
||||||
|
m_id = -1;
|
||||||
|
m_text = "";
|
||||||
|
m_image = -1;
|
||||||
|
m_page = NULL;
|
||||||
|
m_client = NULL;
|
||||||
|
m_parent = NULL;
|
||||||
|
};
|
||||||
|
|
||||||
|
//private:
|
||||||
|
int m_id;
|
||||||
|
wxString m_text;
|
||||||
|
int m_image;
|
||||||
|
GtkNotebookPage *m_page;
|
||||||
|
GtkLabel *m_label;
|
||||||
|
wxWindow *m_client;
|
||||||
|
GtkNotebook *m_parent;
|
||||||
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// GTK callbacks
|
// GTK callbacks
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// page change callback
|
// page change callback
|
||||||
static void gtk_notebook_page_change_callback(GtkNotebook *widget,
|
static void gtk_notebook_page_change_callback(GtkNotebook *WXUNUSED(widget),
|
||||||
GtkNotebookPage *page,
|
GtkNotebookPage *WXUNUSED(page),
|
||||||
gint nPage,
|
gint nPage,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
@@ -42,29 +69,24 @@ static void gtk_notebook_page_change_callback(GtkNotebook *widget,
|
|||||||
notebook->ProcessEvent(event);
|
notebook->ProcessEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
static void gtk_notebook_client_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc,
|
||||||
// wxNotebookPage
|
wxNotebookPage *page )
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class wxNotebookPage: public wxObject
|
|
||||||
{
|
{
|
||||||
public:
|
if (!page->m_client->HasVMT()) return;
|
||||||
wxNotebookPage()
|
|
||||||
{
|
|
||||||
m_id = -1;
|
|
||||||
m_text = "";
|
|
||||||
m_image = -1;
|
|
||||||
m_page = NULL;
|
|
||||||
m_clientPanel = NULL;
|
|
||||||
};
|
|
||||||
|
|
||||||
//private:
|
/*
|
||||||
int m_id;
|
printf( "OnResize from " );
|
||||||
wxString m_text;
|
if (page->m_client->GetClassInfo() && page->m_client->GetClassInfo()->GetClassName())
|
||||||
int m_image;
|
printf( page->m_client->GetClassInfo()->GetClassName() );
|
||||||
GtkNotebookPage *m_page;
|
printf( ".\n" );
|
||||||
GtkLabel *m_label;
|
|
||||||
wxWindow *m_clientPanel;
|
printf( " New: X: %d Y: %d ", alloc->x, alloc->y );
|
||||||
|
printf( " W: %d H: %d ", alloc->width, alloc->height );
|
||||||
|
printf( " .\n" );
|
||||||
|
*/
|
||||||
|
|
||||||
|
page->m_client->SetSize( alloc->x, alloc->y+26,
|
||||||
|
alloc->width, alloc->height );
|
||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -195,7 +217,7 @@ wxNotebookPage* wxNotebook::GetNotebookPage(int page) const
|
|||||||
node = node->Next();
|
node = node->Next();
|
||||||
};
|
};
|
||||||
|
|
||||||
wxLogDebug("Notebook page %d not found!", page);
|
wxLogDebug( "Notebook page %d not found!", page );
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
};
|
};
|
||||||
@@ -305,7 +327,7 @@ bool wxNotebook::DeletePage( int page )
|
|||||||
|
|
||||||
wxASSERT( child );
|
wxASSERT( child );
|
||||||
|
|
||||||
delete nb_page->m_clientPanel;
|
delete nb_page->m_client;
|
||||||
|
|
||||||
// Amazingly, this is not necessary
|
// Amazingly, this is not necessary
|
||||||
// gtk_notebook_remove_page( GTK_NOTEBOOK(m_widget), page_num );
|
// gtk_notebook_remove_page( GTK_NOTEBOOK(m_widget), page_num );
|
||||||
@@ -328,7 +350,7 @@ bool wxNotebook::AddPage(wxWindow* win, const wxString& text,
|
|||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
page = (wxNotebookPage*)node->Data();
|
page = (wxNotebookPage*)node->Data();
|
||||||
if ( page->m_clientPanel == win )
|
if ( page->m_client == win )
|
||||||
break; // found
|
break; // found
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
};
|
};
|
||||||
@@ -356,29 +378,36 @@ wxWindow *wxNotebook::GetPage( int page ) const
|
|||||||
if (!nb_page)
|
if (!nb_page)
|
||||||
return NULL;
|
return NULL;
|
||||||
else
|
else
|
||||||
return nb_page->m_clientPanel;
|
return nb_page->m_client;
|
||||||
};
|
};
|
||||||
|
|
||||||
void wxNotebook::AddChild( wxWindow *win )
|
void wxNotebook::AddChild( wxWindow *win )
|
||||||
{
|
{
|
||||||
// @@@ normally done in wxWindow::AddChild but for some reason wxNotebook
|
// @@@ normally done in wxWindow::AddChild but for some reason wxNotebook
|
||||||
// case is special there (Robert?)
|
// case is special there (Robert?)
|
||||||
|
// Robert: Don't you think the code below looks different from the one
|
||||||
|
// in wxWindow::AddChild :-)
|
||||||
|
|
||||||
m_children.Append(win);
|
m_children.Append(win);
|
||||||
|
|
||||||
|
|
||||||
wxNotebookPage *page = new wxNotebookPage();
|
wxNotebookPage *page = new wxNotebookPage();
|
||||||
|
|
||||||
page->m_id = GetPageCount();
|
page->m_id = GetPageCount();
|
||||||
page->m_label = (GtkLabel *)gtk_label_new("no caption");
|
page->m_label = (GtkLabel *)gtk_label_new("Handle");
|
||||||
page->m_clientPanel = win;
|
page->m_client = win;
|
||||||
gtk_notebook_append_page(GTK_NOTEBOOK(m_widget), win->m_widget,
|
gtk_notebook_append_page( GTK_NOTEBOOK(m_widget), win->m_widget,
|
||||||
(GtkWidget *)page->m_label);
|
(GtkWidget *)page->m_label);
|
||||||
gtk_misc_set_alignment(GTK_MISC(page->m_label), 0.0, 0.5);
|
gtk_misc_set_alignment(GTK_MISC(page->m_label), 0.0, 0.5);
|
||||||
|
|
||||||
page->m_page = (GtkNotebookPage*)
|
page->m_page =
|
||||||
(
|
(GtkNotebookPage*) (g_list_last(GTK_NOTEBOOK(m_widget)->children)->data);
|
||||||
g_list_last(GTK_NOTEBOOK(m_widget)->children)->data
|
|
||||||
);
|
page->m_parent = GTK_NOTEBOOK(m_widget);
|
||||||
|
|
||||||
|
gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
|
||||||
|
GTK_SIGNAL_FUNC(gtk_notebook_client_size_callback), (gpointer)page );
|
||||||
|
|
||||||
if (!page->m_page)
|
if (!page->m_page)
|
||||||
{
|
{
|
||||||
wxLogFatalError( "Notebook page creation error" );
|
wxLogFatalError( "Notebook page creation error" );
|
||||||
@@ -388,22 +417,6 @@ void wxNotebook::AddChild( wxWindow *win )
|
|||||||
m_pages.Append( page );
|
m_pages.Append( page );
|
||||||
};
|
};
|
||||||
|
|
||||||
void wxNotebook::OnSize(wxSizeEvent& event)
|
|
||||||
{
|
|
||||||
// forward this event to all pages
|
|
||||||
wxNode *node = m_pages.First();
|
|
||||||
while (node)
|
|
||||||
{
|
|
||||||
wxNotebookPage *page = (wxNotebookPage*)node->Data();
|
|
||||||
// @@@@ This -50 is completely wrong - instead, we should substract
|
|
||||||
// the height of the tabs
|
|
||||||
page->m_clientPanel->SetSize(event.GetSize().GetX(),
|
|
||||||
event.GetSize().GetY() - 50);
|
|
||||||
|
|
||||||
node = node->Next();
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxNotebookEvent
|
// wxNotebookEvent
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@@ -20,7 +20,7 @@
|
|||||||
#ifndef MCONFIG_H
|
#ifndef MCONFIG_H
|
||||||
// for testing only:
|
// for testing only:
|
||||||
# define WXLAYOUT_DEBUG
|
# define WXLAYOUT_DEBUG
|
||||||
# cdefine USE_STD_STRING
|
# define USE_STD_STRING
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_STD_STRING
|
#ifdef USE_STD_STRING
|
||||||
|
Reference in New Issue
Block a user