Same as last one..

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
1998-05-30 17:11:51 +00:00
parent 1c005ff76d
commit 7f4dc78d35
15 changed files with 844 additions and 24 deletions

View File

@@ -18,7 +18,6 @@
#include "wx/defs.h"
#include "wx/object.h"
#include "wx/list.h"
#include "wx/control.h"
//-----------------------------------------------------------------------------
@@ -27,8 +26,78 @@
class wxComboBox;
//-----------------------------------------------------------------------------
// global data
//-----------------------------------------------------------------------------
extern const char* wxComboBoxNameStr;
extern const char* wxEmptyString;
//-----------------------------------------------------------------------------
// wxComboBox
//-----------------------------------------------------------------------------
class wxComboBox: public wxControl
{
DECLARE_DYNAMIC_CLASS(wxComboBox)
public:
inline wxComboBox(void) {}
inline wxComboBox(wxWindow *parent, const wxWindowID id,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
const int n = 0, const wxString choices[] = NULL,
const long style = 0,
const wxString& name = wxComboBoxNameStr)
{
Create(parent, id, value, pos, size, n, choices, style, name);
}
bool Create(wxWindow *parent, const wxWindowID id,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
const int n = 0, const wxString choices[] = NULL,
const long style = 0,
const wxString& name = wxComboBoxNameStr);
// List functions
void Clear(void);
void Append( const wxString &item );
void Append( const wxString &item, char* clientData );
void Delete( const int n );
int FindString( const wxString &item );
char* GetClientData( const int n );
void SetClientData( const int n, char * clientData );
int GetSelection(void) const;
wxString GetString( const int n ) const;
wxString GetStringSelection(void) const;
int Number(void) const;
void SetSelection( const int n, const bool select = TRUE );
// Text field functions
wxString GetValue(void) const ;
void SetValue(const wxString& value);
// Clipboard operations
void Copy(void);
void Cut(void);
void Paste(void);
void SetInsertionPoint(const long pos);
void SetInsertionPointEnd(void);
long GetInsertionPoint(void) const ;
long GetLastPosition(void) const ;
void Replace(const long from, const long to, const wxString& value);
void Remove(const long from, const long to);
void SetSelection(const long from, const long to);
void SetEditable(const bool editable);
private:
wxList m_clientData;
};
#endif // __GTKCOMBOBOXH__

View File

@@ -18,7 +18,6 @@
#include "wx/defs.h"
#include "wx/object.h"
#include "wx/list.h"
#include "wx/control.h"
//-----------------------------------------------------------------------------
@@ -27,8 +26,78 @@
class wxComboBox;
//-----------------------------------------------------------------------------
// global data
//-----------------------------------------------------------------------------
extern const char* wxComboBoxNameStr;
extern const char* wxEmptyString;
//-----------------------------------------------------------------------------
// wxComboBox
//-----------------------------------------------------------------------------
class wxComboBox: public wxControl
{
DECLARE_DYNAMIC_CLASS(wxComboBox)
public:
inline wxComboBox(void) {}
inline wxComboBox(wxWindow *parent, const wxWindowID id,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
const int n = 0, const wxString choices[] = NULL,
const long style = 0,
const wxString& name = wxComboBoxNameStr)
{
Create(parent, id, value, pos, size, n, choices, style, name);
}
bool Create(wxWindow *parent, const wxWindowID id,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
const int n = 0, const wxString choices[] = NULL,
const long style = 0,
const wxString& name = wxComboBoxNameStr);
// List functions
void Clear(void);
void Append( const wxString &item );
void Append( const wxString &item, char* clientData );
void Delete( const int n );
int FindString( const wxString &item );
char* GetClientData( const int n );
void SetClientData( const int n, char * clientData );
int GetSelection(void) const;
wxString GetString( const int n ) const;
wxString GetStringSelection(void) const;
int Number(void) const;
void SetSelection( const int n, const bool select = TRUE );
// Text field functions
wxString GetValue(void) const ;
void SetValue(const wxString& value);
// Clipboard operations
void Copy(void);
void Cut(void);
void Paste(void);
void SetInsertionPoint(const long pos);
void SetInsertionPointEnd(void);
long GetInsertionPoint(void) const ;
long GetLastPosition(void) const ;
void Replace(const long from, const long to, const wxString& value);
void Remove(const long from, const long to);
void SetSelection(const long from, const long to);
void SetEditable(const bool editable);
private:
wxList m_clientData;
};
#endif // __GTKCOMBOBOXH__

