Renames to avoid object files with duplicate filenames. (Should we just make everything in this dir _osx for consistency?)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55455 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
152
src/osx/checklst_osx.cpp
Normal file
152
src/osx/checklst_osx.cpp
Normal file
@@ -0,0 +1,152 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/osx/checklst.cpp
|
||||
// Purpose: implementation of wxCheckListBox class
|
||||
// Author: Stefan Csomor
|
||||
// Modified by:
|
||||
// Created: 1998-01-01
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Stefan Csomor
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// new DataBrowser-based version
|
||||
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#if wxUSE_CHECKLISTBOX
|
||||
|
||||
#include "wx/checklst.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/arrstr.h"
|
||||
#endif
|
||||
|
||||
#include "wx/osx/private.h"
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxCheckListBox, wxListBox)
|
||||
|
||||
BEGIN_EVENT_TABLE(wxCheckListBox, wxListBox)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
void wxCheckListBox::Init()
|
||||
{
|
||||
}
|
||||
|
||||
bool wxCheckListBox::Create(
|
||||
wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint &pos,
|
||||
const wxSize &size,
|
||||
const wxArrayString& choices,
|
||||
long style,
|
||||
const wxValidator& validator,
|
||||
const wxString &name )
|
||||
{
|
||||
wxCArrayString chs( choices );
|
||||
|
||||
return Create( parent, id, pos, size, chs.GetCount(), chs.GetStrings(), style, validator, name );
|
||||
}
|
||||
|
||||
bool wxCheckListBox::Create(
|
||||
wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
int n,
|
||||
const wxString choices[],
|
||||
long style,
|
||||
const wxValidator& validator,
|
||||
const wxString& name )
|
||||
{
|
||||
m_macIsUserPane = false;
|
||||
|
||||
wxASSERT_MSG( !(style & wxLB_MULTIPLE) || !(style & wxLB_EXTENDED),
|
||||
wxT("only one of listbox selection modes can be specified") );
|
||||
|
||||
if ( !wxCheckListBoxBase::Create( parent, id, pos, size, n, choices, style & ~(wxHSCROLL | wxVSCROLL), validator, name ) )
|
||||
return false;
|
||||
|
||||
int colwidth = 30;
|
||||
// TODO adapt the width according to the window variant
|
||||
m_checkColumn = GetListPeer()->InsertCheckColumn(0, wxEmptyString, true, wxALIGN_CENTER, colwidth);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxCheckListBox functions
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxCheckListBox functions
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
bool wxCheckListBox::IsChecked(unsigned int n) const
|
||||
{
|
||||
wxCHECK_MSG( IsValid(n), false,
|
||||
_T("invalid index in wxCheckListBox::IsChecked") );
|
||||
|
||||
return m_checks[n] != 0;
|
||||
}
|
||||
|
||||
void wxCheckListBox::Check(unsigned int n, bool check)
|
||||
{
|
||||
wxCHECK_RET( IsValid(n),
|
||||
_T("invalid index in wxCheckListBox::Check") );
|
||||
|
||||
// intermediate var is needed to avoid compiler warning with VC++
|
||||
bool isChecked = m_checks[n] != 0;
|
||||
if ( check != isChecked )
|
||||
{
|
||||
m_checks[n] = check;
|
||||
|
||||
GetListPeer()->UpdateLine(n);
|
||||
}
|
||||
}
|
||||
|
||||
void wxCheckListBox::GetValueCallback( unsigned int n, wxListWidgetColumn* col , wxListWidgetCellValue& value )
|
||||
{
|
||||
if ( col == m_checkColumn )
|
||||
value.Set( IsChecked( n ) );
|
||||
else
|
||||
wxListBox::GetValueCallback( n, col, value );
|
||||
}
|
||||
|
||||
void wxCheckListBox::SetValueCallback( unsigned int n, wxListWidgetColumn* col , wxListWidgetCellValue& value )
|
||||
{
|
||||
if ( col == m_checkColumn )
|
||||
{
|
||||
Check( n, value.GetIntValue() );
|
||||
|
||||
wxCommandEvent event( wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, GetId() );
|
||||
event.SetInt( n );
|
||||
event.SetEventObject( this );
|
||||
HandleWindowEvent( event );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// methods forwarded to wxListBox
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void wxCheckListBox::OnItemInserted(unsigned int pos)
|
||||
{
|
||||
m_checks.Insert(false, pos );
|
||||
}
|
||||
|
||||
void wxCheckListBox::DoDeleteOneItem(unsigned int n)
|
||||
{
|
||||
wxListBox::DoDeleteOneItem(n);
|
||||
|
||||
m_checks.RemoveAt(n);
|
||||
}
|
||||
|
||||
void wxCheckListBox::DoClear()
|
||||
{
|
||||
m_checks.Empty();
|
||||
}
|
||||
|
||||
#endif // wxUSE_CHECKLISTBOX
|
Reference in New Issue
Block a user