Added wxCheckLitBox (oh well)

Minor optical fixes to gridg


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1200 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
1998-12-15 14:14:51 +00:00
parent bc5f9710c1
commit caaa4cfd67
13 changed files with 505 additions and 39 deletions

55
include/wx/gtk/checklst.h Normal file
View File

@@ -0,0 +1,55 @@
///////////////////////////////////////////////////////////////////////////////
// Name: checklst.h
// Purpose: wxCheckListBox class
// Author: Robert Roebling
// Modified by:
// RCS-ID: $Id$
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef __GTKCHECKLISTH__
#define __GTKCHECKLISTH__
#ifdef __GNUG__
#pragma interface
#endif
#include "wx/defs.h"
#include "wx/object.h"
#include "wx/list.h"
#include "wx/control.h"
#include "wx/listbox.h"
//-----------------------------------------------------------------------------
// classes
//-----------------------------------------------------------------------------
class wxCheckListBox;
//-----------------------------------------------------------------------------
// wxCheckListBox
//-----------------------------------------------------------------------------
class wxCheckListBox : public wxListBox
{
DECLARE_DYNAMIC_CLASS(wxCheckListBox)
public:
wxCheckListBox();
wxCheckListBox(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int nStrings = 0,
const wxString choices[] = NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxListBoxNameStr);
bool IsChecked( int index ) const;
void Check( int index, bool check = TRUE );
};
#endif
//__GTKCHECKLISTH__

View File

@@ -7,7 +7,6 @@
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef __GTKCHOICEH__
#define __GTKCHOICEH__

View File

@@ -52,6 +52,7 @@ public:
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxListBoxNameStr )
{
m_hasCheckBoxes = FALSE;
Create(parent, id, pos, size, n, choices, style, validator, name);
}
~wxListBox();
@@ -101,8 +102,9 @@ public:
void ApplyWidgetStyle();
GtkList *m_list;
wxList m_clientDataList;
wxList m_clientObjectList;
wxList m_clientDataList;
wxList m_clientObjectList;
bool m_hasCheckBoxes;
};
#endif // __GTKLISTBOXH__

View File

@@ -0,0 +1,55 @@
///////////////////////////////////////////////////////////////////////////////
// Name: checklst.h
// Purpose: wxCheckListBox class
// Author: Robert Roebling
// Modified by:
// RCS-ID: $Id$
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef __GTKCHECKLISTH__
#define __GTKCHECKLISTH__
#ifdef __GNUG__
#pragma interface
#endif
#include "wx/defs.h"
#include "wx/object.h"
#include "wx/list.h"
#include "wx/control.h"
#include "wx/listbox.h"
//-----------------------------------------------------------------------------
// classes
//-----------------------------------------------------------------------------
class wxCheckListBox;
//-----------------------------------------------------------------------------
// wxCheckListBox
//-----------------------------------------------------------------------------
class wxCheckListBox : public wxListBox
{
DECLARE_DYNAMIC_CLASS(wxCheckListBox)
public:
wxCheckListBox();
wxCheckListBox(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int nStrings = 0,
const wxString choices[] = NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxListBoxNameStr);
bool IsChecked( int index ) const;
void Check( int index, bool check = TRUE );
};
#endif
//__GTKCHECKLISTH__

View File

@@ -7,7 +7,6 @@
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef __GTKCHOICEH__
#define __GTKCHOICEH__

View File

@@ -52,6 +52,7 @@ public:
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxListBoxNameStr )
{
m_hasCheckBoxes = FALSE;
Create(parent, id, pos, size, n, choices, style, validator, name);
}
~wxListBox();
@@ -101,8 +102,9 @@ public:
void ApplyWidgetStyle();
GtkList *m_list;
wxList m_clientDataList;
wxList m_clientObjectList;
wxList m_clientDataList;
wxList m_clientObjectList;
bool m_hasCheckBoxes;
};
#endif // __GTKLISTBOXH__

View File