View File

@@ -141,8 +141,10 @@ class WXDLLEXPORT wxTabEvent: public wxCommandEvent
typedef void (wxEvtHandler::*wxTabEventFunction)(wxTabEvent&);
#define EVT_TAB_SEL_CHANGED(id, fn) { wxEVT_COMMAND_TAB_SEL_CHANGED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTabEventFunction) & fn },
#define EVT_TAB_SEL_CHANGING(id, fn) { wxEVT_COMMAND_TAB_SEL_CHANGING, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTabEventFunction) & fn },
#define EVT_TAB_SEL_CHANGED(id, fn) { wxEVT_COMMAND_TAB_SEL_CHANGED, \
id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTabEventFunction) & fn, NULL },
#define EVT_TAB_SEL_CHANGING(id, fn) { wxEVT_COMMAND_TAB_SEL_CHANGING, \
id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTabEventFunction) & fn, NULL },
#endif
// __TABCTRLH__

View File

@@ -20,8 +20,8 @@ NONE =
# define library name
LIB_TARGET=wx_gtk
LIB_MAJOR=0
LIB_MINOR=12
LIB_MAJOR=1
LIB_MINOR=90
# define library sources
@@ -93,6 +93,7 @@ LIB_CPP_SRC=\
gtk/statbox.cpp \
gtk/statbmp.cpp \
gtk/stattext.cpp \
gtk/tabctrl.cpp \
gtk/tbargtk.cpp \
gtk/textctrl.cpp \
gtk/timer.cpp \

View File

@@ -269,6 +269,7 @@ wxEvtHandler::~wxEvtHandler(void)
while (node)
{
wxEventTableEntry *entry = (wxEventTableEntry*)node->Data();
if (entry->m_callbackUserData) delete entry->m_callbackUserData;
delete entry;
node = node->Next();
}

View File

@@ -282,7 +282,7 @@ int wxEntry( int argc, char *argv[] )
// main()
//-----------------------------------------------------------------------------
#if defined(AIX) || defined(AIX4) /* || defined(____HPUX__) */
#if defined(AIX) || defined(AIX4) || defined(____HPUX__)
// main in IMPLEMENT_WX_MAIN in IMPLEMENT_APP in app.h

View File

