savedClipRegion = NewRgn();
GetClip( savedClipRegion );
+
ClipRect( drawRect );
EraseRect( drawRect );
-
MoveTo(drawRect->left + 4 , drawRect->top + 10 );
::TextFont( kFontIDMonaco ) ;
}
}
+void wxListBox::DoSetSize(int x, int y,
+ int width, int height,
+ int sizeFlags )
+{
+ wxControl::DoSetSize( x , y , width , height , sizeFlags ) ;
+#if TARGET_CARBON
+ Rect bounds ;
+ GetControlBounds( m_macControl , &bounds ) ;
+ ControlRef control = GetListVerticalScrollBar( m_macList ) ;
+ if ( control )
+ {
+ Rect scrollbounds ;
+ GetControlBounds( control , &scrollbounds ) ;
+ if( scrollbounds.right != bounds.right + 1 )
+ {
+ UMAMoveControl( control , bounds.right - (scrollbounds.right - scrollbounds.left) + 1 ,
+ scrollbounds.top ) ;
+ }
+ }
+#endif
+}
void wxListBox::DoSetFirstItem(int N)
{
MacScrollTo( N ) ;
{
wxCHECK_RET( N >= 0 && N < m_noItems,
"invalid index in wxListBox::SetSelection" );
- MacSetSelection( N , select ) ;
+ MacSetSelection( N , select ) ;
+ GetSelections( m_selectionPreImage ) ;
}
bool wxListBox::IsSelected(int N) const
wxCHECK_MSG( N >= 0 && N < m_noItems, FALSE,
"invalid index in wxListBox::Selected" );
- return MacIsSelected( N ) ;
+ return MacIsSelected( N ) ;
}
void *wxListBox::DoGetItemClientData(int N) const
int wxListBox::GetSelections(wxArrayInt& aSelections) const
{
return MacGetSelections( aSelections ) ;
-
-/* TODO
- if ((m_windowStyle & wxLB_MULTIMacE) || (m_windowStyle & wxLB_EXTENDED))
- {
- int no_sel = ??
- for ( int n = 0; n < no_sel; n++ )
- aSelections.Add(??);
-
- return no_sel;
- }
- else // single-selection listbox
- {
- aSelections.Add(??);
-
- return 1;
- }
-*/
}
// Get single selection, for single choice list items
void wxListBox::MacSetSelection( int n , bool select )
{
Cell cell = { 0 , 0 } ;
- if ( LGetSelect( true , &cell , m_macList ) )
+ if ( ! (m_windowStyle & wxLB_MULTIPLE) )
{
- LSetSelect( false , cell , m_macList ) ;
+ if ( LGetSelect( true , &cell , m_macList ) )
+ {
+ LSetSelect( false , cell , m_macList ) ;
+ }
}
cell.v = n ;
void wxListBox::MacDoClick()
{
- wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, m_windowId);
- event.SetEventObject( this );
-
wxArrayInt aSelections;
int n, count = GetSelections(aSelections);
+
+ if ( count == m_selectionPreImage.GetCount() )
+ {
+ bool hasChanged = false ;
+ for ( int i = 0 ; i < count ; ++i )
+ {
+ if ( aSelections[i] != m_selectionPreImage[i] )
+ {
+ hasChanged = true ;
+ break ;
+ }
+ }
+ if ( !hasChanged )
+ return ;
+ }
+
+ wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, m_windowId);
+ event.SetEventObject( this );
+
if ( count > 0 )
{
n = aSelections[0];