@@ -27,6 +27,7 @@
#include "wx/notebook.h"
#include "wx/imaglist.h"
#include "wx/clipbrd.h"
#include "wx/checklst.h"
// XPM doesn't seem to work under Windows at present. Or, wxNotebook images
// aren't working.
@@ -205,6 +206,8 @@ const int ID_SLIDER = 181;
const int ID_SPIN = 182;
const int ID_CHECKLIST = 190;
BEGIN_EVENT_TABLE(MyPanel, wxPanel)
EVT_SIZE ( MyPanel::OnSize)
@@ -402,8 +405,15 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) :
m_spinbutton = new wxSpinButton( panel, ID_SPIN, wxPoint(103,159), wxSize(-1,-1) );
// m_spinbutton->SetBackgroundColour("wheat");
m_spinbutton->SetRange(0,100);
m_notebook->AddPage(panel, "wxGauge", FALSE, Image_Gauge);
panel = new wxPanel(m_notebook);
// panel->SetBackgroundColour("cadet blue");
// panel->SetForegroundColour("blue");
m_listbox = new wxCheckListBox( panel, ID_CHECKLIST, wxPoint(10,10), wxSize(160,70), 5, choices );
// m_listbox->SetBackgroundColour("wheat");
button = new wxButton( panel, ID_LISTBOX_FONT, "Set Italic font", wxPoint(340,130), wxSize(140,30) );
m_notebook->AddPage(panel, "wxCheckListBox", FALSE, Image_List);
}
void MyPanel::OnPasteFromClipboard( wxCommandEvent &WXUNUSED(event) )

View File

@@ -88,6 +88,8 @@ wxGenericGrid::wxGenericGrid(void)
m_editable = TRUE;
#if defined(__WIN95__)
m_scrollWidth = wxSystemSettings::GetSystemMetric(wxSYS_VSCROLL_X);
#elseif defined(__WXGTK__)
m_scrollWidth = wxSystemSettings::GetSystemMetric(wxSYS_VSCROLL_X);
#else
m_scrollWidth = 16;
#endif
@@ -144,6 +146,8 @@ bool wxGenericGrid::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos,
m_editable = TRUE;
#if defined(__WIN95__)
m_scrollWidth = wxSystemSettings::GetSystemMetric(wxSYS_VSCROLL_X);
#elseif defined(__WXGTK__)
m_scrollWidth = wxSystemSettings::GetSystemMetric(wxSYS_VSCROLL_X);
#else
m_scrollWidth = 16;
#endif
@@ -1025,8 +1029,13 @@ void wxGenericGrid::AdjustScrollbars(void)
int nCols = GetCols();
m_hScrollBar->SetScrollbar(m_hScrollBar->GetThumbPosition(), wxMax(noHorizSteps, 1), (noHorizSteps == 0) ? 1 : nCols, wxMax(noHorizSteps, 1));
m_hScrollBar->SetSize(m_leftOfSheet, ch - m_scrollWidth -2,
/*
m_hScrollBar->SetSize(m_leftOfSheet, ch - m_scrollWidth -2, // why -2 ? Robert.
cw - vertScrollBarWidth - m_leftOfSheet, m_scrollWidth);
*/
m_hScrollBar->SetSize(m_leftOfSheet, ch - m_scrollWidth,
cw - vertScrollBarWidth - m_leftOfSheet, m_scrollWidth);
}
if (m_vScrollBar)
@@ -1053,7 +1062,7 @@ void wxGenericGrid::OnSize(wxSizeEvent& WXUNUSED(event) )
{
m_editingPanel->SetSize(0, 0, cw, m_editControlPosition.height + m_editControlPosition.y + 2);
GetTextItem()->SetSize(m_editControlPosition.x, m_editControlPosition.y,
cw - m_editControlPosition.x, m_editControlPosition.height);
cw - 2*m_editControlPosition.x, m_editControlPosition.height);
}
}

View File