@@ -32,7 +32,7 @@ void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), gpointer data )
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxChoice,wxWindow)
IMPLEMENT_DYNAMIC_CLASS(wxChoice,wxControl)
wxChoice::wxChoice(void)
{

329
src/gtk/tabctrl.cpp Normal file
View File

@@ -0,0 +1,329 @@
/////////////////////////////////////////////////////////////////////////////
// Name: tabctrl.cpp
// Purpose:
// Author: Robert Roebling
// Created: 01/02/97
// Id:
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "tabctrl.h"
#endif
#include "wx/tabctrl.h"
#include "wx/utils.h"
#include "wx/imaglist.h"
#include "wx/gtk/win_gtk.h"
//-----------------------------------------------------------------------------
// wxTabPage
//-----------------------------------------------------------------------------
class wxTabPage: public wxObject
{
public:
int m_id;
wxString m_text;
int m_image;
void *m_clientData;
GtkNotebookPage *m_page;
GtkWidget *m_wxwindow;
wxList m_children;
wxTabPage(void)
{
m_id = -1;
m_text = "";
m_image = -1;
m_clientData = NULL;
m_page = NULL;
m_wxwindow = NULL;
};
};
//-----------------------------------------------------------------------------
// wxTabCtrl
//-----------------------------------------------------------------------------
BEGIN_EVENT_TABLE(wxTabCtrl, wxControl)
END_EVENT_TABLE()
IMPLEMENT_DYNAMIC_CLASS(wxTabCtrl,wxControl)
wxTabCtrl::wxTabCtrl(void)
{
m_imageList = NULL;
m_pages.DeleteContents( TRUE );
};
wxTabCtrl::wxTabCtrl( wxWindow *parent, const wxWindowID id,
const wxPoint& pos, const wxSize& size,
const long style, const wxString& name )
{
m_imageList = NULL;
m_pages.DeleteContents( TRUE );
Create( parent, id, pos, size, style, name );
};
wxTabCtrl::~wxTabCtrl(void)
{
if (m_imageList) delete m_imageList;
DeleteAllItems();
};
bool wxTabCtrl::Create(wxWindow *parent, const wxWindowID id,
const wxPoint& pos, const wxSize& size,
const long style, const wxString& name )
{
m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name );
m_widget = gtk_notebook_new();
PostCreation();
Show( TRUE );
return TRUE;
};
int wxTabCtrl::GetSelection(void) const
{
return gtk_notebook_current_page( GTK_NOTEBOOK(m_widget) );
};
wxImageList* wxTabCtrl::GetImageList(void) const
{
return m_imageList;
};
int wxTabCtrl::GetItemCount(void) const
{
return m_pages.Number();
};
bool wxTabCtrl::GetItemRect( const int WXUNUSED(item), wxRect& WXUNUSED(rect) ) const
{
return FALSE;
};
int wxTabCtrl::GetRowCount(void) const
{
return 1;
};
wxString wxTabCtrl::GetItemText( const int item ) const
{
wxNode *node = m_pages.Nth( item );
if (node)
{
wxTabPage *page = (wxTabPage*)node->Data();
return page->m_text;
};
return "";
};
int wxTabCtrl::GetItemImage( const int item ) const
{
wxNode *node = m_pages.Nth( item );
if (node)
{
wxTabPage *page = (wxTabPage*)node->Data();
return page->m_image;
};
return -1;
};
void* wxTabCtrl::GetItemData( const int item ) const
{
wxNode *node = m_pages.Nth( item );
if (node)
{
wxTabPage *page = (wxTabPage*)node->Data();
return page->m_clientData;
};
return NULL;
};
int wxTabCtrl::SetSelection( const int item )
{
wxTabPage *page = NULL;
wxNode *node = m_pages.First();
while (node)
{
page = (wxTabPage*)node->Data();
if (page->m_id == item) break;
page = NULL;
node = node->Next();
};
if (!page) return -1;
int page_num = 0;
GList *child = GTK_NOTEBOOK(m_widget)->children;
while (child)
{
if (page->m_page == (GtkNotebookPage*)child->data) break;
page_num++;
child = child->next;
};
if (!child) return -1;
gtk_notebook_set_page( GTK_NOTEBOOK(m_widget), page_num );
return item;
};
void wxTabCtrl::SetImageList( wxImageList* imageList )
{
m_imageList = imageList;
};
bool wxTabCtrl::SetItemText( const int WXUNUSED(item), const wxString& WXUNUSED(text) )
{
return TRUE;
};
bool wxTabCtrl::SetItemImage( const int WXUNUSED(item), const int WXUNUSED(image) )
{
return TRUE;
};
bool wxTabCtrl::SetItemData( const int WXUNUSED(item), void* WXUNUSED(data) )
{
return TRUE;
};
void wxTabCtrl::SetItemSize( const wxSize &WXUNUSED(size) )
{
};
void wxTabCtrl::SetPadding( const wxSize &WXUNUSED(padding) )
{
};
bool wxTabCtrl::DeleteAllItems(void)
{
wxNode *page_node = m_pages.First();
while (page_node)
{
wxTabPage *page = (wxTabPage*)page_node->Data();
wxNode *node = page->m_children.First();
while (node)
{
wxWindow *child = (wxWindow*)node->Data();
delete child;
node = node->Next();
};
gtk_widget_destroy( page->m_wxwindow );
m_pages.DeleteObject( page );
page_node = m_pages.First();
};
return TRUE;
};
bool wxTabCtrl::DeleteItem( const int item )
{
wxTabPage *page = NULL;
wxNode *node = m_pages.First();
while (node)
{
page = (wxTabPage*)node->Data();
if (page->m_id == item) break;
node = node->Next();
};
if (!node) return FALSE;
node = page->m_children.First();
while (node)
{
wxWindow *child = (wxWindow*)node->Data();
delete child;
node = node->Next();
};
gtk_widget_destroy( page->m_wxwindow );
m_pages.DeleteObject( page );
return TRUE;
};
int wxTabCtrl::HitTest( const wxPoint &WXUNUSED(pt), long &WXUNUSED(flags) )
{
return wxTAB_HITTEST_NOWHERE;
};
int wxTabCtrl::InsertItem( const int item, const wxString &text, const int imageId, void* data )
{
wxTabPage *page = new wxTabPage;
page->m_text = text;
if (page->m_text.IsNull()) page->m_text = "";
page->m_id = item;
page->m_image = imageId;
page->m_clientData = data;
GtkWidget *label_widget = gtk_label_new( page->m_text );
gtk_misc_set_alignment( GTK_MISC(label_widget), 0.0, 0.5 );
page->m_wxwindow = gtk_myfixed_new();
gtk_widget_show( page->m_wxwindow );
gtk_widget_set_usize( page->m_wxwindow, 100, 100 );
gtk_notebook_append_page( GTK_NOTEBOOK(m_widget), page->m_wxwindow, label_widget );
page->m_page = GTK_NOTEBOOK(m_widget)->cur_page;
m_pages.Append( page );
return item;
};
void wxTabCtrl::AddChild( wxWindow *win )
{
GtkNotebookPage *g_page = GTK_NOTEBOOK(m_widget)->cur_page;
wxTabPage *page = NULL;
wxNode *node = m_pages.First();
while (node)
{
page = (wxTabPage*)node->Data();
if (page->m_page == g_page) break;
node = node->Next();
};
if (!page) wxFatalError( "wxTabCtrl error" );
gtk_myfixed_put( GTK_MYFIXED(page->m_wxwindow), win->m_widget, win->m_x, win->m_y );
gtk_widget_set_usize( win->m_widget, win->m_width, win->m_height );
page->m_children.Append( win );
};
//-----------------------------------------------------------------------------
// wxTabEvent
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxTabEvent, wxCommandEvent)
wxTabEvent::wxTabEvent( WXTYPE commandType, int id ) :
wxCommandEvent(commandType, id)
{
};

