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:
parent
ef5390661e
commit
907789a0f7
@ -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
|
||||
@ -271,7 +285,7 @@ protected:
|
||||
void *FirstThat(wxListIterateFunction func);
|
||||
void ForEach(wxListIterateFunction func);
|
||||
void *LastThat(wxListIterateFunction func);
|
||||
|
||||
|
||||
private:
|
||||
// helpers
|
||||
// common part of all ctors
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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"));
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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) )
|
||||
@ -2263,6 +2265,8 @@ bool wxListCtrl::Create( wxWindow *parent, wxWindowID id,
|
||||
bool ret = wxControl::Create( parent, id, pos, size, s, name );
|
||||
|
||||
SetValidator( validator );
|
||||
|
||||
if (s & wxSUNKEN_BORDER) s -= wxSUNKEN_BORDER;
|
||||
|
||||
m_mainWin = new wxListMainWindow( this, -1, wxPoint(0,0), size, s );
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
172
src/gtk/pen.cpp
172
src/gtk/pen.cpp
@ -20,33 +20,33 @@
|
||||
|
||||
class wxPenRefData: public wxObjectRefData
|
||||
{
|
||||
public:
|
||||
public:
|
||||
|
||||
wxPenRefData(void);
|
||||
wxPenRefData(const wxPenRefData& data);
|
||||
wxPenRefData(void);
|
||||
wxPenRefData(const wxPenRefData& data);
|
||||
|
||||
int m_width;
|
||||
int m_style;
|
||||
int m_joinStyle;
|
||||
int m_capStyle;
|
||||
wxColour m_colour;
|
||||
int m_width;
|
||||
int m_style;
|
||||
int m_joinStyle;
|
||||
int m_capStyle;
|
||||
wxColour m_colour;
|
||||
};
|
||||
|
||||
wxPenRefData::wxPenRefData(void)
|
||||
wxPenRefData::wxPenRefData()
|
||||
{
|
||||
m_width = 1;
|
||||
m_style = wxSOLID;
|
||||
m_joinStyle = wxJOIN_ROUND;
|
||||
m_capStyle = wxCAP_ROUND;
|
||||
m_width = 1;
|
||||
m_style = wxSOLID;
|
||||
m_joinStyle = wxJOIN_ROUND;
|
||||
m_capStyle = wxCAP_ROUND;
|
||||
}
|
||||
|
||||
wxPenRefData::wxPenRefData( const wxPenRefData& data )
|
||||
{
|
||||
m_style = data.m_style;
|
||||
m_width = data.m_width;
|
||||
m_joinStyle = data.m_joinStyle;
|
||||
m_capStyle = data.m_capStyle;
|
||||
m_colour = data.m_colour;
|
||||
m_style = data.m_style;
|
||||
m_width = data.m_width;
|
||||
m_joinStyle = data.m_joinStyle;
|
||||
m_capStyle = data.m_capStyle;
|
||||
m_colour = data.m_colour;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -57,162 +57,142 @@ IMPLEMENT_DYNAMIC_CLASS(wxPen,wxGDIObject)
|
||||
|
||||
wxPen::wxPen(void)
|
||||
{
|
||||
if (wxThePenList) wxThePenList->AddPen( this );
|
||||
if (wxThePenList) wxThePenList->AddPen( this );
|
||||
}
|
||||
|
||||
wxPen::wxPen( const wxColour &colour, int width, int style )
|
||||
{
|
||||
m_refData = new wxPenRefData();
|
||||
M_PENDATA->m_width = width;
|
||||
M_PENDATA->m_style = style;
|
||||
M_PENDATA->m_colour = colour;
|
||||
m_refData = new wxPenRefData();
|
||||
M_PENDATA->m_width = width;
|
||||
M_PENDATA->m_style = style;
|
||||
M_PENDATA->m_colour = colour;
|
||||
|
||||
if (wxThePenList) wxThePenList->AddPen( this );
|
||||
if (wxThePenList) wxThePenList->AddPen( this );
|
||||
}
|
||||
|
||||
wxPen::wxPen( const wxPen& pen )
|
||||
{
|
||||
Ref( pen );
|
||||
if (wxThePenList) wxThePenList->AddPen( this );
|
||||
Ref( pen );
|
||||
if (wxThePenList) wxThePenList->AddPen( this );
|
||||
}
|
||||
|
||||
wxPen::wxPen( const wxPen* pen )
|
||||
{
|
||||
UnRef();
|
||||
if (pen) Ref( *pen );
|
||||
UnRef();
|
||||
if (pen) Ref( *pen );
|
||||
|
||||
if (wxThePenList) wxThePenList->AddPen( this );
|
||||
if (wxThePenList) wxThePenList->AddPen( this );
|
||||
}
|
||||
|
||||
wxPen::~wxPen(void)
|
||||
wxPen::~wxPen()
|
||||
{
|
||||
if (wxThePenList) wxThePenList->RemovePen( this );
|
||||
if (wxThePenList) wxThePenList->RemovePen( this );
|
||||
}
|
||||
|
||||
wxPen& wxPen::operator = ( const wxPen& pen )
|
||||
{
|
||||
if (*this == pen) return (*this);
|
||||
Ref( pen );
|
||||
return *this;
|
||||
if (*this == pen) return (*this);
|
||||
Ref( pen );
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool wxPen::operator == ( const wxPen& pen )
|
||||
{
|
||||
return m_refData == pen.m_refData;
|
||||
return m_refData == pen.m_refData;
|
||||
}
|
||||
|
||||
bool wxPen::operator != ( const wxPen& pen )
|
||||
{
|
||||
return m_refData != pen.m_refData;
|
||||
return m_refData != pen.m_refData;
|
||||
}
|
||||
|
||||
void wxPen::SetColour( const wxColour &colour )
|
||||
{
|
||||
Unshare();
|
||||
M_PENDATA->m_colour = colour;
|
||||
Unshare();
|
||||
M_PENDATA->m_colour = colour;
|
||||
}
|
||||
|
||||
void wxPen::SetColour( int red, int green, int blue )
|
||||
{
|
||||
Unshare();
|
||||
M_PENDATA->m_colour.Set( red, green, blue );
|
||||
Unshare();
|
||||
M_PENDATA->m_colour.Set( red, green, blue );
|
||||
}
|
||||
|
||||
void wxPen::SetCap( int capStyle )
|
||||
{
|
||||
Unshare();
|
||||
M_PENDATA->m_capStyle = capStyle;
|
||||
Unshare();
|
||||
M_PENDATA->m_capStyle = capStyle;
|
||||
}
|
||||
|
||||
void wxPen::SetJoin( int joinStyle )
|
||||
{
|
||||
Unshare();
|
||||
M_PENDATA->m_joinStyle = joinStyle;
|
||||
Unshare();
|
||||
M_PENDATA->m_joinStyle = joinStyle;
|
||||
}
|
||||
|
||||
void wxPen::SetStyle( int style )
|
||||
{
|
||||
Unshare();
|
||||
M_PENDATA->m_style = style;
|
||||
Unshare();
|
||||
M_PENDATA->m_style = style;
|
||||
}
|
||||
|
||||
void wxPen::SetWidth( int width )
|
||||
{
|
||||
Unshare();
|
||||
M_PENDATA->m_width = width;
|
||||
Unshare();
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
return M_PENDATA->m_colour;
|
||||
}
|
||||
|
||||
bool wxPen::Ok(void) const
|
||||
bool wxPen::Ok() const
|
||||
{
|
||||
return (m_refData != NULL);
|
||||
return (m_refData != NULL);
|
||||
}
|
||||
|
||||
void wxPen::Unshare(void)
|
||||
void wxPen::Unshare()
|
||||
{
|
||||
if (!m_refData)
|
||||
{
|
||||
m_refData = new wxPenRefData();
|
||||
}
|
||||
else
|
||||
{
|
||||
wxPenRefData* ref = new wxPenRefData( *(wxPenRefData*)m_refData );
|
||||
UnRef();
|
||||
m_refData = ref;
|
||||
}
|
||||
if (!m_refData)
|
||||
{
|
||||
m_refData = new wxPenRefData();
|
||||
}
|
||||
else
|
||||
{
|
||||
wxPenRefData* ref = new wxPenRefData( *(wxPenRefData*)m_refData );
|
||||
UnRef();
|
||||
m_refData = ref;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,23 +29,23 @@ extern bool g_blockEventsOnDrag;
|
||||
|
||||
static void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxRadioBox *rb )
|
||||
{
|
||||
if (!rb->HasVMT()) return;
|
||||
if (g_blockEventsOnDrag) return;
|
||||
if (!rb->HasVMT()) return;
|
||||
if (g_blockEventsOnDrag) return;
|
||||
|
||||
if (rb->m_alreadySent)
|
||||
{
|
||||
rb->m_alreadySent = FALSE;
|
||||
return;
|
||||
}
|
||||
if (rb->m_alreadySent)
|
||||
{
|
||||
rb->m_alreadySent = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
rb->m_alreadySent = TRUE;
|
||||
rb->m_alreadySent = TRUE;
|
||||
|
||||
wxCommandEvent event( wxEVT_COMMAND_RADIOBOX_SELECTED, rb->GetId() );
|
||||
event.SetInt( rb->GetSelection() );
|
||||
wxString tmp( rb->GetStringSelection() );
|
||||
event.SetString( WXSTRINGCAST(tmp) );
|
||||
event.SetEventObject( rb );
|
||||
rb->GetEventHandler()->ProcessEvent(event);
|
||||
wxCommandEvent event( wxEVT_COMMAND_RADIOBOX_SELECTED, rb->GetId() );
|
||||
event.SetInt( rb->GetSelection() );
|
||||
wxString tmp( rb->GetStringSelection() );
|
||||
event.SetString( WXSTRINGCAST(tmp) );
|
||||
event.SetEventObject( rb );
|
||||
rb->GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -55,7 +55,7 @@ static void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxRad
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxRadioBox,wxControl)
|
||||
|
||||
BEGIN_EVENT_TABLE(wxRadioBox, wxControl)
|
||||
EVT_SIZE(wxRadioBox::OnSize)
|
||||
EVT_SIZE(wxRadioBox::OnSize)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
wxRadioBox::wxRadioBox(void)
|
||||
@ -63,127 +63,128 @@ 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 )
|
||||
const wxPoint &pos, const wxSize &size,
|
||||
int n, const wxString choices[],
|
||||
int WXUNUSED(majorDim),
|
||||
long style, const wxValidator& validator,
|
||||
const wxString &name )
|
||||
{
|
||||
m_alreadySent = FALSE;
|
||||
m_needParent = TRUE;
|
||||
m_alreadySent = FALSE;
|
||||
m_needParent = TRUE;
|
||||
|
||||
PreCreation( parent, id, pos, size, style, name );
|
||||
PreCreation( parent, id, pos, size, style, name );
|
||||
|
||||
SetValidator( validator );
|
||||
SetValidator( validator );
|
||||
|
||||
m_widget = gtk_frame_new( title );
|
||||
m_widget = gtk_frame_new( title );
|
||||
|
||||
int x = m_x+5;
|
||||
int y = m_y+15;
|
||||
int maxLen = 0;
|
||||
int height = 20;
|
||||
int width = 0;
|
||||
int x = m_x+5;
|
||||
int y = m_y+15;
|
||||
int maxLen = 0;
|
||||
int height = 20;
|
||||
int width = 0;
|
||||
|
||||
GtkRadioButton *m_radio = (GtkRadioButton*) NULL;
|
||||
GtkRadioButton *m_radio = (GtkRadioButton*) NULL;
|
||||
|
||||
if (m_windowStyle & wxRA_VERTICAL)
|
||||
{
|
||||
GSList *radio_button_group = (GSList *) NULL;
|
||||
for (int i = 0; i < n; i++)
|
||||
if (m_windowStyle & wxRA_VERTICAL)
|
||||
{
|
||||
if (i) radio_button_group = gtk_radio_button_group( GTK_RADIO_BUTTON(m_radio) );
|
||||
GSList *radio_button_group = (GSList *) NULL;
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
if (i) radio_button_group = gtk_radio_button_group( GTK_RADIO_BUTTON(m_radio) );
|
||||
|
||||
m_radio = GTK_RADIO_BUTTON( gtk_radio_button_new_with_label( radio_button_group, choices[i] ) );
|
||||
m_radio = GTK_RADIO_BUTTON( gtk_radio_button_new_with_label( radio_button_group, choices[i] ) );
|
||||
|
||||
m_boxes.Append( (wxObject*) m_radio );
|
||||
m_boxes.Append( (wxObject*) m_radio );
|
||||
|
||||
ConnectWidget( GTK_WIDGET(m_radio) );
|
||||
ConnectWidget( GTK_WIDGET(m_radio) );
|
||||
|
||||
if (!i) gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_radio), TRUE );
|
||||
if (!i) gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_radio), TRUE );
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(m_radio), "clicked",
|
||||
GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
|
||||
gtk_signal_connect( GTK_OBJECT(m_radio), "clicked",
|
||||
GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
|
||||
|
||||
gtk_myfixed_put( GTK_MYFIXED(m_parent->m_wxwindow), GTK_WIDGET(m_radio), x, y );
|
||||
gtk_myfixed_put( GTK_MYFIXED(m_parent->m_wxwindow), GTK_WIDGET(m_radio), x, y );
|
||||
|
||||
int tmp = 25+gdk_string_measure( GTK_WIDGET(m_radio)->style->font, choices[i] );
|
||||
if (tmp > maxLen) maxLen = tmp;
|
||||
int tmp = 25+gdk_string_measure( GTK_WIDGET(m_radio)->style->font, choices[i] );
|
||||
if (tmp > maxLen) maxLen = tmp;
|
||||
|
||||
width = m_width-10;
|
||||
if (size.x == -1) width = tmp;
|
||||
gtk_widget_set_usize( GTK_WIDGET(m_radio), width, 20 );
|
||||
|
||||
y += 20;
|
||||
height += 20;
|
||||
width = m_width-10;
|
||||
if (size.x == -1) width = tmp;
|
||||
gtk_widget_set_usize( GTK_WIDGET(m_radio), width, 20 );
|
||||
|
||||
y += 20;
|
||||
height += 20;
|
||||
}
|
||||
width = maxLen + 10;
|
||||
}
|
||||
width = maxLen + 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
int max = 0;
|
||||
for (int i = 0; i < n; i++)
|
||||
else
|
||||
{
|
||||
GdkFont *font = m_widget->style->font;
|
||||
int len = 27+gdk_string_measure( font, choices[i] );
|
||||
if (len > max) max = len;
|
||||
}
|
||||
int max = 0;
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
GdkFont *font = m_widget->style->font;
|
||||
int len = 27+gdk_string_measure( font, choices[i] );
|
||||
if (len > max) max = len;
|
||||
}
|
||||
|
||||
GSList *radio_button_group = (GSList *) NULL;
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
if (i) radio_button_group = gtk_radio_button_group( GTK_RADIO_BUTTON(m_radio) );
|
||||
GSList *radio_button_group = (GSList *) NULL;
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
if (i) radio_button_group = gtk_radio_button_group( GTK_RADIO_BUTTON(m_radio) );
|
||||
|
||||
m_radio = GTK_RADIO_BUTTON( gtk_radio_button_new_with_label( radio_button_group, choices[i] ) );
|
||||
m_radio = GTK_RADIO_BUTTON( gtk_radio_button_new_with_label( radio_button_group, choices[i] ) );
|
||||
|
||||
m_boxes.Append( (wxObject*) m_radio );
|
||||
m_boxes.Append( (wxObject*) m_radio );
|
||||
|
||||
ConnectWidget( GTK_WIDGET(m_radio) );
|
||||
ConnectWidget( GTK_WIDGET(m_radio) );
|
||||
|
||||
if (!i) gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_radio), TRUE );
|
||||
if (!i) gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_radio), TRUE );
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(m_radio), "clicked",
|
||||
GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
|
||||
gtk_signal_connect( GTK_OBJECT(m_radio), "clicked",
|
||||
GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
|
||||
|
||||
gtk_myfixed_put( GTK_MYFIXED(m_parent->m_wxwindow), GTK_WIDGET(m_radio), x, y );
|
||||
gtk_myfixed_put( GTK_MYFIXED(m_parent->m_wxwindow), GTK_WIDGET(m_radio), x, y );
|
||||
|
||||
gtk_widget_set_usize( GTK_WIDGET(m_radio), max, 20 );
|
||||
gtk_widget_set_usize( GTK_WIDGET(m_radio), max, 20 );
|
||||
|
||||
x += max;
|
||||
x += max;
|
||||
}
|
||||
|
||||
width = max*n + 10;
|
||||
height = 40;
|
||||
}
|
||||
|
||||
width = max*n + 10;
|
||||
height = 40;
|
||||
}
|
||||
|
||||
wxSize newSize = size;
|
||||
if (newSize.x == -1) newSize.x = width;
|
||||
if (newSize.y == -1) newSize.y = height;
|
||||
SetSize( newSize.x, newSize.y );
|
||||
wxSize newSize = size;
|
||||
if (newSize.x == -1) newSize.x = width;
|
||||
if (newSize.y == -1) newSize.y = height;
|
||||
SetSize( newSize.x, newSize.y );
|
||||
|
||||
m_parent->AddChild( this );
|
||||
m_parent->AddChild( this );
|
||||
|
||||
(m_parent->m_insertCallback)( m_parent, this );
|
||||
(m_parent->m_insertCallback)( m_parent, this );
|
||||
|
||||
PostCreation();
|
||||
PostCreation();
|
||||
|
||||
SetLabel( title );
|
||||
SetLabel( title );
|
||||
|
||||
SetBackgroundColour( parent->GetBackgroundColour() );
|
||||
SetForegroundColour( parent->GetForegroundColour() );
|
||||
SetBackgroundColour( parent->GetBackgroundColour() );
|
||||
SetForegroundColour( parent->GetForegroundColour() );
|
||||
|
||||
Show( TRUE );
|
||||
Show( TRUE );
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
wxRadioBox::~wxRadioBox(void)
|
||||
{
|
||||
wxNode *node = m_boxes.First();
|
||||
while (node)
|
||||
{
|
||||
GtkWidget *button = GTK_WIDGET( node->Data() );
|
||||
gtk_widget_destroy( button );
|
||||
node = node->Next();
|
||||
}
|
||||
wxNode *node = m_boxes.First();
|
||||
while (node)
|
||||
{
|
||||
GtkWidget *button = GTK_WIDGET( node->Data() );
|
||||
gtk_widget_destroy( button );
|
||||
node = node->Next();
|
||||
}
|
||||
}
|
||||
|
||||
void wxRadioBox::OnSize( wxSizeEvent &event )
|
||||
@ -243,260 +244,249 @@ void wxRadioBox::OnSize( wxSizeEvent &event )
|
||||
|
||||
bool wxRadioBox::Show( bool show )
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, FALSE, "invalid radiobox" );
|
||||
wxCHECK_MSG( m_widget != NULL, FALSE, "invalid radiobox" );
|
||||
|
||||
wxWindow::Show( show );
|
||||
wxWindow::Show( show );
|
||||
|
||||
wxNode *node = m_boxes.First();
|
||||
while (node)
|
||||
{
|
||||
GtkWidget *button = GTK_WIDGET( node->Data() );
|
||||
wxNode *node = m_boxes.First();
|
||||
while (node)
|
||||
{
|
||||
GtkWidget *button = GTK_WIDGET( node->Data() );
|
||||
|
||||
if (show) gtk_widget_show( button ); else gtk_widget_hide( button );
|
||||
if (show) gtk_widget_show( button ); else gtk_widget_hide( button );
|
||||
|
||||
node = node->Next();
|
||||
}
|
||||
node = node->Next();
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int wxRadioBox::FindString( const wxString &s ) const
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, -1, "invalid radiobox" );
|
||||
wxCHECK_MSG( m_widget != NULL, -1, "invalid radiobox" );
|
||||
|
||||
int count = 0;
|
||||
int count = 0;
|
||||
|
||||
wxNode *node = m_boxes.First();
|
||||
while (node)
|
||||
{
|
||||
GtkButton *button = GTK_BUTTON( node->Data() );
|
||||
wxNode *node = m_boxes.First();
|
||||
while (node)
|
||||
{
|
||||
GtkButton *button = GTK_BUTTON( node->Data() );
|
||||
|
||||
GtkLabel *label = GTK_LABEL( button->child );
|
||||
if (s == label->label) return count;
|
||||
count++;
|
||||
GtkLabel *label = GTK_LABEL( button->child );
|
||||
if (s == label->label) return count;
|
||||
count++;
|
||||
|
||||
node = node->Next();
|
||||
}
|
||||
node = node->Next();
|
||||
}
|
||||
|
||||
return -1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
void wxRadioBox::SetSelection( int n )
|
||||
{
|
||||
wxCHECK_RET( m_widget != NULL, "invalid radiobox" );
|
||||
wxCHECK_RET( m_widget != NULL, "invalid radiobox" );
|
||||
|
||||
wxNode *node = m_boxes.Nth( 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() );
|
||||
GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->Data() );
|
||||
|
||||
gtk_toggle_button_set_state( button, 1 );
|
||||
gtk_toggle_button_set_state( button, 1 );
|
||||
}
|
||||
|
||||
int wxRadioBox::GetSelection(void) const
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, -1, "invalid radiobox" );
|
||||
wxCHECK_MSG( m_widget != NULL, -1, "invalid radiobox" );
|
||||
|
||||
int count = 0;
|
||||
int count = 0;
|
||||
|
||||
wxNode *node = m_boxes.First();
|
||||
while (node)
|
||||
{
|
||||
GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->Data() );
|
||||
if (button->active) return count;
|
||||
count++;
|
||||
node = node->Next();
|
||||
}
|
||||
wxNode *node = m_boxes.First();
|
||||
while (node)
|
||||
{
|
||||
GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->Data() );
|
||||
if (button->active) return count;
|
||||
count++;
|
||||
node = node->Next();
|
||||
}
|
||||
|
||||
wxFAIL_MSG( "wxRadioBox none selected" );
|
||||
wxFAIL_MSG( "wxRadioBox none selected" );
|
||||
|
||||
return -1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
wxString wxRadioBox::GetString( int n ) const
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, "", "invalid radiobox" );
|
||||
wxCHECK_MSG( m_widget != NULL, "", "invalid radiobox" );
|
||||
|
||||
wxNode *node = m_boxes.Nth( n );
|
||||
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 );
|
||||
GtkButton *button = GTK_BUTTON( node->Data() );
|
||||
GtkLabel *label = GTK_LABEL( button->child );
|
||||
|
||||
return wxString( label->label );
|
||||
return wxString( label->label );
|
||||
}
|
||||
|
||||
wxString wxRadioBox::GetLabel( int item ) const
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, "", "invalid radiobox" );
|
||||
wxCHECK_MSG( m_widget != NULL, "", "invalid radiobox" );
|
||||
|
||||
return GetString( item );
|
||||
return GetString( item );
|
||||
}
|
||||
|
||||
void wxRadioBox::SetLabel( const wxString& label )
|
||||
{
|
||||
wxCHECK_RET( m_widget != NULL, "invalid radiobox" );
|
||||
wxCHECK_RET( m_widget != NULL, "invalid radiobox" );
|
||||
|
||||
wxControl::SetLabel( label );
|
||||
wxControl::SetLabel( label );
|
||||
|
||||
gtk_frame_set_label( GTK_FRAME(m_widget), wxControl::GetLabel() );
|
||||
gtk_frame_set_label( GTK_FRAME(m_widget), wxControl::GetLabel() );
|
||||
}
|
||||
|
||||
void wxRadioBox::SetLabel( int item, const wxString& label )
|
||||
{
|
||||
wxCHECK_RET( m_widget != NULL, "invalid radiobox" );
|
||||
wxCHECK_RET( m_widget != NULL, "invalid radiobox" );
|
||||
|
||||
wxNode *node = m_boxes.Nth( item );
|
||||
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 );
|
||||
GtkButton *button = GTK_BUTTON( node->Data() );
|
||||
GtkLabel *g_label = GTK_LABEL( button->child );
|
||||
|
||||
gtk_label_set( g_label, label );
|
||||
gtk_label_set( g_label, label );
|
||||
}
|
||||
|
||||
void wxRadioBox::SetLabel( int WXUNUSED(item), wxBitmap *WXUNUSED(bitmap) )
|
||||
{
|
||||
wxFAIL_MSG("wxRadioBox::SetLabel not implemented.");
|
||||
wxFAIL_MSG("wxRadioBox::SetLabel not implemented.");
|
||||
}
|
||||
|
||||
void wxRadioBox::Enable( bool enable )
|
||||
{
|
||||
wxControl::Enable( enable );
|
||||
wxControl::Enable( enable );
|
||||
|
||||
wxNode *node = m_boxes.First();
|
||||
while (node)
|
||||
{
|
||||
GtkButton *button = GTK_BUTTON( node->Data() );
|
||||
GtkWidget *label = button->child;
|
||||
gtk_widget_set_sensitive( GTK_WIDGET(button), enable );
|
||||
gtk_widget_set_sensitive( label, enable );
|
||||
node = node->Next();
|
||||
}
|
||||
wxNode *node = m_boxes.First();
|
||||
while (node)
|
||||
{
|
||||
GtkButton *button = GTK_BUTTON( node->Data() );
|
||||
GtkWidget *label = button->child;
|
||||
gtk_widget_set_sensitive( GTK_WIDGET(button), enable );
|
||||
gtk_widget_set_sensitive( label, enable );
|
||||
node = node->Next();
|
||||
}
|
||||
}
|
||||
|
||||
void wxRadioBox::Enable( int item, bool enable )
|
||||
{
|
||||
wxNode *node = m_boxes.Nth( item );
|
||||
wxCHECK_RET( m_widget != NULL, "invalid radiobox" );
|
||||
|
||||
if (!node)
|
||||
{
|
||||
wxFAIL_MSG( "wxRadioBox wrong index" );
|
||||
return;
|
||||
}
|
||||
wxNode *node = m_boxes.Nth( item );
|
||||
|
||||
GtkButton *button = GTK_BUTTON( node->Data() );
|
||||
GtkWidget *label = button->child;
|
||||
gtk_widget_set_sensitive( GTK_WIDGET(button), enable );
|
||||
gtk_widget_set_sensitive( label, enable );
|
||||
wxCHECK_RET( node, "radiobox wrong index" );
|
||||
|
||||
GtkButton *button = GTK_BUTTON( node->Data() );
|
||||
GtkWidget *label = button->child;
|
||||
gtk_widget_set_sensitive( GTK_WIDGET(button), enable );
|
||||
gtk_widget_set_sensitive( label, enable );
|
||||
}
|
||||
|
||||
void wxRadioBox::Show( int item, bool show )
|
||||
{
|
||||
wxNode *node = m_boxes.Nth( item );
|
||||
wxCHECK_RET( m_widget != NULL, "invalid radiobox" );
|
||||
|
||||
if (!node)
|
||||
{
|
||||
wxFAIL_MSG( "wxRadioBox wrong index" );
|
||||
return;
|
||||
}
|
||||
wxNode *node = m_boxes.Nth( item );
|
||||
|
||||
GtkWidget *button = GTK_WIDGET( node->Data() );
|
||||
wxCHECK_RET( node, "radiobox wrong index" );
|
||||
|
||||
GtkWidget *button = GTK_WIDGET( node->Data() );
|
||||
|
||||
if (show)
|
||||
gtk_widget_show( button );
|
||||
else
|
||||
gtk_widget_hide( button );
|
||||
if (show)
|
||||
gtk_widget_show( button );
|
||||
else
|
||||
gtk_widget_hide( button );
|
||||
}
|
||||
|
||||
wxString wxRadioBox::GetStringSelection(void) const
|
||||
{
|
||||
wxNode *node = m_boxes.First();
|
||||
while (node)
|
||||
{
|
||||
GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->Data() );
|
||||
if (button->active)
|
||||
{
|
||||
GtkLabel *label = GTK_LABEL( GTK_BUTTON(button)->child );
|
||||
return label->label;
|
||||
}
|
||||
node = node->Next();
|
||||
}
|
||||
wxCHECK_MSG( m_widget != NULL, "", "invalid radiobox" );
|
||||
|
||||
wxFAIL_MSG( "wxRadioBox none selected" );
|
||||
return "";
|
||||
wxNode *node = m_boxes.First();
|
||||
while (node)
|
||||
{
|
||||
GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->Data() );
|
||||
if (button->active)
|
||||
{
|
||||
GtkLabel *label = GTK_LABEL( GTK_BUTTON(button)->child );
|
||||
return label->label;
|
||||
}
|
||||
node = node->Next();
|
||||
}
|
||||
|
||||
wxFAIL_MSG( "wxRadioBox none selected" );
|
||||
return "";
|
||||
}
|
||||
|
||||
bool wxRadioBox::SetStringSelection( const wxString&s )
|
||||
bool wxRadioBox::SetStringSelection( const wxString &s )
|
||||
{
|
||||
int res = FindString( s );
|
||||
if (res == -1) return FALSE;
|
||||
SetSelection( res );
|
||||
return TRUE;
|
||||
wxCHECK_MSG( m_widget != NULL, FALSE, "invalid radiobox" );
|
||||
|
||||
int res = FindString( s );
|
||||
if (res == -1) return FALSE;
|
||||
SetSelection( res );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int wxRadioBox::Number(void) const
|
||||
{
|
||||
return m_boxes.Number();
|
||||
return m_boxes.Number();
|
||||
}
|
||||
|
||||
int wxRadioBox::GetNumberOfRowsOrCols(void) const
|
||||
{
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void wxRadioBox::SetNumberOfRowsOrCols( int WXUNUSED(n) )
|
||||
{
|
||||
wxFAIL_MSG("wxRadioBox::SetNumberOfRowsOrCols not implemented.");
|
||||
wxFAIL_MSG("wxRadioBox::SetNumberOfRowsOrCols not implemented.");
|
||||
}
|
||||
|
||||
void wxRadioBox::ApplyWidgetStyle()
|
||||
{
|
||||
SetWidgetStyle();
|
||||
SetWidgetStyle();
|
||||
|
||||
gtk_widget_set_style( m_widget, m_widgetStyle );
|
||||
gtk_widget_set_style( m_widget, m_widgetStyle );
|
||||
|
||||
wxNode *node = m_boxes.First();
|
||||
while (node)
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET( node->Data() );
|
||||
gtk_widget_set_style( widget, m_widgetStyle );
|
||||
wxNode *node = m_boxes.First();
|
||||
while (node)
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET( node->Data() );
|
||||
gtk_widget_set_style( widget, m_widgetStyle );
|
||||
|
||||
GtkButton *button = GTK_BUTTON( node->Data() );
|
||||
gtk_widget_set_style( button->child, m_widgetStyle );
|
||||
GtkButton *button = GTK_BUTTON( node->Data() );
|
||||
gtk_widget_set_style( button->child, m_widgetStyle );
|
||||
|
||||
node = node->Next();
|
||||
}
|
||||
node = node->Next();
|
||||
}
|
||||
}
|
||||
|
||||
bool wxRadioBox::IsOwnGtkWindow( GdkWindow *window )
|
||||
{
|
||||
if (window == m_widget->window) return TRUE;
|
||||
if (window == m_widget->window) return TRUE;
|
||||
|
||||
wxNode *node = m_boxes.First();
|
||||
while (node)
|
||||
{
|
||||
GtkWidget *button = GTK_WIDGET( node->Data() );
|
||||
wxNode *node = m_boxes.First();
|
||||
while (node)
|
||||
{
|
||||
GtkWidget *button = GTK_WIDGET( node->Data() );
|
||||
|
||||
if (window == button->window) return TRUE;
|
||||
if (window == button->window) return TRUE;
|
||||
|
||||
node = node->Next();
|
||||
}
|
||||
node = node->Next();
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -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) )
|
||||
|
@ -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;
|
||||
|
||||
dw += 2 * window_class->xthickness;
|
||||
dh += 2 * window_class->ythickness;
|
||||
*/
|
||||
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;
|
||||
|
||||
dw += 2 * window_class->xthickness;
|
||||
dh += 2 * window_class->ythickness;
|
||||
*/
|
||||
if ((m_windowStyle & wxRAISED_BORDER) ||
|
||||
(m_windowStyle & wxSUNKEN_BORDER))
|
||||
{
|
||||
dw += 2 * window_class->xthickness;
|
||||
dh += 2 * window_class->ythickness;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -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;
|
||||
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
172
src/gtk1/pen.cpp
172
src/gtk1/pen.cpp
@ -20,33 +20,33 @@
|
||||
|
||||
class wxPenRefData: public wxObjectRefData
|
||||
{
|
||||
public:
|
||||
public:
|
||||
|
||||
wxPenRefData(void);
|
||||
wxPenRefData(const wxPenRefData& data);
|
||||
wxPenRefData(void);
|
||||
wxPenRefData(const wxPenRefData& data);
|
||||
|
||||
int m_width;
|
||||
int m_style;
|
||||
int m_joinStyle;
|
||||
int m_capStyle;
|
||||
wxColour m_colour;
|
||||
int m_width;
|
||||
int m_style;
|
||||
int m_joinStyle;
|
||||
int m_capStyle;
|
||||
wxColour m_colour;
|
||||
};
|
||||
|
||||
wxPenRefData::wxPenRefData(void)
|
||||
wxPenRefData::wxPenRefData()
|
||||
{
|
||||
m_width = 1;
|
||||
m_style = wxSOLID;
|
||||
m_joinStyle = wxJOIN_ROUND;
|
||||
m_capStyle = wxCAP_ROUND;
|
||||
m_width = 1;
|
||||
m_style = wxSOLID;
|
||||
m_joinStyle = wxJOIN_ROUND;
|
||||
m_capStyle = wxCAP_ROUND;
|
||||
}
|
||||
|
||||
wxPenRefData::wxPenRefData( const wxPenRefData& data )
|
||||
{
|
||||
m_style = data.m_style;
|
||||
m_width = data.m_width;
|
||||
m_joinStyle = data.m_joinStyle;
|
||||
m_capStyle = data.m_capStyle;
|
||||
m_colour = data.m_colour;
|
||||
m_style = data.m_style;
|
||||
m_width = data.m_width;
|
||||
m_joinStyle = data.m_joinStyle;
|
||||
m_capStyle = data.m_capStyle;
|
||||
m_colour = data.m_colour;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -57,162 +57,142 @@ IMPLEMENT_DYNAMIC_CLASS(wxPen,wxGDIObject)
|
||||
|
||||
wxPen::wxPen(void)
|
||||
{
|
||||
if (wxThePenList) wxThePenList->AddPen( this );
|
||||
if (wxThePenList) wxThePenList->AddPen( this );
|
||||
}
|
||||
|
||||
wxPen::wxPen( const wxColour &colour, int width, int style )
|
||||
{
|
||||
m_refData = new wxPenRefData();
|
||||
M_PENDATA->m_width = width;
|
||||
M_PENDATA->m_style = style;
|
||||
M_PENDATA->m_colour = colour;
|
||||
m_refData = new wxPenRefData();
|
||||
M_PENDATA->m_width = width;
|
||||
M_PENDATA->m_style = style;
|
||||
M_PENDATA->m_colour = colour;
|
||||
|
||||
if (wxThePenList) wxThePenList->AddPen( this );
|
||||
if (wxThePenList) wxThePenList->AddPen( this );
|
||||
}
|
||||
|
||||
wxPen::wxPen( const wxPen& pen )
|
||||
{
|
||||
Ref( pen );
|
||||
if (wxThePenList) wxThePenList->AddPen( this );
|
||||
Ref( pen );
|
||||
if (wxThePenList) wxThePenList->AddPen( this );
|
||||
}
|
||||
|
||||
wxPen::wxPen( const wxPen* pen )
|
||||
{
|
||||
UnRef();
|
||||
if (pen) Ref( *pen );
|
||||
UnRef();
|
||||
if (pen) Ref( *pen );
|
||||
|
||||
if (wxThePenList) wxThePenList->AddPen( this );
|
||||
if (wxThePenList) wxThePenList->AddPen( this );
|
||||
}
|
||||
|
||||
wxPen::~wxPen(void)
|
||||
wxPen::~wxPen()
|
||||
{
|
||||
if (wxThePenList) wxThePenList->RemovePen( this );
|
||||
if (wxThePenList) wxThePenList->RemovePen( this );
|
||||
}
|
||||
|
||||
wxPen& wxPen::operator = ( const wxPen& pen )
|
||||
{
|
||||
if (*this == pen) return (*this);
|
||||
Ref( pen );
|
||||
return *this;
|
||||
if (*this == pen) return (*this);
|
||||
Ref( pen );
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool wxPen::operator == ( const wxPen& pen )
|
||||
{
|
||||
return m_refData == pen.m_refData;
|
||||
return m_refData == pen.m_refData;
|
||||
}
|
||||
|
||||
bool wxPen::operator != ( const wxPen& pen )
|
||||
{
|
||||
return m_refData != pen.m_refData;
|
||||
return m_refData != pen.m_refData;
|
||||
}
|
||||
|
||||
void wxPen::SetColour( const wxColour &colour )
|
||||
{
|
||||
Unshare();
|
||||
M_PENDATA->m_colour = colour;
|
||||
Unshare();
|
||||
M_PENDATA->m_colour = colour;
|
||||
}
|
||||
|
||||
void wxPen::SetColour( int red, int green, int blue )
|
||||
{
|
||||
Unshare();
|
||||
M_PENDATA->m_colour.Set( red, green, blue );
|
||||
Unshare();
|
||||
M_PENDATA->m_colour.Set( red, green, blue );
|
||||
}
|
||||
|
||||
void wxPen::SetCap( int capStyle )
|
||||
{
|
||||
Unshare();
|
||||
M_PENDATA->m_capStyle = capStyle;
|
||||
Unshare();
|
||||
M_PENDATA->m_capStyle = capStyle;
|
||||
}
|
||||
|
||||
void wxPen::SetJoin( int joinStyle )
|
||||
{
|
||||
Unshare();
|
||||
M_PENDATA->m_joinStyle = joinStyle;
|
||||
Unshare();
|
||||
M_PENDATA->m_joinStyle = joinStyle;
|
||||
}
|
||||
|
||||
void wxPen::SetStyle( int style )
|
||||
{
|
||||
Unshare();
|
||||
M_PENDATA->m_style = style;
|
||||
Unshare();
|
||||
M_PENDATA->m_style = style;
|
||||
}
|
||||
|
||||
void wxPen::SetWidth( int width )
|
||||
{
|
||||
Unshare();
|
||||
M_PENDATA->m_width = width;
|
||||
Unshare();
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
return M_PENDATA->m_colour;
|
||||
}
|
||||
|
||||
bool wxPen::Ok(void) const
|
||||
bool wxPen::Ok() const
|
||||
{
|
||||
return (m_refData != NULL);
|
||||
return (m_refData != NULL);
|
||||
}
|
||||
|
||||
void wxPen::Unshare(void)
|
||||
void wxPen::Unshare()
|
||||
{
|
||||
if (!m_refData)
|
||||
{
|
||||
m_refData = new wxPenRefData();
|
||||
}
|
||||
else
|
||||
{
|
||||
wxPenRefData* ref = new wxPenRefData( *(wxPenRefData*)m_refData );
|
||||
UnRef();
|
||||
m_refData = ref;
|
||||
}
|
||||
if (!m_refData)
|
||||
{
|
||||
m_refData = new wxPenRefData();
|
||||
}
|
||||
else
|
||||
{
|
||||
wxPenRefData* ref = new wxPenRefData( *(wxPenRefData*)m_refData );
|
||||
UnRef();
|
||||
m_refData = ref;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,23 +29,23 @@ extern bool g_blockEventsOnDrag;
|
||||
|
||||
static void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxRadioBox *rb )
|
||||
{
|
||||
if (!rb->HasVMT()) return;
|
||||
if (g_blockEventsOnDrag) return;
|
||||
if (!rb->HasVMT()) return;
|
||||
if (g_blockEventsOnDrag) return;
|
||||
|
||||
if (rb->m_alreadySent)
|
||||
{
|
||||
rb->m_alreadySent = FALSE;
|
||||
return;
|
||||
}
|
||||
if (rb->m_alreadySent)
|
||||
{
|
||||
rb->m_alreadySent = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
rb->m_alreadySent = TRUE;
|
||||
rb->m_alreadySent = TRUE;
|
||||
|
||||
wxCommandEvent event( wxEVT_COMMAND_RADIOBOX_SELECTED, rb->GetId() );
|
||||
event.SetInt( rb->GetSelection() );
|
||||
wxString tmp( rb->GetStringSelection() );
|
||||
event.SetString( WXSTRINGCAST(tmp) );
|
||||
event.SetEventObject( rb );
|
||||
rb->GetEventHandler()->ProcessEvent(event);
|
||||
wxCommandEvent event( wxEVT_COMMAND_RADIOBOX_SELECTED, rb->GetId() );
|
||||
event.SetInt( rb->GetSelection() );
|
||||
wxString tmp( rb->GetStringSelection() );
|
||||
event.SetString( WXSTRINGCAST(tmp) );
|
||||
event.SetEventObject( rb );
|
||||
rb->GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -55,7 +55,7 @@ static void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxRad
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxRadioBox,wxControl)
|
||||
|
||||
BEGIN_EVENT_TABLE(wxRadioBox, wxControl)
|
||||
EVT_SIZE(wxRadioBox::OnSize)
|
||||
EVT_SIZE(wxRadioBox::OnSize)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
wxRadioBox::wxRadioBox(void)
|
||||
@ -63,127 +63,128 @@ 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 )
|
||||
const wxPoint &pos, const wxSize &size,
|
||||
int n, const wxString choices[],
|
||||
int WXUNUSED(majorDim),
|
||||
long style, const wxValidator& validator,
|
||||
const wxString &name )
|
||||
{
|
||||
m_alreadySent = FALSE;
|
||||
m_needParent = TRUE;
|
||||
m_alreadySent = FALSE;
|
||||
m_needParent = TRUE;
|
||||
|
||||
PreCreation( parent, id, pos, size, style, name );
|
||||
PreCreation( parent, id, pos, size, style, name );
|
||||
|
||||
SetValidator( validator );
|
||||
SetValidator( validator );
|
||||
|
||||
m_widget = gtk_frame_new( title );
|
||||
m_widget = gtk_frame_new( title );
|
||||
|
||||
int x = m_x+5;
|
||||
int y = m_y+15;
|
||||
int maxLen = 0;
|
||||
int height = 20;
|
||||
int width = 0;
|
||||
int x = m_x+5;
|
||||
int y = m_y+15;
|
||||
int maxLen = 0;
|
||||
int height = 20;
|
||||
int width = 0;
|
||||
|
||||
GtkRadioButton *m_radio = (GtkRadioButton*) NULL;
|
||||
GtkRadioButton *m_radio = (GtkRadioButton*) NULL;
|
||||
|
||||
if (m_windowStyle & wxRA_VERTICAL)
|
||||
{
|
||||
GSList *radio_button_group = (GSList *) NULL;
|
||||
for (int i = 0; i < n; i++)
|
||||
if (m_windowStyle & wxRA_VERTICAL)
|
||||
{
|
||||
if (i) radio_button_group = gtk_radio_button_group( GTK_RADIO_BUTTON(m_radio) );
|
||||
GSList *radio_button_group = (GSList *) NULL;
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
if (i) radio_button_group = gtk_radio_button_group( GTK_RADIO_BUTTON(m_radio) );
|
||||
|
||||
m_radio = GTK_RADIO_BUTTON( gtk_radio_button_new_with_label( radio_button_group, choices[i] ) );
|
||||
m_radio = GTK_RADIO_BUTTON( gtk_radio_button_new_with_label( radio_button_group, choices[i] ) );
|
||||
|
||||
m_boxes.Append( (wxObject*) m_radio );
|
||||
m_boxes.Append( (wxObject*) m_radio );
|
||||
|
||||
ConnectWidget( GTK_WIDGET(m_radio) );
|
||||
ConnectWidget( GTK_WIDGET(m_radio) );
|
||||
|
||||
if (!i) gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_radio), TRUE );
|
||||
if (!i) gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_radio), TRUE );
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(m_radio), "clicked",
|
||||
GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
|
||||
gtk_signal_connect( GTK_OBJECT(m_radio), "clicked",
|
||||
GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
|
||||
|
||||
gtk_myfixed_put( GTK_MYFIXED(m_parent->m_wxwindow), GTK_WIDGET(m_radio), x, y );
|
||||
gtk_myfixed_put( GTK_MYFIXED(m_parent->m_wxwindow), GTK_WIDGET(m_radio), x, y );
|
||||
|
||||
int tmp = 25+gdk_string_measure( GTK_WIDGET(m_radio)->style->font, choices[i] );
|
||||
if (tmp > maxLen) maxLen = tmp;
|
||||
int tmp = 25+gdk_string_measure( GTK_WIDGET(m_radio)->style->font, choices[i] );
|
||||
if (tmp > maxLen) maxLen = tmp;
|
||||
|
||||
width = m_width-10;
|
||||
if (size.x == -1) width = tmp;
|
||||
gtk_widget_set_usize( GTK_WIDGET(m_radio), width, 20 );
|
||||
|
||||
y += 20;
|
||||
height += 20;
|
||||
width = m_width-10;
|
||||
if (size.x == -1) width = tmp;
|
||||
gtk_widget_set_usize( GTK_WIDGET(m_radio), width, 20 );
|
||||
|
||||
y += 20;
|
||||
height += 20;
|
||||
}
|
||||
width = maxLen + 10;
|
||||
}
|
||||
width = maxLen + 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
int max = 0;
|
||||
for (int i = 0; i < n; i++)
|
||||
else
|
||||
{
|
||||
GdkFont *font = m_widget->style->font;
|
||||
int len = 27+gdk_string_measure( font, choices[i] );
|
||||
if (len > max) max = len;
|
||||
}
|
||||
int max = 0;
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
GdkFont *font = m_widget->style->font;
|
||||
int len = 27+gdk_string_measure( font, choices[i] );
|
||||
if (len > max) max = len;
|
||||
}
|
||||
|
||||
GSList *radio_button_group = (GSList *) NULL;
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
if (i) radio_button_group = gtk_radio_button_group( GTK_RADIO_BUTTON(m_radio) );
|
||||
GSList *radio_button_group = (GSList *) NULL;
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
if (i) radio_button_group = gtk_radio_button_group( GTK_RADIO_BUTTON(m_radio) );
|
||||
|
||||
m_radio = GTK_RADIO_BUTTON( gtk_radio_button_new_with_label( radio_button_group, choices[i] ) );
|
||||
m_radio = GTK_RADIO_BUTTON( gtk_radio_button_new_with_label( radio_button_group, choices[i] ) );
|
||||
|
||||
m_boxes.Append( (wxObject*) m_radio );
|
||||
m_boxes.Append( (wxObject*) m_radio );
|
||||
|
||||
ConnectWidget( GTK_WIDGET(m_radio) );
|
||||
ConnectWidget( GTK_WIDGET(m_radio) );
|
||||
|
||||
if (!i) gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_radio), TRUE );
|
||||
if (!i) gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_radio), TRUE );
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(m_radio), "clicked",
|
||||
GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
|
||||
gtk_signal_connect( GTK_OBJECT(m_radio), "clicked",
|
||||
GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
|
||||
|
||||
gtk_myfixed_put( GTK_MYFIXED(m_parent->m_wxwindow), GTK_WIDGET(m_radio), x, y );
|
||||
gtk_myfixed_put( GTK_MYFIXED(m_parent->m_wxwindow), GTK_WIDGET(m_radio), x, y );
|
||||
|
||||
gtk_widget_set_usize( GTK_WIDGET(m_radio), max, 20 );
|
||||
gtk_widget_set_usize( GTK_WIDGET(m_radio), max, 20 );
|
||||
|
||||
x += max;
|
||||
x += max;
|
||||
}
|
||||
|
||||
width = max*n + 10;
|
||||
height = 40;
|
||||
}
|
||||
|
||||
width = max*n + 10;
|
||||
height = 40;
|
||||
}
|
||||
|
||||
wxSize newSize = size;
|
||||
if (newSize.x == -1) newSize.x = width;
|
||||
if (newSize.y == -1) newSize.y = height;
|
||||
SetSize( newSize.x, newSize.y );
|
||||
wxSize newSize = size;
|
||||
if (newSize.x == -1) newSize.x = width;
|
||||
if (newSize.y == -1) newSize.y = height;
|
||||
SetSize( newSize.x, newSize.y );
|
||||
|
||||
m_parent->AddChild( this );
|
||||
m_parent->AddChild( this );
|
||||
|
||||
(m_parent->m_insertCallback)( m_parent, this );
|
||||
(m_parent->m_insertCallback)( m_parent, this );
|
||||
|
||||
PostCreation();
|
||||
PostCreation();
|
||||
|
||||
SetLabel( title );
|
||||
SetLabel( title );
|
||||
|
||||
SetBackgroundColour( parent->GetBackgroundColour() );
|
||||
SetForegroundColour( parent->GetForegroundColour() );
|
||||
SetBackgroundColour( parent->GetBackgroundColour() );
|
||||
SetForegroundColour( parent->GetForegroundColour() );
|
||||
|
||||
Show( TRUE );
|
||||
Show( TRUE );
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
wxRadioBox::~wxRadioBox(void)
|
||||
{
|
||||
wxNode *node = m_boxes.First();
|
||||
while (node)
|
||||
{
|
||||
GtkWidget *button = GTK_WIDGET( node->Data() );
|
||||
gtk_widget_destroy( button );
|
||||
node = node->Next();
|
||||
}
|
||||
wxNode *node = m_boxes.First();
|
||||
while (node)
|
||||
{
|
||||
GtkWidget *button = GTK_WIDGET( node->Data() );
|
||||
gtk_widget_destroy( button );
|
||||
node = node->Next();
|
||||
}
|
||||
}
|
||||
|
||||
void wxRadioBox::OnSize( wxSizeEvent &event )
|
||||
@ -243,260 +244,249 @@ void wxRadioBox::OnSize( wxSizeEvent &event )
|
||||
|
||||
bool wxRadioBox::Show( bool show )
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, FALSE, "invalid radiobox" );
|
||||
wxCHECK_MSG( m_widget != NULL, FALSE, "invalid radiobox" );
|
||||
|
||||
wxWindow::Show( show );
|
||||
wxWindow::Show( show );
|
||||
|
||||
wxNode *node = m_boxes.First();
|
||||
while (node)
|
||||
{
|
||||
GtkWidget *button = GTK_WIDGET( node->Data() );
|
||||
wxNode *node = m_boxes.First();
|
||||
while (node)
|
||||
{
|
||||
GtkWidget *button = GTK_WIDGET( node->Data() );
|
||||
|
||||
if (show) gtk_widget_show( button ); else gtk_widget_hide( button );
|
||||
if (show) gtk_widget_show( button ); else gtk_widget_hide( button );
|
||||
|
||||
node = node->Next();
|
||||
}
|
||||
node = node->Next();
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int wxRadioBox::FindString( const wxString &s ) const
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, -1, "invalid radiobox" );
|
||||
wxCHECK_MSG( m_widget != NULL, -1, "invalid radiobox" );
|
||||
|
||||
int count = 0;
|
||||
int count = 0;
|
||||
|
||||
wxNode *node = m_boxes.First();
|
||||
while (node)
|
||||
{
|
||||
GtkButton *button = GTK_BUTTON( node->Data() );
|
||||
wxNode *node = m_boxes.First();
|
||||
while (node)
|
||||
{
|
||||
GtkButton *button = GTK_BUTTON( node->Data() );
|
||||
|
||||
GtkLabel *label = GTK_LABEL( button->child );
|
||||
if (s == label->label) return count;
|
||||
count++;
|
||||
GtkLabel *label = GTK_LABEL( button->child );
|
||||
if (s == label->label) return count;
|
||||
count++;
|
||||
|
||||
node = node->Next();
|
||||
}
|
||||
node = node->Next();
|
||||
}
|
||||
|
||||
return -1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
void wxRadioBox::SetSelection( int n )
|
||||
{
|
||||
wxCHECK_RET( m_widget != NULL, "invalid radiobox" );
|
||||
wxCHECK_RET( m_widget != NULL, "invalid radiobox" );
|
||||
|
||||
wxNode *node = m_boxes.Nth( 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() );
|
||||
GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->Data() );
|
||||
|
||||
gtk_toggle_button_set_state( button, 1 );
|
||||
gtk_toggle_button_set_state( button, 1 );
|
||||
}
|
||||
|
||||
int wxRadioBox::GetSelection(void) const
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, -1, "invalid radiobox" );
|
||||
wxCHECK_MSG( m_widget != NULL, -1, "invalid radiobox" );
|
||||
|
||||
int count = 0;
|
||||
int count = 0;
|
||||
|
||||
wxNode *node = m_boxes.First();
|
||||
while (node)
|
||||
{
|
||||
GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->Data() );
|
||||
if (button->active) return count;
|
||||
count++;
|
||||
node = node->Next();
|
||||
}
|
||||
wxNode *node = m_boxes.First();
|
||||
while (node)
|
||||
{
|
||||
GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->Data() );
|
||||
if (button->active) return count;
|
||||
count++;
|
||||
node = node->Next();
|
||||
}
|
||||
|
||||
wxFAIL_MSG( "wxRadioBox none selected" );
|
||||
wxFAIL_MSG( "wxRadioBox none selected" );
|
||||
|
||||
return -1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
wxString wxRadioBox::GetString( int n ) const
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, "", "invalid radiobox" );
|
||||
wxCHECK_MSG( m_widget != NULL, "", "invalid radiobox" );
|
||||
|
||||
wxNode *node = m_boxes.Nth( n );
|
||||
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 );
|
||||
GtkButton *button = GTK_BUTTON( node->Data() );
|
||||
GtkLabel *label = GTK_LABEL( button->child );
|
||||
|
||||
return wxString( label->label );
|
||||
return wxString( label->label );
|
||||
}
|
||||
|
||||
wxString wxRadioBox::GetLabel( int item ) const
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, "", "invalid radiobox" );
|
||||
wxCHECK_MSG( m_widget != NULL, "", "invalid radiobox" );
|
||||
|
||||
return GetString( item );
|
||||
return GetString( item );
|
||||
}
|
||||
|
||||
void wxRadioBox::SetLabel( const wxString& label )
|
||||
{
|
||||
wxCHECK_RET( m_widget != NULL, "invalid radiobox" );
|
||||
wxCHECK_RET( m_widget != NULL, "invalid radiobox" );
|
||||
|
||||
wxControl::SetLabel( label );
|
||||
wxControl::SetLabel( label );
|
||||
|
||||
gtk_frame_set_label( GTK_FRAME(m_widget), wxControl::GetLabel() );
|
||||
gtk_frame_set_label( GTK_FRAME(m_widget), wxControl::GetLabel() );
|
||||
}
|
||||
|
||||
void wxRadioBox::SetLabel( int item, const wxString& label )
|
||||
{
|
||||
wxCHECK_RET( m_widget != NULL, "invalid radiobox" );
|
||||
wxCHECK_RET( m_widget != NULL, "invalid radiobox" );
|
||||
|
||||
wxNode *node = m_boxes.Nth( item );
|
||||
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 );
|
||||
GtkButton *button = GTK_BUTTON( node->Data() );
|
||||
GtkLabel *g_label = GTK_LABEL( button->child );
|
||||
|
||||
gtk_label_set( g_label, label );
|
||||
gtk_label_set( g_label, label );
|
||||
}
|
||||
|
||||
void wxRadioBox::SetLabel( int WXUNUSED(item), wxBitmap *WXUNUSED(bitmap) )
|
||||
{
|
||||
wxFAIL_MSG("wxRadioBox::SetLabel not implemented.");
|
||||
wxFAIL_MSG("wxRadioBox::SetLabel not implemented.");
|
||||
}
|
||||
|
||||
void wxRadioBox::Enable( bool enable )
|
||||
{
|
||||
wxControl::Enable( enable );
|
||||
wxControl::Enable( enable );
|
||||
|
||||
wxNode *node = m_boxes.First();
|
||||
while (node)
|
||||
{
|
||||
GtkButton *button = GTK_BUTTON( node->Data() );
|
||||
GtkWidget *label = button->child;
|
||||
gtk_widget_set_sensitive( GTK_WIDGET(button), enable );
|
||||
gtk_widget_set_sensitive( label, enable );
|
||||
node = node->Next();
|
||||
}
|
||||
wxNode *node = m_boxes.First();
|
||||
while (node)
|
||||
{
|
||||
GtkButton *button = GTK_BUTTON( node->Data() );
|
||||
GtkWidget *label = button->child;
|
||||
gtk_widget_set_sensitive( GTK_WIDGET(button), enable );
|
||||
gtk_widget_set_sensitive( label, enable );
|
||||
node = node->Next();
|
||||
}
|
||||
}
|
||||
|
||||
void wxRadioBox::Enable( int item, bool enable )
|
||||
{
|
||||
wxNode *node = m_boxes.Nth( item );
|
||||
wxCHECK_RET( m_widget != NULL, "invalid radiobox" );
|
||||
|
||||
if (!node)
|
||||
{
|
||||
wxFAIL_MSG( "wxRadioBox wrong index" );
|
||||
return;
|
||||
}
|
||||
wxNode *node = m_boxes.Nth( item );
|
||||
|
||||
GtkButton *button = GTK_BUTTON( node->Data() );
|
||||
GtkWidget *label = button->child;
|
||||
gtk_widget_set_sensitive( GTK_WIDGET(button), enable );
|
||||
gtk_widget_set_sensitive( label, enable );
|
||||
wxCHECK_RET( node, "radiobox wrong index" );
|
||||
|
||||
GtkButton *button = GTK_BUTTON( node->Data() );
|
||||
GtkWidget *label = button->child;
|
||||
gtk_widget_set_sensitive( GTK_WIDGET(button), enable );
|
||||
gtk_widget_set_sensitive( label, enable );
|
||||
}
|
||||
|
||||
void wxRadioBox::Show( int item, bool show )
|
||||
{
|
||||
wxNode *node = m_boxes.Nth( item );
|
||||
wxCHECK_RET( m_widget != NULL, "invalid radiobox" );
|
||||
|
||||
if (!node)
|
||||
{
|
||||
wxFAIL_MSG( "wxRadioBox wrong index" );
|
||||
return;
|
||||
}
|
||||
wxNode *node = m_boxes.Nth( item );
|
||||
|
||||
GtkWidget *button = GTK_WIDGET( node->Data() );
|
||||
wxCHECK_RET( node, "radiobox wrong index" );
|
||||
|
||||
GtkWidget *button = GTK_WIDGET( node->Data() );
|
||||
|
||||
if (show)
|
||||
gtk_widget_show( button );
|
||||
else
|
||||
gtk_widget_hide( button );
|
||||
if (show)
|
||||
gtk_widget_show( button );
|
||||
else
|
||||
gtk_widget_hide( button );
|
||||
}
|
||||
|
||||
wxString wxRadioBox::GetStringSelection(void) const
|
||||
{
|
||||
wxNode *node = m_boxes.First();
|
||||
while (node)
|
||||
{
|
||||
GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->Data() );
|
||||
if (button->active)
|
||||
{
|
||||
GtkLabel *label = GTK_LABEL( GTK_BUTTON(button)->child );
|
||||
return label->label;
|
||||
}
|
||||
node = node->Next();
|
||||
}
|
||||
wxCHECK_MSG( m_widget != NULL, "", "invalid radiobox" );
|
||||
|
||||
wxFAIL_MSG( "wxRadioBox none selected" );
|
||||
return "";
|
||||
wxNode *node = m_boxes.First();
|
||||
while (node)
|
||||
{
|
||||
GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->Data() );
|
||||
if (button->active)
|
||||
{
|
||||
GtkLabel *label = GTK_LABEL( GTK_BUTTON(button)->child );
|
||||
return label->label;
|
||||
}
|
||||
node = node->Next();
|
||||
}
|
||||
|
||||
wxFAIL_MSG( "wxRadioBox none selected" );
|
||||
return "";
|
||||
}
|
||||
|
||||
bool wxRadioBox::SetStringSelection( const wxString&s )
|
||||
bool wxRadioBox::SetStringSelection( const wxString &s )
|
||||
{
|
||||
int res = FindString( s );
|
||||
if (res == -1) return FALSE;
|
||||
SetSelection( res );
|
||||
return TRUE;
|
||||
wxCHECK_MSG( m_widget != NULL, FALSE, "invalid radiobox" );
|
||||
|
||||
int res = FindString( s );
|
||||
if (res == -1) return FALSE;
|
||||
SetSelection( res );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int wxRadioBox::Number(void) const
|
||||
{
|
||||
return m_boxes.Number();
|
||||
return m_boxes.Number();
|
||||
}
|
||||
|
||||
int wxRadioBox::GetNumberOfRowsOrCols(void) const
|
||||
{
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void wxRadioBox::SetNumberOfRowsOrCols( int WXUNUSED(n) )
|
||||
{
|
||||
wxFAIL_MSG("wxRadioBox::SetNumberOfRowsOrCols not implemented.");
|
||||
wxFAIL_MSG("wxRadioBox::SetNumberOfRowsOrCols not implemented.");
|
||||
}
|
||||
|
||||
void wxRadioBox::ApplyWidgetStyle()
|
||||
{
|
||||
SetWidgetStyle();
|
||||
SetWidgetStyle();
|
||||
|
||||
gtk_widget_set_style( m_widget, m_widgetStyle );
|
||||
gtk_widget_set_style( m_widget, m_widgetStyle );
|
||||
|
||||
wxNode *node = m_boxes.First();
|
||||
while (node)
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET( node->Data() );
|
||||
gtk_widget_set_style( widget, m_widgetStyle );
|
||||
wxNode *node = m_boxes.First();
|
||||
while (node)
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET( node->Data() );
|
||||
gtk_widget_set_style( widget, m_widgetStyle );
|
||||
|
||||
GtkButton *button = GTK_BUTTON( node->Data() );
|
||||
gtk_widget_set_style( button->child, m_widgetStyle );
|
||||
GtkButton *button = GTK_BUTTON( node->Data() );
|
||||
gtk_widget_set_style( button->child, m_widgetStyle );
|
||||
|
||||
node = node->Next();
|
||||
}
|
||||
node = node->Next();
|
||||
}
|
||||
}
|
||||
|
||||
bool wxRadioBox::IsOwnGtkWindow( GdkWindow *window )
|
||||
{
|
||||
if (window == m_widget->window) return TRUE;
|
||||
if (window == m_widget->window) return TRUE;
|
||||
|
||||
wxNode *node = m_boxes.First();
|
||||
while (node)
|
||||
{
|
||||
GtkWidget *button = GTK_WIDGET( node->Data() );
|
||||
wxNode *node = m_boxes.First();
|
||||
while (node)
|
||||
{
|
||||
GtkWidget *button = GTK_WIDGET( node->Data() );
|
||||
|
||||
if (window == button->window) return TRUE;
|
||||
if (window == button->window) return TRUE;
|
||||
|
||||
node = node->Next();
|
||||
}
|
||||
node = node->Next();
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -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) )
|
||||
|
@ -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;
|
||||
|
||||
dw += 2 * window_class->xthickness;
|
||||
dh += 2 * window_class->ythickness;
|
||||
*/
|
||||
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;
|
||||
|
||||
dw += 2 * window_class->xthickness;
|
||||
dh += 2 * window_class->ythickness;
|
||||
*/
|
||||
if ((m_windowStyle & wxRAISED_BORDER) ||
|
||||
(m_windowStyle & wxSUNKEN_BORDER))
|
||||
{
|
||||
dw += 2 * window_class->xthickness;
|
||||
dh += 2 * window_class->ythickness;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user