@@ -73,6 +73,7 @@ LIB_CPP_SRC=\
gtk/brush.cpp \
gtk/button.cpp \
gtk/checkbox.cpp \
gtk/checklst.cpp \
gtk/choice.cpp \
gtk/clipbrd.cpp \
gtk/colour.cpp \

85
src/gtk/checklst.cpp Normal file
View File

@@ -0,0 +1,85 @@
/////////////////////////////////////////////////////////////////////////////
// Name: checklst.cpp
// Purpose:
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "checklst.h"
#endif
#include "wx/checklst.h"
//-----------------------------------------------------------------------------
// wxCheckListBox
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxCheckListBox,wxListBox)
wxCheckListBox::wxCheckListBox() :
wxListBox()
{
m_hasCheckBoxes = TRUE;
}
wxCheckListBox::wxCheckListBox(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int nStrings = 0,
const wxString choices[] = NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxListBoxNameStr)
{
m_hasCheckBoxes = TRUE;
wxListBox::Create( parent, id, pos, size, nStrings, choices, style, validator, name );
}
bool wxCheckListBox::IsChecked( int index ) const
{
wxCHECK_MSG( m_list != NULL, FALSE, "invalid checklistbox" );
GList *child = g_list_nth( m_list->children, index );
if (child)
{
GtkBin *bin = GTK_BIN( child->data );
GtkLabel *label = GTK_LABEL( bin->child );
wxString str = label->label;
return (str[1] == 'X');
}
wxFAIL_MSG("wrong checklistbox index");
return FALSE;
}
void wxCheckListBox::Check( int index, bool check )
{
wxCHECK_RET( m_list != NULL, "invalid checklistbox" );
GList *child = g_list_nth( m_list->children, index );
if (child)
{
GtkBin *bin = GTK_BIN( child->data );
GtkLabel *label = GTK_LABEL( bin->child );
wxString str = label->label;
if (check == (str[1] == 'X')) return;
if (check)
str.SetChar( 1, 'X' );
else
str.SetChar( 1, '-' );
gtk_label_set( label, str );
return;
}
wxFAIL_MSG("wrong checklistbox index");
}

View File