View File

@@ -50,12 +50,6 @@ bool wxTextCtrl::Create( wxWindow *parent, const wxWindowID id, const wxString &
else
m_widget = gtk_entry_new();
if (!value.IsNull())
{
gint tmp = 0;
gtk_editable_insert_text( GTK_EDITABLE(m_widget), value, value.Length(), &tmp );
};
wxSize newSize = size;
if (newSize.x == -1) newSize.x = 80;
if (newSize.y == -1) newSize.y = 26;
@@ -63,6 +57,12 @@ bool wxTextCtrl::Create( wxWindow *parent, const wxWindowID id, const wxString &
PostCreation();
if (!value.IsNull())
{
gint tmp = 0;
gtk_editable_insert_text( GTK_EDITABLE(m_widget), value, value.Length(), &tmp );
};
Show( TRUE );
return TRUE;
@@ -103,9 +103,10 @@ void wxTextCtrl::SetValue( const wxString &value )
void wxTextCtrl::WriteText( const wxString &text )
{
if (text.IsNull()) return;
if (m_windowStyle & wxTE_MULTILINE)
{
gint len = gtk_text_get_length( GTK_TEXT(m_widget) );
gint len = gtk_text_get_length( GTK_TEXT(m_widget) ) - 1;
gtk_editable_insert_text( GTK_EDITABLE(m_widget), text, text.Length(), &len );
}
else

View File

@@ -25,6 +25,7 @@
#include "wx/dcclient.h"
#include "wx/dnd.h"
#include "wx/mdi.h"
#include "wx/tabctrl.h"
#include "gdk/gdkkeysyms.h"
#include <math.h>
#include "wx/gtk/win_gtk.h"
@@ -1413,6 +1414,14 @@ void wxWindow::AddChild( wxWindow *child )
};
};
};
if (IsKindOf(CLASSINFO(wxTabCtrl)))
{
wxTabCtrl *tab = (wxTabCtrl*)this;
tab->AddChild( child );
return;
};
m_children.Append( child );
if (child->IsKindOf(CLASSINFO(wxFrame)) || child->IsKindOf(CLASSINFO(wxDialog)))
{

View File

@@ -282,7 +282,7 @@ int wxEntry( int argc, char *argv[] )
// main()
//-----------------------------------------------------------------------------
#if defined(AIX) || defined(AIX4) /* || defined(____HPUX__) */
#if defined(AIX) || defined(AIX4) || defined(____HPUX__)
// main in IMPLEMENT_WX_MAIN in IMPLEMENT_APP in app.h

View File

@@ -32,7 +32,7 @@ void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), gpointer data )
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxChoice,wxWindow)
IMPLEMENT_DYNAMIC_CLASS(wxChoice,wxControl)
wxChoice::wxChoice(void)
{

329
src/gtk1/tabctrl.cpp Normal file
View File

@@ -0,0 +1,329 @@
/////////////////////////////////////////////////////////////////////////////
// Name: tabctrl.cpp
// Purpose:
// Author: Robert Roebling
// Created: 01/02/97
// Id:
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "tabctrl.h"
#endif
#include "wx/tabctrl.h"
#include "wx/utils.h"
#include "wx/imaglist.h"
#include "wx/gtk/win_gtk.h"
//-----------------------------------------------------------------------------
// wxTabPage
//-----------------------------------------------------------------------------
class wxTabPage: public wxObject
{
public:
int m_id;
wxString m_text;
int m_image;
void *m_clientData;
GtkNotebookPage *m_page;
GtkWidget *m_wxwindow;
wxList m_children;
wxTabPage(void)
{
m_id = -1;
m_text = "";
m_image = -1;
m_clientData = NULL;
m_page = NULL;
m_wxwindow = NULL;
};
};
//-----------------------------------------------------------------------------
// wxTabCtrl
//-----------------------------------------------------------------------------
BEGIN_EVENT_TABLE(wxTabCtrl, wxControl)
END_EVENT_TABLE()
IMPLEMENT_DYNAMIC_CLASS(wxTabCtrl,wxControl)
wxTabCtrl::wxTabCtrl(void)
{
m_imageList = NULL;
m_pages.DeleteContents( TRUE );
};
wxTabCtrl::wxTabCtrl( wxWindow *parent, const wxWindowID id,
const wxPoint& pos, const wxSize& size,
const long style, const wxString& name )
{
m_imageList = NULL;
m_pages.DeleteContents( TRUE );
Create( parent, id, pos, size, style, name );
};
wxTabCtrl::~wxTabCtrl(void)
{
if (m_imageList) delete m_imageList;
DeleteAllItems();
};
bool wxTabCtrl::Create(wxWindow *parent, const wxWindowID id,
const wxPoint& pos, const wxSize& size,
const long style, const wxString& name )
{
m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name );
m_widget = gtk_notebook_new();
PostCreation();
Show( TRUE );
return TRUE;
};
int wxTabCtrl::GetSelection(void) const
{
return gtk_notebook_current_page( GTK_NOTEBOOK(m_widget) );
};
wxImageList* wxTabCtrl::GetImageList(void) const
{
return m_imageList;
};
int wxTabCtrl::GetItemCount(void) const
{
return m_pages.Number();
};
bool wxTabCtrl::GetItemRect( const int WXUNUSED(item), wxRect& WXUNUSED(rect) ) const
{
return FALSE;
};
int wxTabCtrl::GetRowCount(void) const
{
return 1;
};
wxString wxTabCtrl::GetItemText( const int item ) const
{
wxNode *node = m_pages.Nth( item );
if (node)
{
wxTabPage *page = (wxTabPage*)node->Data();
return page->m_text;
};
return "";
};
int wxTabCtrl::GetItemImage( const int item ) const
{
wxNode *node = m_pages.Nth( item );
if (node)
{
wxTabPage *page = (wxTabPage*)node->Data();
return page->m_image;
};
return -1;
};
void* wxTabCtrl::GetItemData( const int item ) const
{
wxNode *node = m_pages.Nth( item );
if (node)
{
wxTabPage *page = (wxTabPage*)node->Data();
return page->m_clientData;
};
return NULL;
};
int wxTabCtrl::SetSelection( const int item )
{
wxTabPage *page = NULL;
wxNode *node = m_pages.First();
while (node)
{
page = (wxTabPage*)node->Data();
if (page->m_id == item) break;
page = NULL;
node = node->Next();
};
if (!page) return -1;
int page_num = 0;
GList *child = GTK_NOTEBOOK(m_widget)->children;
while (child)
{
if (page->m_page == (GtkNotebookPage*)child->data) break;
page_num++;
child = child->next;
};
if (!child) return -1;
gtk_notebook_set_page( GTK_NOTEBOOK(m_widget), page_num );
return item;
};
void wxTabCtrl::SetImageList( wxImageList* imageList )
{
m_imageList = imageList;
};
bool wxTabCtrl::SetItemText( const int WXUNUSED(item), const wxString& WXUNUSED(text) )
{
return TRUE;
};
bool wxTabCtrl::SetItemImage( const int WXUNUSED(item), const int WXUNUSED(image) )
{
return TRUE;
};
bool wxTabCtrl::SetItemData( const int WXUNUSED(item), void* WXUNUSED(data) )
{
return TRUE;
};
void wxTabCtrl::SetItemSize( const wxSize &WXUNUSED(size) )
{
};
void wxTabCtrl::SetPadding( const wxSize &WXUNUSED(padding) )
{
};
bool wxTabCtrl::DeleteAllItems(void)
{
wxNode *page_node = m_pages.First();
while (page_node)
{
wxTabPage *page = (wxTabPage*)page_node->Data();
wxNode *node = page->m_children.First();
while (node)
{
wxWindow *child = (wxWindow*)node->Data();
delete child;
node = node->Next();
};
gtk_widget_destroy( page->m_wxwindow );
m_pages.DeleteObject( page );
page_node = m_pages.First();
};
return TRUE;
};
bool wxTabCtrl::DeleteItem( const int item )
{
wxTabPage *page = NULL;
wxNode *node = m_pages.First();
while (node)
{
page = (wxTabPage*)node->Data();
if (page->m_id == item) break;
node = node->Next();
};
if (!node) return FALSE;
node = page->m_children.First();
while (node)
{
wxWindow *child = (wxWindow*)node->Data();
delete child;
node = node->Next();
};
gtk_widget_destroy( page->m_wxwindow );
m_pages.DeleteObject( page );
return TRUE;
};
int wxTabCtrl::HitTest( const wxPoint &WXUNUSED(pt), long &WXUNUSED(flags) )
{
return wxTAB_HITTEST_NOWHERE;
};
int wxTabCtrl::InsertItem( const int item, const wxString &text, const int imageId, void* data )
{
wxTabPage *page = new wxTabPage;
page->m_text = text;
if (page->m_text.IsNull()) page->m_text = "";
page->m_id = item;
page->m_image = imageId;
page->m_clientData = data;
GtkWidget *label_widget = gtk_label_new( page->m_text );
gtk_misc_set_alignment( GTK_MISC(label_widget), 0.0, 0.5 );
page->m_wxwindow = gtk_myfixed_new();
gtk_widget_show( page->m_wxwindow );
gtk_widget_set_usize( page->m_wxwindow, 100, 100 );
gtk_notebook_append_page( GTK_NOTEBOOK(m_widget), page->m_wxwindow, label_widget );
page->m_page = GTK_NOTEBOOK(m_widget)->cur_page;
m_pages.Append( page );
return item;
};
void wxTabCtrl::AddChild( wxWindow *win )
{
GtkNotebookPage *g_page = GTK_NOTEBOOK(m_widget)->cur_page;
wxTabPage *page = NULL;
wxNode *node = m_pages.First();
while (node)
{
page = (wxTabPage*)node->Data();
if (page->m_page == g_page) break;
node = node->Next();
};
if (!page) wxFatalError( "wxTabCtrl error" );
gtk_myfixed_put( GTK_MYFIXED(page->m_wxwindow), win->m_widget, win->m_x, win->m_y );
gtk_widget_set_usize( win->m_widget, win->m_width, win->m_height );
page->m_children.Append( win );
};
//-----------------------------------------------------------------------------
// wxTabEvent
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxTabEvent, wxCommandEvent)
wxTabEvent::wxTabEvent( WXTYPE commandType, int id ) :
wxCommandEvent(commandType, id)
{
};

