removed WXK_SPACE as duplicating the selection event, added theme text drawing patch

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16708 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor 2002-08-23 14:35:44 +00:00
parent 9210422353
commit 202848fe9e
2 changed files with 68 additions and 18 deletions

View File

@ -54,6 +54,12 @@ typedef struct {
#pragma pack()
#endif
#if TARGET_CARBON
const short kwxMacListItemHeight = 19 ;
#else
const short kwxMacListItemHeight = 14 ;
#endif
extern "C"
{
static pascal void wxMacListDefinition( short message, Boolean isSelected, Rect *drawRect,
@ -98,12 +104,33 @@ static pascal void wxMacListDefinition( short message, Boolean isSelected, Rect
ClipRect( drawRect );
EraseRect( drawRect );
MoveTo(drawRect->left + 4 , drawRect->top + 10 );
::TextFont( kFontIDMonaco ) ;
::TextSize( 9 );
::TextFace( 0 ) ;
#if TARGET_CARBON
bool useDrawThemeText = ( DrawThemeTextBox != (void*) kUnresolvedCFragSymbolAddress ) ;
if ( useDrawThemeText )
{
Rect frame = { drawRect->top, drawRect->left + 4,
drawRect->top + kwxMacListItemHeight, drawRect->right} ;
CFStringRef mString = CFStringCreateWithBytes( NULL , (UInt8*) text.c_str(), text.Length(), CFStringGetSystemEncoding(), false ) ;
::DrawThemeTextBox( mString,
kThemeViewsFont,
kThemeStateActive,
false,
&frame,
teJustLeft,
nil );
CFRelease( mString ) ;
}
else
#endif
{
MoveTo(drawRect->left + 4 , drawRect->top + 10 );
::TextFont( kFontIDMonaco ) ;
::TextSize( 9 );
::TextFace( 0 ) ;
DrawText(text, 0 , text.Length());
}
DrawText(text, 0 , text.Length());
// If the cell is hilited, do the hilite now. Paint the cell contents with the
// appropriate QuickDraw transform mode.
@ -139,7 +166,6 @@ static pascal void wxMacListDefinition( short message, Boolean isSelected, Rect
extern "C" void MacDrawStringCell(Rect *cellRect, Cell lCell, ListHandle theList, long refCon) ;
const short kwxMacListWithVerticalScrollbar = 128 ;
const short kwxMacListItemHeight = 14 ;
// ============================================================================
// list box control implementation
@ -881,11 +907,10 @@ void wxListBox::OnChar(wxKeyEvent& event)
if ( !GetEventHandler()->ProcessEvent( new_event ) )
event.Skip() ;
}
else if ( event.KeyCode() == WXK_SPACE || event.KeyCode() == WXK_DOWN || event.KeyCode() == WXK_UP )
else if ( event.KeyCode() == WXK_DOWN || event.KeyCode() == WXK_UP )
{
// perform the default key handling first
if ( event.KeyCode() == WXK_DOWN || event.KeyCode() == WXK_UP )
wxControl::OnKeyDown( event ) ;
wxControl::OnKeyDown( event ) ;
wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, m_windowId);
event.SetEventObject( this );

View File

@ -54,6 +54,12 @@ typedef struct {
#pragma pack()
#endif
#if TARGET_CARBON
const short kwxMacListItemHeight = 19 ;
#else
const short kwxMacListItemHeight = 14 ;
#endif
extern "C"
{
static pascal void wxMacListDefinition( short message, Boolean isSelected, Rect *drawRect,
@ -98,12 +104,33 @@ static pascal void wxMacListDefinition( short message, Boolean isSelected, Rect
ClipRect( drawRect );
EraseRect( drawRect );
MoveTo(drawRect->left + 4 , drawRect->top + 10 );
::TextFont( kFontIDMonaco ) ;
::TextSize( 9 );
::TextFace( 0 ) ;
#if TARGET_CARBON
bool useDrawThemeText = ( DrawThemeTextBox != (void*) kUnresolvedCFragSymbolAddress ) ;
if ( useDrawThemeText )
{
Rect frame = { drawRect->top, drawRect->left + 4,
drawRect->top + kwxMacListItemHeight, drawRect->right} ;
CFStringRef mString = CFStringCreateWithBytes( NULL , (UInt8*) text.c_str(), text.Length(), CFStringGetSystemEncoding(), false ) ;
::DrawThemeTextBox( mString,
kThemeViewsFont,
kThemeStateActive,
false,
&frame,
teJustLeft,
nil );
CFRelease( mString ) ;
}
else
#endif
{
MoveTo(drawRect->left + 4 , drawRect->top + 10 );
::TextFont( kFontIDMonaco ) ;
::TextSize( 9 );
::TextFace( 0 ) ;
DrawText(text, 0 , text.Length());
}
DrawText(text, 0 , text.Length());
// If the cell is hilited, do the hilite now. Paint the cell contents with the
// appropriate QuickDraw transform mode.
@ -139,7 +166,6 @@ static pascal void wxMacListDefinition( short message, Boolean isSelected, Rect
extern "C" void MacDrawStringCell(Rect *cellRect, Cell lCell, ListHandle theList, long refCon) ;
const short kwxMacListWithVerticalScrollbar = 128 ;
const short kwxMacListItemHeight = 14 ;
// ============================================================================
// list box control implementation
@ -881,11 +907,10 @@ void wxListBox::OnChar(wxKeyEvent& event)
if ( !GetEventHandler()->ProcessEvent( new_event ) )
event.Skip() ;
}
else if ( event.KeyCode() == WXK_SPACE || event.KeyCode() == WXK_DOWN || event.KeyCode() == WXK_UP )
else if ( event.KeyCode() == WXK_DOWN || event.KeyCode() == WXK_UP )
{
// perform the default key handling first
if ( event.KeyCode() == WXK_DOWN || event.KeyCode() == WXK_UP )
wxControl::OnKeyDown( event ) ;
wxControl::OnKeyDown( event ) ;
wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, m_windowId);
event.SetEventObject( this );