Added serial code for wxList and wxHashTable to source tree

Added a few accessors to wxList (for above)
  Fixed bug with GetClientSize() and sunken frames without
  scrollbars
  Made pixel corrections to wxListCtrl and wxFrame
  Added a few pixels before first tool in toolbar
  Added a few wxCHECKs here and there


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1121 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
1998-12-07 08:27:06 +00:00
parent ef5390661e
commit 907789a0f7
18 changed files with 801 additions and 752 deletions

View File

@@ -195,11 +195,25 @@ public:
size_t GetCount() const { return m_count; }
// operations
// delete all nodes
void Clear();
// instruct it to destroy user data when deleting nodes
void DeleteContents(bool destroy) { m_destroy = destroy; }
// query if to delete
bool GetDeleteContents() const
{ return m_destroy; }
// get the keytype
wxKeyType GetKeyType() const
{ return m_keyType; }
// set the keytype (required by the serial code)
void SetKeyType(wxKeyType keyType)
{ wxASSERT( m_count==0 ); m_keyType = keyType; }
protected:
// all methods here are "overloaded" in derived classes to provide compile
// time type checking

View File

@@ -54,4 +54,7 @@ IMPLEMENT_DYNAMIC_CLASS(classname##_Serialize, parent##_Serialize)
#define IMPLEMENT_ALIAS_SERIAL_CLASS(classname, parent) \
IMPLEMENT_DYNAMIC_CLASS(classname##_Serialize, parent##_Serialize)
DECLARE_SERIAL_CLASS(wxList, wxObject)
DECLARE_SERIAL_CLASS(wxHashTable, wxObject)
#endif

View File

@@ -25,6 +25,10 @@
#include "wx/wx.h"
#endif
#ifndef __WXMSW__
#include "mondrian.xpm"
#endif
#include "wx/listctrl.h"
#include "listtest.h"
@@ -65,15 +69,10 @@ bool MyApp::OnInit(void)
// This reduces flicker effects - even better would be to define OnEraseBackground
// to do nothing. When the list control's scrollbars are show or hidden, the
// frame is sent a background erase event.
frame->SetBackgroundColour(wxColour(255, 255, 255));
frame->SetBackgroundColour( *wxWHITE );
// Give it an icon
#ifdef __WXMSW__
frame->SetIcon(wxIcon("mondrian"));
#else
#include "mondrian.xpm"
frame->SetIcon(wxIcon(mondrian_xpm));
#endif
frame->SetIcon( wxICON(mondrian) );
// Make an image list containing large icons
m_imageListNormal = new wxImageList(32, 32, TRUE);

View File

@@ -45,7 +45,7 @@ bool MyApp::OnInit(void)
{
// Create the main frame window
MyFrame* frame = new MyFrame((wxFrame *) NULL, -1, (const wxString) "wxMiniFrame sample",
wxPoint(100, 100), wxSize(200, 42));
wxPoint(100, 100), wxSize(205, 45));
#ifdef __WXMSW__
frame->SetIcon(wxIcon("mondrian"));

View File

@@ -10,13 +10,15 @@
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "stream.h"
#pragma implementation "serbase.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#include <wx/serbase.h>
#include "wx/serbase.h"
#include "wx/datstrm.h"
#include "wx/objstrm.h"
#ifdef __BORLANDC__
#pragma hdrstop
@@ -28,4 +30,91 @@
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxObject_Serialize,wxObject)
IMPLEMENT_SERIAL_CLASS(wxList, wxObject)
IMPLEMENT_SERIAL_CLASS(wxHashTable, wxObject)
#endif
void WXSERIAL(wxList)::StoreObject(wxObjectOutputStream& s)
{
wxList *lst_object = (wxList *)Object();
wxNode *node = lst_object->First();
if (s.FirstStage()) {
while (node) {
s.AddChild(node->Data());
node = node->Next();
}
return;
}
wxDataOutputStream data_s(s);
data_s.Write8(lst_object->GetDeleteContents());
data_s.Write8(lst_object->GetKeyType());
data_s.Write32( lst_object->Number() );
if (lst_object->GetKeyType() == wxKEY_INTEGER) {
while (node) {
data_s.Write32(node->GetKeyInteger());
node = node->Next();
}
} else {
while (node) {
data_s.WriteString(node->GetKeyString());
node = node->Next();
}
}
}
void WXSERIAL(wxList)::LoadObject(wxObjectInputStream& s)
{
wxDataInputStream data_s(s);
wxList *list = (wxList *)Object();
int number, i;
list->DeleteContents( data_s.Read8() );
list->SetKeyType( (wxKeyType) data_s.Read8() );
number = data_s.Read32();
if (list->GetKeyType() == wxKEY_INTEGER) {
for (i=0;i<number;i++)
list->Append( data_s.Read32(), s.GetChild() );
} else {
for (i=0;i<number;i++)
list->Append( data_s.ReadString(), s.GetChild() );
}
}
// ----------------------------------------------------------------------------
void WXSERIAL(wxHashTable)::StoreObject(wxObjectOutputStream& s)
{
wxHashTable *table = (wxHashTable *)Object();
int i;
if (s.FirstStage()) {
for (i=0;i<table->n;i++)
s.AddChild(table->hash_table[i]);
return;
}
wxDataOutputStream data_s(s);
data_s.Write8(table->key_type);
data_s.Write32(table->n);
}
void WXSERIAL(wxHashTable)::LoadObject(wxObjectInputStream& s)
{
wxHashTable *table = (wxHashTable *)Object();
wxDataInputStream data_s(s);
int i, key, n;
key = data_s.Read8();
n = data_s.Read32();
table->Create(key, n);
for (i=0;i<n;i++)
table->hash_table[i] = (wxList *)s.GetChild();
}

View File

@@ -700,15 +700,17 @@ void wxListHeaderWindow::DoDrawRect( wxPaintDC *dc, int x, int y, int w, int h )
dc->DrawLine( x+w-m_corner+1, y, x+w, y+h ); // right (outer)
dc->DrawRectangle( x, y+h, w, 1 ); // bottom (outer)
dc->SetPen( *wxMEDIUM_GREY_PEN );
wxPen pen( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNSHADOW ), 1, wxSOLID );
dc->SetPen( pen );
dc->DrawLine( x+w-m_corner, y, x+w-1, y+h ); // right (inner)
dc->DrawRectangle( x+1, y+h-1, w-2, 1 ); // bottom (inner)
dc->SetPen( *wxWHITE_PEN );
dc->DrawRectangle( x, y, w-m_corner+1, 1 ); // top (outer)
// dc->DrawRectangle( x, y+1, w-m_corner, 1 ); // top (inner)
dc->DrawRectangle( x, y, 1, h ); // left (outer)
// dc->DrawRectangle( x+1, y, 1, h-1 ); // left (inner)
dc->DrawLine( x, y+h-1, x+1, y+h-1 );
dc->DrawLine( x+w-1, y, x+w-1, y+1 );
}
void wxListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
@@ -2264,6 +2266,8 @@ bool wxListCtrl::Create( wxWindow *parent, wxWindowID id,
SetValidator( validator );
if (s & wxSUNKEN_BORDER) s -= wxSUNKEN_BORDER;
m_mainWin = new wxListMainWindow( this, -1, wxPoint(0,0), size, s );
if (GetWindowStyleFlag() & wxLC_REPORT)

View File

@@ -25,7 +25,7 @@
// constants
//-----------------------------------------------------------------------------
const int wxMENU_HEIGHT = 30;
const int wxMENU_HEIGHT = 27;
const int wxSTATUS_HEIGHT = 25;
//-----------------------------------------------------------------------------
@@ -222,7 +222,7 @@ wxPoint wxFrame::GetClientAreaOrigin() const
{
int h = 0;
m_frameMenuBar->GetSize( (int*)NULL, &h );
pt.y += h + 2;
pt.y += h;
}
if (m_frameToolBar)
{
@@ -381,10 +381,10 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
if (m_frameMenuBar)
{
int xx = 1 + m_miniEdge;
int yy = 1 + m_miniEdge + m_miniTitle;
int ww = m_width - 2 - 2*m_miniEdge;
int hh = wxMENU_HEIGHT-2;
int xx = m_miniEdge;
int yy = m_miniEdge + m_miniTitle;
int ww = m_width - 2*m_miniEdge;
int hh = wxMENU_HEIGHT;
m_frameMenuBar->m_x = xx;
m_frameMenuBar->m_y = yy;
m_frameMenuBar->m_width = ww;
@@ -396,10 +396,10 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
if (m_frameToolBar)
{
int xx = 1 + m_miniEdge;
int xx = m_miniEdge;
int yy = m_miniEdge + m_miniTitle;
if (m_frameMenuBar) yy += wxMENU_HEIGHT;
int ww = m_width -2 - 2*m_miniEdge;
int ww = m_width - 2*m_miniEdge;
int hh = m_frameToolBar->m_height;
m_frameToolBar->m_x = xx;

View File

@@ -21,7 +21,7 @@
// constants
//-----------------------------------------------------------------------------
const int wxMENU_HEIGHT = 30;
const int wxMENU_HEIGHT = 27;
//-----------------------------------------------------------------------------
// globals
@@ -120,12 +120,12 @@ void wxMDIParentFrame::GtkOnSize( int x, int y, int width, int height )
if (m_mdiMenuBar)
{
m_mdiMenuBar->m_x = 1;
m_mdiMenuBar->m_y = 1;
m_mdiMenuBar->m_width = m_width-2;
m_mdiMenuBar->m_height = wxMENU_HEIGHT-2;
gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_mdiMenuBar->m_widget, 1, 1 );
gtk_widget_set_usize( m_mdiMenuBar->m_widget, m_width-2, wxMENU_HEIGHT-2 );
m_mdiMenuBar->m_x = 0;
m_mdiMenuBar->m_y = 0;
m_mdiMenuBar->m_width = m_width;
m_mdiMenuBar->m_height = wxMENU_HEIGHT;
gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_mdiMenuBar->m_widget, 0, 0 );
gtk_widget_set_usize( m_mdiMenuBar->m_widget, m_width, wxMENU_HEIGHT );
}
}
@@ -135,12 +135,12 @@ void wxMDIParentFrame::SetMDIMenuBar( wxMenuBar *menu_bar )
m_mdiMenuBar = menu_bar;
if (m_mdiMenuBar)
{
m_mdiMenuBar->m_x = 1;
m_mdiMenuBar->m_y = 1;
m_mdiMenuBar->m_width = m_width-2;
m_mdiMenuBar->m_height = wxMENU_HEIGHT-2;
gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_mdiMenuBar->m_widget, 1, 1 );
gtk_widget_set_usize( m_mdiMenuBar->m_widget, m_width-2, wxMENU_HEIGHT-2 );
m_mdiMenuBar->m_x = 0;
m_mdiMenuBar->m_y = 0;
m_mdiMenuBar->m_width = m_width;
m_mdiMenuBar->m_height = wxMENU_HEIGHT;
gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_mdiMenuBar->m_widget, 0, 0 );
gtk_widget_set_usize( m_mdiMenuBar->m_widget, m_width, wxMENU_HEIGHT );
m_mdiMenuBar->Show( TRUE );
}
}