View File

@@ -50,12 +50,6 @@ bool wxTextCtrl::Create( wxWindow *parent, const wxWindowID id, const wxString &
else
m_widget = gtk_entry_new();
if (!value.IsNull())
{
gint tmp = 0;
gtk_editable_insert_text( GTK_EDITABLE(m_widget), value, value.Length(), &tmp );
};
wxSize newSize = size;
if (newSize.x == -1) newSize.x = 80;
if (newSize.y == -1) newSize.y = 26;
@@ -63,6 +57,12 @@ bool wxTextCtrl::Create( wxWindow *parent, const wxWindowID id, const wxString &
PostCreation();
if (!value.IsNull())
{
gint tmp = 0;
gtk_editable_insert_text( GTK_EDITABLE(m_widget), value, value.Length(), &tmp );
};
Show( TRUE );
return TRUE;
@@ -103,9 +103,10 @@ void wxTextCtrl::SetValue( const wxString &value )
void wxTextCtrl::WriteText( const wxString &text )
{
if (text.IsNull()) return;
if (m_windowStyle & wxTE_MULTILINE)
{
gint len = gtk_text_get_length( GTK_TEXT(m_widget) );
gint len = gtk_text_get_length( GTK_TEXT(m_widget) ) - 1;
gtk_editable_insert_text( GTK_EDITABLE(m_widget), text, text.Length(), &len );
}
else

View File

@@ -25,6 +25,7 @@
#include "wx/dcclient.h"
#include "wx/dnd.h"
#include "wx/mdi.h"
#include "wx/tabctrl.h"
#include "gdk/gdkkeysyms.h"
#include <math.h>
#include "wx/gtk/win_gtk.h"
@@ -1413,6 +1414,14 @@ void wxWindow::AddChild( wxWindow *child )
};
};
};
if (IsKindOf(CLASSINFO(wxTabCtrl)))
{
wxTabCtrl *tab = (wxTabCtrl*)this;
tab->AddChild( child );
return;
};
m_children.Append( child );
if (child->IsKindOf(CLASSINFO(wxFrame)) || child->IsKindOf(CLASSINFO(wxDialog)))
{