@@ -15,7 +15,8 @@
#include "wx/dynarray.h"
#include "wx/listbox.h"
#include "wx/utils.h"
#include <wx/intl.h>
#include "wx/intl.h"
#include "wx/checklst.h"
//-------------------------------------------------------------------------
// conditional compilation
@@ -32,6 +33,30 @@
//-----------------------------------------------------------------------------
extern bool g_blockEventsOnDrag;
extern bool g_blockEventsOnScroll;
//-----------------------------------------------------------------------------
// "button_press_event"
//-----------------------------------------------------------------------------
static gint
gtk_listbox_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxListBox *listbox )
{
if (g_blockEventsOnDrag) return FALSE;
if (g_blockEventsOnScroll) return FALSE;
if (!listbox->HasVMT()) return FALSE;
if (gdk_event->x > 15) return FALSE;
int sel = listbox->GetIndex( widget );
wxCheckListBox *clb = (wxCheckListBox *)listbox;
clb->Check( sel, !clb->IsChecked(sel) );
return FALSE;
}
//-----------------------------------------------------------------------------
// "select" and "deselect"
@@ -74,6 +99,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxListBox,wxControl)
wxListBox::wxListBox()
{
m_list = (GtkList *) NULL;
m_hasCheckBoxes = FALSE;
}
bool wxListBox::Create( wxWindow *parent, wxWindowID id,
@@ -120,7 +146,17 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
m_clientObjectList.Append( (wxObject*) NULL );
GtkWidget *list_item;
list_item = gtk_list_item_new_with_label( choices[i] );
if (m_hasCheckBoxes)
{
wxString str = "[-] ";
str += choices[i];
list_item = gtk_list_item_new_with_label( str );
}
else
{
list_item = gtk_list_item_new_with_label( choices[i] );
}
gtk_container_add( GTK_CONTAINER(m_list), list_item );
@@ -131,6 +167,14 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
gtk_signal_connect( GTK_OBJECT(list_item), "deselect",
GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
if (m_hasCheckBoxes)
{
gtk_signal_connect( GTK_OBJECT(list_item),
"button_press_event",
(GtkSignalFunc)gtk_listbox_button_press_callback,
(gpointer) this );
}
ConnectWidget( list_item );
gtk_widget_show( list_item );
@@ -154,14 +198,25 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
wxListBox::~wxListBox()
{
Clear();
Clear();
}
void wxListBox::AppendCommon( const wxString &item )
{
wxCHECK_RET( m_list != NULL, "invalid listbox" );
GtkWidget *list_item = gtk_list_item_new_with_label( item );
GtkWidget *list_item;
if (m_hasCheckBoxes)
{
wxString str = "[-] ";
str += item;
list_item = gtk_list_item_new_with_label( str );
}
else
{
list_item = gtk_list_item_new_with_label( item );
}
gtk_signal_connect( GTK_OBJECT(list_item), "select",
GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
@@ -174,6 +229,14 @@ void wxListBox::AppendCommon( const wxString &item )
if (m_widgetStyle) ApplyWidgetStyle();
if (m_hasCheckBoxes)
{
gtk_signal_connect( GTK_OBJECT(list_item),
"button_press_event",
(GtkSignalFunc)gtk_listbox_button_press_callback,
(gpointer) this );
}
gtk_widget_show( list_item );
ConnectWidget( list_item );
@@ -274,11 +337,7 @@ void wxListBox::Delete( int n )
GList *child = g_list_nth( m_list->children, n );
if (!child)
{
wxFAIL_MSG("wrong listbox index");
return;
}
wxCHECK_RET( child, "wrong listbox index" );
GList *list = g_list_append( NULL, child->data );
gtk_list_remove_items( m_list, list );
@@ -316,7 +375,12 @@ int wxListBox::FindString( const wxString &item ) const
{
GtkBin *bin = GTK_BIN( child->data );
GtkLabel *label = GTK_LABEL( bin->child );
if (item == label->label) return count;
wxString str = label->label;
if (m_hasCheckBoxes) str.Remove( 0, 4 );
if (str == item) return count;
count++;
child = child->next;
}
@@ -380,7 +444,11 @@ wxString wxListBox::GetString( int n ) const
{
GtkBin *bin = GTK_BIN( child->data );
GtkLabel *label = GTK_LABEL( bin->child );
return label->label;
wxString str = label->label;
if (m_hasCheckBoxes) str.Remove( 0, 4 );
return str;
}
wxFAIL_MSG("wrong listbox index");
return "";
@@ -394,9 +462,14 @@ wxString wxListBox::GetStringSelection() const
if (selection)
{
GtkBin *bin = GTK_BIN( selection->data );
wxString tmp = GTK_LABEL( bin->child )->label;
return tmp;
GtkLabel *label = GTK_LABEL( bin->child );
wxString str = label->label;
if (m_hasCheckBoxes) str.Remove( 0, 4 );
return str;
}
wxFAIL_MSG("no listbox selection available");
return "";
}
@@ -463,7 +536,12 @@ void wxListBox::SetString( int n, const wxString &string )
{
GtkBin *bin = GTK_BIN( child->data );
GtkLabel *label = GTK_LABEL( bin->child );
gtk_label_set( label, string );
wxString str;
if (m_hasCheckBoxes) str += "[-] ";
str += string;
gtk_label_set( label, str );
}
else
{
@@ -560,8 +638,12 @@ void wxListBox::ApplyWidgetStyle()
GList *child = m_list->children;
while (child)
{
gtk_widget_set_style( GTK_BIN(child->data)->child, m_widgetStyle );
gtk_widget_set_style( GTK_WIDGET(child->data), m_widgetStyle );
GtkBin *bin = GTK_BIN( child->data );
GtkWidget *label = GTK_WIDGET( bin->child );
gtk_widget_set_style( label, m_widgetStyle );
child = child->next;
}
}

85
src/gtk1/checklst.cpp Normal file
View File

@@ -0,0 +1,85 @@
/////////////////////////////////////////////////////////////////////////////
// Name: checklst.cpp
// Purpose:
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "checklst.h"
#endif
#include "wx/checklst.h"
//-----------------------------------------------------------------------------
// wxCheckListBox
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxCheckListBox,wxListBox)
wxCheckListBox::wxCheckListBox() :
wxListBox()
{
m_hasCheckBoxes = TRUE;
}
wxCheckListBox::wxCheckListBox(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int nStrings = 0,
const wxString choices[] = NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxListBoxNameStr)
{
m_hasCheckBoxes = TRUE;
wxListBox::Create( parent, id, pos, size, nStrings, choices, style, validator, name );
}
bool wxCheckListBox::IsChecked( int index ) const
{
wxCHECK_MSG( m_list != NULL, FALSE, "invalid checklistbox" );
GList *child = g_list_nth( m_list->children, index );
if (child)
{
GtkBin *bin = GTK_BIN( child->data );
GtkLabel *label = GTK_LABEL( bin->child );
wxString str = label->label;
return (str[1] == 'X');
}
wxFAIL_MSG("wrong checklistbox index");
return FALSE;
}
void wxCheckListBox::Check( int index, bool check )
{
wxCHECK_RET( m_list != NULL, "invalid checklistbox" );
GList *child = g_list_nth( m_list->children, index );
if (child)
{
GtkBin *bin = GTK_BIN( child->data );
GtkLabel *label = GTK_LABEL( bin->child );
wxString str = label->label;
if (check == (str[1] == 'X')) return;
if (check)
str.SetChar( 1, 'X' );
else
str.SetChar( 1, '-' );
gtk_label_set( label, str );
return;
}
wxFAIL_MSG("wrong checklistbox index");
}

View File

@@ -15,7 +15,8 @@
#include "wx/dynarray.h"
#include "wx/listbox.h"
#include "wx/utils.h"
#include <wx/intl.h>
#include "wx/intl.h"
#include "wx/checklst.h"
//-------------------------------------------------------------------------
// conditional compilation
@@ -32,6 +33,30 @@
//-----------------------------------------------------------------------------
extern bool g_blockEventsOnDrag;
extern bool g_blockEventsOnScroll;
//-----------------------------------------------------------------------------
// "button_press_event"
//-----------------------------------------------------------------------------
static gint
gtk_listbox_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxListBox *listbox )
{
if (g_blockEventsOnDrag) return FALSE;
if (g_blockEventsOnScroll) return FALSE;
if (!listbox->HasVMT()) return FALSE;
if (gdk_event->x > 15) return FALSE;
int sel = listbox->GetIndex( widget );
wxCheckListBox *clb = (wxCheckListBox *)listbox;
clb->Check( sel, !clb->IsChecked(sel) );
return FALSE;
}
//-----------------------------------------------------------------------------
// "select" and "deselect"
@@ -74,6 +99,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxListBox,wxControl)
wxListBox::wxListBox()
{
m_list = (GtkList *) NULL;
m_hasCheckBoxes = FALSE;
}
bool wxListBox::Create( wxWindow *parent, wxWindowID id,
@@ -120,7 +146,17 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
m_clientObjectList.Append( (wxObject*) NULL );
GtkWidget *list_item;
list_item = gtk_list_item_new_with_label( choices[i] );
if (m_hasCheckBoxes)
{
wxString str = "[-] ";
str += choices[i];
list_item = gtk_list_item_new_with_label( str );
}
else
{
list_item = gtk_list_item_new_with_label( choices[i] );
}
gtk_container_add( GTK_CONTAINER(m_list), list_item );
@@ -131,6 +167,14 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
gtk_signal_connect( GTK_OBJECT(list_item), "deselect",
GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
if (m_hasCheckBoxes)
{
gtk_signal_connect( GTK_OBJECT(list_item),
"button_press_event",
(GtkSignalFunc)gtk_listbox_button_press_callback,
(gpointer) this );
}
ConnectWidget( list_item );
gtk_widget_show( list_item );
@@ -154,14 +198,25 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
wxListBox::~wxListBox()
{
Clear();
Clear();
}
void wxListBox::AppendCommon( const wxString &item )
{
wxCHECK_RET( m_list != NULL, "invalid listbox" );
GtkWidget *list_item = gtk_list_item_new_with_label( item );
GtkWidget *list_item;
if (m_hasCheckBoxes)
{
wxString str = "[-] ";
str += item;
list_item = gtk_list_item_new_with_label( str );
}
else
{
list_item = gtk_list_item_new_with_label( item );
}
gtk_signal_connect( GTK_OBJECT(list_item), "select",
GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
@@ -174,6 +229,14 @@ void wxListBox::AppendCommon( const wxString &item )
if (m_widgetStyle) ApplyWidgetStyle();
if (m_hasCheckBoxes)
{
gtk_signal_connect( GTK_OBJECT(list_item),
"button_press_event",
(GtkSignalFunc)gtk_listbox_button_press_callback,
(gpointer) this );
}
gtk_widget_show( list_item );
ConnectWidget( list_item );
@@ -274,11 +337,7 @@ void wxListBox::Delete( int n )
GList *child = g_list_nth( m_list->children, n );
if (!child)
{
wxFAIL_MSG("wrong listbox index");
return;
}
wxCHECK_RET( child, "wrong listbox index" );
GList *list = g_list_append( NULL, child->data );
gtk_list_remove_items( m_list, list );
@@ -316,7 +375,12 @@ int wxListBox::FindString( const wxString &item ) const
{
GtkBin *bin = GTK_BIN( child->data );
GtkLabel *label = GTK_LABEL( bin->child );
if (item == label->label) return count;
wxString str = label->label;
if (m_hasCheckBoxes) str.Remove( 0, 4 );
if (str == item) return count;
count++;
child = child->next;
}
@@ -380,7 +444,11 @@ wxString wxListBox::GetString( int n ) const
{
GtkBin *bin = GTK_BIN( child->data );
GtkLabel *label = GTK_LABEL( bin->child );
return label->label;
wxString str = label->label;
if (m_hasCheckBoxes) str.Remove( 0, 4 );
return str;
}
wxFAIL_MSG("wrong listbox index");
return "";
@@ -394,9 +462,14 @@ wxString wxListBox::GetStringSelection() const
if (selection)
{
GtkBin *bin = GTK_BIN( selection->data );
wxString tmp = GTK_LABEL( bin->child )->label;
return tmp;
GtkLabel *label = GTK_LABEL( bin->child );
wxString str = label->label;
if (m_hasCheckBoxes) str.Remove( 0, 4 );
return str;
}
wxFAIL_MSG("no listbox selection available");
return "";
}
@@ -463,7 +536,12 @@ void wxListBox::SetString( int n, const wxString &string )
{
GtkBin *bin = GTK_BIN( child->data );
GtkLabel *label = GTK_LABEL( bin->child );
gtk_label_set( label, string );
wxString str;
if (m_hasCheckBoxes) str += "[-] ";
str += string;
gtk_label_set( label, str );
}
else
{
@@ -560,8 +638,12 @@ void wxListBox::ApplyWidgetStyle()
GList *child = m_list->children;
while (child)
{
gtk_widget_set_style( GTK_BIN(child->data)->child, m_widgetStyle );
gtk_widget_set_style( GTK_WIDGET(child->data), m_widgetStyle );
GtkBin *bin = GTK_BIN( child->data );
GtkWidget *label = GTK_WIDGET( bin->child );
gtk_widget_set_style( label, m_widgetStyle );
child = child->next;
}
}