View File

@@ -32,7 +32,7 @@ class wxPenRefData: public wxObjectRefData
wxColour m_colour;
};
wxPenRefData::wxPenRefData(void)
wxPenRefData::wxPenRefData()
{
m_width = 1;
m_style = wxSOLID;
@@ -84,7 +84,7 @@ wxPen::wxPen( const wxPen* pen )
if (wxThePenList) wxThePenList->AddPen( this );
}
wxPen::~wxPen(void)
wxPen::~wxPen()
{
if (wxThePenList) wxThePenList->RemovePen( this );
}
@@ -142,67 +142,47 @@ void wxPen::SetWidth( int width )
M_PENDATA->m_width = width;
}
int wxPen::GetCap(void) const
int wxPen::GetCap() const
{
if (!m_refData)
{
wxFAIL_MSG( "invalid pen" );
return -1;
}
wxCHECK_MSG( Ok(), -1, "invalid pen" );
return M_PENDATA->m_capStyle;
}
int wxPen::GetJoin(void) const
int wxPen::GetJoin() const
{
if (!m_refData)
{
wxFAIL_MSG( "invalid pen" );
return -1;
}
wxCHECK_MSG( Ok(), -1, "invalid pen" );
return M_PENDATA->m_joinStyle;
}
int wxPen::GetStyle(void) const
int wxPen::GetStyle() const
{
if (!m_refData)
{
wxFAIL_MSG( "invalid pen" );
return -1;
}
wxCHECK_MSG( Ok(), -1, "invalid pen" );
return M_PENDATA->m_style;
}
int wxPen::GetWidth(void) const
int wxPen::GetWidth() const
{
if (!m_refData)
{
wxFAIL_MSG( "invalid pen" );
return -1;
}
wxCHECK_MSG( Ok(), -1, "invalid pen" );
return M_PENDATA->m_width;
}
wxColour &wxPen::GetColour(void) const
wxColour &wxPen::GetColour() const
{
if (!m_refData)
{
wxFAIL_MSG( "invalid pen" );
return wxNullColour;
}
wxCHECK_MSG( Ok(), wxNullColour, "invalid pen" );
return M_PENDATA->m_colour;
}
bool wxPen::Ok(void) const
bool wxPen::Ok() const
{
return (m_refData != NULL);
}
void wxPen::Unshare(void)
void wxPen::Unshare()
{
if (!m_refData)
{

View File

@@ -64,8 +64,10 @@ wxRadioBox::wxRadioBox(void)
bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
const wxPoint &pos, const wxSize &size,
int n, const wxString choices[], int WXUNUSED(majorDim),
long style, const wxValidator& validator, const wxString &name )
int n, const wxString choices[],
int WXUNUSED(majorDim),
long style, const wxValidator& validator,
const wxString &name )
{
m_alreadySent = FALSE;
m_needParent = TRUE;
@@ -113,7 +115,6 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
y += 20;
height += 20;
}
width = maxLen + 10;
}
@@ -287,11 +288,7 @@ void wxRadioBox::SetSelection( int n )
wxNode *node = m_boxes.Nth( n );
if (!node)
{
wxFAIL_MSG( "wxRadioBox wrong index" );
return;
}
wxCHECK_RET( node, "radiobox wrong index" );
GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->Data() );
@@ -324,11 +321,7 @@ wxString wxRadioBox::GetString( int n ) const
wxNode *node = m_boxes.Nth( n );
if (!node)
{
wxFAIL_MSG( "wxRadioBox wrong index" );
return "";
}
wxCHECK_MSG( node, "", "radiobox wrong index" );
GtkButton *button = GTK_BUTTON( node->Data() );
GtkLabel *label = GTK_LABEL( button->child );
@@ -358,11 +351,7 @@ void wxRadioBox::SetLabel( int item, const wxString& label )
wxNode *node = m_boxes.Nth( item );
if (!node)
{
wxFAIL_MSG( "wxRadioBox wrong index" );
return;
}
wxCHECK_RET( node, "radiobox wrong index" );
GtkButton *button = GTK_BUTTON( node->Data() );
GtkLabel *g_label = GTK_LABEL( button->child );
@@ -392,13 +381,11 @@ void wxRadioBox::Enable( bool enable )
void wxRadioBox::Enable( int item, bool enable )
{
wxCHECK_RET( m_widget != NULL, "invalid radiobox" );
wxNode *node = m_boxes.Nth( item );
if (!node)
{
wxFAIL_MSG( "wxRadioBox wrong index" );
return;
}
wxCHECK_RET( node, "radiobox wrong index" );
GtkButton *button = GTK_BUTTON( node->Data() );
GtkWidget *label = button->child;
@@ -408,13 +395,11 @@ void wxRadioBox::Enable( int item, bool enable )
void wxRadioBox::Show( int item, bool show )
{
wxCHECK_RET( m_widget != NULL, "invalid radiobox" );
wxNode *node = m_boxes.Nth( item );
if (!node)
{
wxFAIL_MSG( "wxRadioBox wrong index" );
return;
}
wxCHECK_RET( node, "radiobox wrong index" );
GtkWidget *button = GTK_WIDGET( node->Data() );
@@ -426,6 +411,8 @@ void wxRadioBox::Show( int item, bool show )
wxString wxRadioBox::GetStringSelection(void) const
{
wxCHECK_MSG( m_widget != NULL, "", "invalid radiobox" );
wxNode *node = m_boxes.First();
while (node)
{
@@ -444,9 +431,12 @@ wxString wxRadioBox::GetStringSelection(void) const
bool wxRadioBox::SetStringSelection( const wxString &s )
{
wxCHECK_MSG( m_widget != NULL, FALSE, "invalid radiobox" );
int res = FindString( s );
if (res == -1) return FALSE;
SetSelection( res );
return TRUE;
}

View File

@@ -118,6 +118,8 @@ bool wxToolBar::Create( wxWindow *parent, wxWindowID id,
gtk_toolbar_set_tooltips( GTK_TOOLBAR(m_toolbar), TRUE );
gtk_toolbar_append_space( m_toolbar );
m_parent->AddChild( this );
(m_parent->m_insertCallback)( m_parent, this );
@@ -250,7 +252,7 @@ void wxToolBar::Realize()
node = node->Next();
}
m_height += 10;
m_height += 12;
}
void wxToolBar::EnableTool(int toolIndex, bool enable)
@@ -336,7 +338,7 @@ bool wxToolBar::GetToolEnabled(int toolIndex) const
void wxToolBar::SetMargins( int WXUNUSED(x), int WXUNUSED(y) )
{
wxFAIL_MSG( "wxToolBar::SetMargins not implemented" );
// wxFAIL_MSG( "wxToolBar::SetMargins not implemented" );
}
void wxToolBar::SetToolPacking( int WXUNUSED(packing) )

View File

@@ -140,7 +140,6 @@ static guint32 gs_timeLastClick = 0;
static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExpose *gdk_event, wxWindow *win )
{
if (!win->HasVMT()) return;
if (g_blockEventsOnDrag) return;
win->m_updateRegion.Union( gdk_event->area.x,
gdk_event->area.y,
@@ -170,7 +169,6 @@ static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExp
static void gtk_window_draw_callback( GtkWidget *WXUNUSED(widget), GdkRectangle *rect, wxWindow *win )
{
if (!win->HasVMT()) return;
if (g_blockEventsOnDrag) return;
win->m_updateRegion.Union( rect->x, rect->y, rect->width, rect->height );
@@ -1446,14 +1444,14 @@ void wxWindow::SetClientSize( int width, int height )
if (!m_hasScrolling)
{
/*
do we have sunken dialogs ?
GtkStyleClass *window_class = m_wxwindow->style->klass;
if ((m_windowStyle & wxRAISED_BORDER) ||
(m_windowStyle & wxSUNKEN_BORDER))
{
dw += 2 * window_class->xthickness;
dh += 2 * window_class->ythickness;
*/
}
}
else
{
@@ -1511,14 +1509,14 @@ void wxWindow::GetClientSize( int *width, int *height ) const
if (!m_hasScrolling)
{
/*
do we have sunken dialogs ?
GtkStyleClass *window_class = m_wxwindow->style->klass;
if ((m_windowStyle & wxRAISED_BORDER) ||
(m_windowStyle & wxSUNKEN_BORDER))
{
dw += 2 * window_class->xthickness;
dh += 2 * window_class->ythickness;
*/
}
}
else
{

View File

@@ -25,7 +25,7 @@
// constants
//-----------------------------------------------------------------------------
const int wxMENU_HEIGHT = 30;
const int wxMENU_HEIGHT = 27;
const int wxSTATUS_HEIGHT = 25;
//-----------------------------------------------------------------------------
@@ -222,7 +222,7 @@ wxPoint wxFrame::GetClientAreaOrigin() const
{
int h = 0;
m_frameMenuBar->GetSize( (int*)NULL, &h );
pt.y += h + 2;
pt.y += h;
}
if (m_frameToolBar)
{
@@ -381,10 +381,10 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
if (m_frameMenuBar)
{
int xx = 1 + m_miniEdge;
int yy = 1 + m_miniEdge + m_miniTitle;
int ww = m_width - 2 - 2*m_miniEdge;
int hh = wxMENU_HEIGHT-2;
int xx = m_miniEdge;
int yy = m_miniEdge + m_miniTitle;
int ww = m_width - 2*m_miniEdge;
int hh = wxMENU_HEIGHT;
m_frameMenuBar->m_x = xx;
m_frameMenuBar->m_y = yy;
m_frameMenuBar->m_width = ww;
@@ -396,10 +396,10 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
if (m_frameToolBar)
{
int xx = 1 + m_miniEdge;
int xx = m_miniEdge;
int yy = m_miniEdge + m_miniTitle;
if (m_frameMenuBar) yy += wxMENU_HEIGHT;
int ww = m_width -2 - 2*m_miniEdge;
int ww = m_width - 2*m_miniEdge;
int hh = m_frameToolBar->m_height;
m_frameToolBar->m_x = xx;

View File

@@ -21,7 +21,7 @@
// constants
//-----------------------------------------------------------------------------
const int wxMENU_HEIGHT = 30;
const int wxMENU_HEIGHT = 27;
//-----------------------------------------------------------------------------
// globals
@@ -120,12 +120,12 @@ void wxMDIParentFrame::GtkOnSize( int x, int y, int width, int height )
if (m_mdiMenuBar)
{
m_mdiMenuBar->m_x = 1;
m_mdiMenuBar->m_y = 1;
m_mdiMenuBar->m_width = m_width-2;
m_mdiMenuBar->m_height = wxMENU_HEIGHT-2;
gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_mdiMenuBar->m_widget, 1, 1 );
gtk_widget_set_usize( m_mdiMenuBar->m_widget, m_width-2, wxMENU_HEIGHT-2 );
m_mdiMenuBar->m_x = 0;
m_mdiMenuBar->m_y = 0;
m_mdiMenuBar->m_width = m_width;
m_mdiMenuBar->m_height = wxMENU_HEIGHT;
gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_mdiMenuBar->m_widget, 0, 0 );
gtk_widget_set_usize( m_mdiMenuBar->m_widget, m_width, wxMENU_HEIGHT );
}
}
@@ -135,12 +135,12 @@ void wxMDIParentFrame::SetMDIMenuBar( wxMenuBar *menu_bar )
m_mdiMenuBar = menu_bar;
if (m_mdiMenuBar)
{
m_mdiMenuBar->m_x = 1;
m_mdiMenuBar->m_y = 1;
m_mdiMenuBar->m_width = m_width-2;
m_mdiMenuBar->m_height = wxMENU_HEIGHT-2;
gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_mdiMenuBar->m_widget, 1, 1 );
gtk_widget_set_usize( m_mdiMenuBar->m_widget, m_width-2, wxMENU_HEIGHT-2 );
m_mdiMenuBar->m_x = 0;
m_mdiMenuBar->m_y = 0;
m_mdiMenuBar->m_width = m_width;
m_mdiMenuBar->m_height = wxMENU_HEIGHT;
gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_mdiMenuBar->m_widget, 0, 0 );
gtk_widget_set_usize( m_mdiMenuBar->m_widget, m_width, wxMENU_HEIGHT );
m_mdiMenuBar->Show( TRUE );
}
}

View File

@@ -32,7 +32,7 @@ class wxPenRefData: public wxObjectRefData
wxColour m_colour;
};
wxPenRefData::wxPenRefData(void)
wxPenRefData::wxPenRefData()
{
m_width = 1;
m_style = wxSOLID;
@@ -84,7 +84,7 @@ wxPen::wxPen( const wxPen* pen )
if (wxThePenList) wxThePenList->AddPen( this );
}
wxPen::~wxPen(void)
wxPen::~wxPen()
{
if (wxThePenList) wxThePenList->RemovePen( this );
}
@@ -142,67 +142,47 @@ void wxPen::SetWidth( int width )
M_PENDATA->m_width = width;
}
int wxPen::GetCap(void) const
int wxPen::GetCap() const
{
if (!m_refData)
{
wxFAIL_MSG( "invalid pen" );
return -1;
}
wxCHECK_MSG( Ok(), -1, "invalid pen" );
return M_PENDATA->m_capStyle;
}
int wxPen::GetJoin(void) const
int wxPen::GetJoin() const
{
if (!m_refData)
{
wxFAIL_MSG( "invalid pen" );
return -1;
}
wxCHECK_MSG( Ok(), -1, "invalid pen" );
return M_PENDATA->m_joinStyle;
}
int wxPen::GetStyle(void) const
int wxPen::GetStyle() const
{
if (!m_refData)
{
wxFAIL_MSG( "invalid pen" );
return -1;
}
wxCHECK_MSG( Ok(), -1, "invalid pen" );
return M_PENDATA->m_style;
}
int wxPen::GetWidth(void) const
int wxPen::GetWidth() const
{
if (!m_refData)
{
wxFAIL_MSG( "invalid pen" );
return -1;
}
wxCHECK_MSG( Ok(), -1, "invalid pen" );
return M_PENDATA->m_width;
}
wxColour &wxPen::GetColour(void) const
wxColour &wxPen::GetColour() const
{
if (!m_refData)
{
wxFAIL_MSG( "invalid pen" );
return wxNullColour;
}
wxCHECK_MSG( Ok(), wxNullColour, "invalid pen" );
return M_PENDATA->m_colour;
}
bool wxPen::Ok(void) const
bool wxPen::Ok() const
{
return (m_refData != NULL);
}
void wxPen::Unshare(void)
void wxPen::Unshare()
{
if (!m_refData)
{

View File

@@ -64,8 +64,10 @@ wxRadioBox::wxRadioBox(void)
bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
const wxPoint &pos, const wxSize &size,
int n, const wxString choices[], int WXUNUSED(majorDim),
long style, const wxValidator& validator, const wxString &name )
int n, const wxString choices[],
int WXUNUSED(majorDim),
long style, const wxValidator& validator,
const wxString &name )
{
m_alreadySent = FALSE;
m_needParent = TRUE;
@@ -113,7 +115,6 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
y += 20;
height += 20;
}
width = maxLen + 10;
}
@@ -287,11 +288,7 @@ void wxRadioBox::SetSelection( int n )
wxNode *node = m_boxes.Nth( n );
if (!node)
{
wxFAIL_MSG( "wxRadioBox wrong index" );
return;
}
wxCHECK_RET( node, "radiobox wrong index" );
GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->Data() );
@@ -324,11 +321,7 @@ wxString wxRadioBox::GetString( int n ) const
wxNode *node = m_boxes.Nth( n );
if (!node)
{
wxFAIL_MSG( "wxRadioBox wrong index" );
return "";
}
wxCHECK_MSG( node, "", "radiobox wrong index" );
GtkButton *button = GTK_BUTTON( node->Data() );
GtkLabel *label = GTK_LABEL( button->child );
@@ -358,11 +351,7 @@ void wxRadioBox::SetLabel( int item, const wxString& label )
wxNode *node = m_boxes.Nth( item );
if (!node)
{
wxFAIL_MSG( "wxRadioBox wrong index" );
return;
}
wxCHECK_RET( node, "radiobox wrong index" );
GtkButton *button = GTK_BUTTON( node->Data() );
GtkLabel *g_label = GTK_LABEL( button->child );
@@ -392,13 +381,11 @@ void wxRadioBox::Enable( bool enable )
void wxRadioBox::Enable( int item, bool enable )
{
wxCHECK_RET( m_widget != NULL, "invalid radiobox" );
wxNode *node = m_boxes.Nth( item );
if (!node)
{
wxFAIL_MSG( "wxRadioBox wrong index" );
return;
}
wxCHECK_RET( node, "radiobox wrong index" );
GtkButton *button = GTK_BUTTON( node->Data() );
GtkWidget *label = button->child;
@@ -408,13 +395,11 @@ void wxRadioBox::Enable( int item, bool enable )
void wxRadioBox::Show( int item, bool show )
{
wxCHECK_RET( m_widget != NULL, "invalid radiobox" );
wxNode *node = m_boxes.Nth( item );
if (!node)
{
wxFAIL_MSG( "wxRadioBox wrong index" );
return;
}
wxCHECK_RET( node, "radiobox wrong index" );
GtkWidget *button = GTK_WIDGET( node->Data() );
@@ -426,6 +411,8 @@ void wxRadioBox::Show( int item, bool show )
wxString wxRadioBox::GetStringSelection(void) const
{
wxCHECK_MSG( m_widget != NULL, "", "invalid radiobox" );
wxNode *node = m_boxes.First();
while (node)
{
@@ -444,9 +431,12 @@ wxString wxRadioBox::GetStringSelection(void) const
bool wxRadioBox::SetStringSelection( const wxString &s )
{
wxCHECK_MSG( m_widget != NULL, FALSE, "invalid radiobox" );
int res = FindString( s );
if (res == -1) return FALSE;
SetSelection( res );
return TRUE;
}

View File

@@ -118,6 +118,8 @@ bool wxToolBar::Create( wxWindow *parent, wxWindowID id,
gtk_toolbar_set_tooltips( GTK_TOOLBAR(m_toolbar), TRUE );
gtk_toolbar_append_space( m_toolbar );
m_parent->AddChild( this );
(m_parent->m_insertCallback)( m_parent, this );
@@ -250,7 +252,7 @@ void wxToolBar::Realize()
node = node->Next();
}
m_height += 10;
m_height += 12;
}
void wxToolBar::EnableTool(int toolIndex, bool enable)
@@ -336,7 +338,7 @@ bool wxToolBar::GetToolEnabled(int toolIndex) const
void wxToolBar::SetMargins( int WXUNUSED(x), int WXUNUSED(y) )
{
wxFAIL_MSG( "wxToolBar::SetMargins not implemented" );
// wxFAIL_MSG( "wxToolBar::SetMargins not implemented" );
}
void wxToolBar::SetToolPacking( int WXUNUSED(packing) )

View File

@@ -140,7 +140,6 @@ static guint32 gs_timeLastClick = 0;
static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExpose *gdk_event, wxWindow *win )
{
if (!win->HasVMT()) return;
if (g_blockEventsOnDrag) return;
win->m_updateRegion.Union( gdk_event->area.x,
gdk_event->area.y,
@@ -170,7 +169,6 @@ static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExp
static void gtk_window_draw_callback( GtkWidget *WXUNUSED(widget), GdkRectangle *rect, wxWindow *win )
{
if (!win->HasVMT()) return;
if (g_blockEventsOnDrag) return;
win->m_updateRegion.Union( rect->x, rect->y, rect->width, rect->height );
@@ -1446,14 +1444,14 @@ void wxWindow::SetClientSize( int width, int height )
if (!m_hasScrolling)
{
/*
do we have sunken dialogs ?
GtkStyleClass *window_class = m_wxwindow->style->klass;
if ((m_windowStyle & wxRAISED_BORDER) ||
(m_windowStyle & wxSUNKEN_BORDER))
{
dw += 2 * window_class->xthickness;
dh += 2 * window_class->ythickness;
*/
}
}
else
{
@@ -1511,14 +1509,14 @@ void wxWindow::GetClientSize( int *width, int *height ) const
if (!m_hasScrolling)
{
/*
do we have sunken dialogs ?
GtkStyleClass *window_class = m_wxwindow->style->klass;
if ((m_windowStyle & wxRAISED_BORDER) ||
(m_windowStyle & wxSUNKEN_BORDER))
{
dw += 2 * window_class->xthickness;
dh += 2 * window_class->ythickness;
*/
}
}
else
{