Implemented Reparent() and added test for it to minifram sample.

Fixed one out of two window resizing bugs in multi-line text ctrl.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2602 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
1999-05-31 17:04:50 +00:00
parent 02e8b87f6f
commit 8ce63e9d66
6 changed files with 118 additions and 29 deletions

View File

@@ -158,16 +158,17 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
(GtkAttachOptions)(GTK_FILL | GTK_EXPAND | GTK_SHRINK),
(GtkAttachOptions)(GTK_FILL | GTK_EXPAND | GTK_SHRINK),
0, 0);
/* always wrap words */
gtk_text_set_word_wrap( GTK_TEXT(m_text), TRUE );
/* put the horizontal scrollbar in the lower left hand corner */
if (bHasHScrollbar)
{
GtkWidget *hscrollbar = gtk_hscrollbar_new(GTK_TEXT(m_text)->hadj);
GTK_WIDGET_UNSET_FLAGS( hscrollbar, GTK_CAN_FOCUS );
gtk_table_attach(GTK_TABLE(m_widget), hscrollbar, 0, 1, 1, 2,
(GtkAttachOptions)(GTK_EXPAND | GTK_FILL),
(GtkAttachOptions)(GTK_EXPAND | GTK_FILL | GTK_SHRINK),
GTK_FILL,
0, 0);
gtk_widget_show(hscrollbar);
@@ -177,6 +178,7 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
gtk_text_set_line_wrap( GTK_TEXT(m_text), FALSE );
#endif
}
/* finally, put the vertical scrollbar in the upper right corner */
m_vScrollbar = gtk_vscrollbar_new( GTK_TEXT(m_text)->vadj );
GTK_WIDGET_UNSET_FLAGS( m_vScrollbar, GTK_CAN_FOCUS );

View File

@@ -2383,12 +2383,23 @@ bool wxWindow::AcceptsFocus() const
bool wxWindow::Reparent( wxWindow *newParent )
{
wxCHECK_MSG( (m_widget != NULL), (wxWindow*) NULL, _T("invalid window") );
gtk_widget_unparent( m_widget );
wxWindow *oldParent = m_parent;
if ( !wxWindowBase::Reparent(newParent) )
return FALSE;
if (oldParent)
{
gtk_container_remove( GTK_CONTAINER(oldParent->m_wxwindow), m_widget );
}
if (newParent)
{
/* insert GTK representation */
(*(newParent->m_insertCallback))(newParent, this);
}
return TRUE;
}

View File

@@ -158,16 +158,17 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
(GtkAttachOptions)(GTK_FILL | GTK_EXPAND | GTK_SHRINK),
(GtkAttachOptions)(GTK_FILL | GTK_EXPAND | GTK_SHRINK),
0, 0);
/* always wrap words */
gtk_text_set_word_wrap( GTK_TEXT(m_text), TRUE );
/* put the horizontal scrollbar in the lower left hand corner */
if (bHasHScrollbar)
{
GtkWidget *hscrollbar = gtk_hscrollbar_new(GTK_TEXT(m_text)->hadj);
GTK_WIDGET_UNSET_FLAGS( hscrollbar, GTK_CAN_FOCUS );
gtk_table_attach(GTK_TABLE(m_widget), hscrollbar, 0, 1, 1, 2,
(GtkAttachOptions)(GTK_EXPAND | GTK_FILL),
(GtkAttachOptions)(GTK_EXPAND | GTK_FILL | GTK_SHRINK),
GTK_FILL,
0, 0);
gtk_widget_show(hscrollbar);
@@ -177,6 +178,7 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
gtk_text_set_line_wrap( GTK_TEXT(m_text), FALSE );
#endif
}
/* finally, put the vertical scrollbar in the upper right corner */
m_vScrollbar = gtk_vscrollbar_new( GTK_TEXT(m_text)->vadj );
GTK_WIDGET_UNSET_FLAGS( m_vScrollbar, GTK_CAN_FOCUS );

View File

@@ -2383,12 +2383,23 @@ bool wxWindow::AcceptsFocus() const
bool wxWindow::Reparent( wxWindow *newParent )
{
wxCHECK_MSG( (m_widget != NULL), (wxWindow*) NULL, _T("invalid window") );
gtk_widget_unparent( m_widget );
wxWindow *oldParent = m_parent;
if ( !wxWindowBase::Reparent(newParent) )
return FALSE;
if (oldParent)
{
gtk_container_remove( GTK_CONTAINER(oldParent->m_wxwindow), m_widget );
}
if (newParent)
{
/* insert GTK representation */
(*(newParent->m_insertCallback))(newParent, this);
}
return TRUE;
}