wxBORDER_THEME now means 'use an appropriate themed border' on all plaforms

as opposed to wxBORDER_NONE which may or may not show a border, depending on control.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@48765 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2007-09-18 14:15:27 +00:00
parent 2fda87f1f7
commit 3a5b0aa5e0
9 changed files with 84 additions and 77 deletions

View File

@@ -87,13 +87,20 @@ Major new features in 2.8 release
wxDirPickerCtrl, wxFilePickerCtrl, wxFontPickerCtrl, wxCollapsiblePane, wxDirPickerCtrl, wxFilePickerCtrl, wxFontPickerCtrl, wxCollapsiblePane,
wxSearchCtrl, wxAboutBox, wxTreebook, tar streams. wxSearchCtrl, wxAboutBox, wxTreebook, tar streams.
2.8.6 2.8.6
----- -----
All (GUI): All (GUI):
- Add support for reading alpha data from TIFF images - Added an optimization to UI updates on idle, by only updating when the window
is shown.
- Multiple centre panes in wxAUI can now be resized.
- Add support for reading alpha data from TIFF images.
wxMSW:
- Fixed a bug with a spurious border appearing on wxStatusBar under Windows XP/Vista.
2.8.5 2.8.5
----- -----

View File

@@ -1111,7 +1111,7 @@ void wxWindowDFB::HandleKeyEvent(const wxDFBWindowEvent& event_)
void wxWindowDFB::OnInternalIdle() void wxWindowDFB::OnInternalIdle()
{ {
if (wxUpdateUIEvent::CanUpdate(this)) if (wxUpdateUIEvent::CanUpdate(this) && IsShown())
UpdateWindowUI(wxUPDATE_UI_FROMIDLE); UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
} }

View File

@@ -1599,7 +1599,7 @@ gtk_window_button_press_callback( GtkWidget *widget,
if ( ret ) if ( ret )
return TRUE; return TRUE;
if ((event_type == wxEVT_LEFT_DOWN) && if ((event_type == wxEVT_LEFT_DOWN) &&
(g_focusWindow != win) && win->AcceptsFocus()) (g_focusWindow != win) && win->AcceptsFocus())
{ {
win->SetFocus(); win->SetFocus();
@@ -1677,9 +1677,9 @@ gtk_window_button_release_callback( GtkWidget *widget,
event.SetId( win->GetId() ); event.SetId( win->GetId() );
bool ret = win->GTKProcessEvent(event); bool ret = win->GTKProcessEvent(event);
g_lastMouseEvent = NULL; g_lastMouseEvent = NULL;
return ret; return ret;
} }
@@ -2806,7 +2806,7 @@ void wxWindowGTK::OnInternalIdle()
} }
} }
if (wxUpdateUIEvent::CanUpdate(this)) if (wxUpdateUIEvent::CanUpdate(this) && IsShown())
UpdateWindowUI(wxUPDATE_UI_FROMIDLE); UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
} }
@@ -4156,7 +4156,7 @@ void wxWindowGTK::SetScrollPos(int orient, int pos, bool WXUNUSED(refresh))
(gpointer)gtk_scrollbar_value_changed, this); (gpointer)gtk_scrollbar_value_changed, this);
gtk_adjustment_value_changed(adj); gtk_adjustment_value_changed(adj);
g_signal_connect_after(m_scrollBar[dir], "value_changed", g_signal_connect_after(m_scrollBar[dir], "value_changed",
G_CALLBACK(gtk_scrollbar_value_changed), this); G_CALLBACK(gtk_scrollbar_value_changed), this);
} }
@@ -4251,7 +4251,7 @@ void wxWindowGTK::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) )
// No scrolling requested. // No scrolling requested.
if ((dx == 0) && (dy == 0)) return; if ((dx == 0) && (dy == 0)) return;
m_clipPaintRegion = true; m_clipPaintRegion = true;
if (GetLayoutDirection() == wxLayout_RightToLeft) if (GetLayoutDirection() == wxLayout_RightToLeft)

View File

@@ -1583,7 +1583,7 @@ static gint gtk_window_button_press_callback( GtkWidget *widget,
} }
g_lastMouseEvent = (GdkEvent*) gdk_event; g_lastMouseEvent = (GdkEvent*) gdk_event;
wxMouseEvent event( event_type ); wxMouseEvent event( event_type );
InitMouseEvent( win, event, gdk_event ); InitMouseEvent( win, event, gdk_event );
@@ -1686,7 +1686,7 @@ static gint gtk_window_button_release_callback( GtkWidget *widget,
} }
g_lastMouseEvent = (GdkEvent*) gdk_event; g_lastMouseEvent = (GdkEvent*) gdk_event;
wxMouseEvent event( event_type ); wxMouseEvent event( event_type );
InitMouseEvent( win, event, gdk_event ); InitMouseEvent( win, event, gdk_event );
@@ -2958,7 +2958,7 @@ void wxWindowGTK::OnInternalIdle()
} }
} }
if (wxUpdateUIEvent::CanUpdate(this)) if (wxUpdateUIEvent::CanUpdate(this) && IsShown())
UpdateWindowUI(wxUPDATE_UI_FROMIDLE); UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
} }

View File

@@ -271,7 +271,7 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl
float alpha = 1.0 ; float alpha = 1.0 ;
{ {
wxWindowMac* iter = thisWindow ; wxWindowMac* iter = thisWindow ;
while ( iter ) while ( iter )
{ {
alpha *= (float) iter->GetTransparent()/255.0 ; alpha *= (float) iter->GetTransparent()/255.0 ;
if ( iter->IsTopLevel() ) if ( iter->IsTopLevel() )
@@ -310,7 +310,7 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl
case kEventControlHiliteChanged : case kEventControlHiliteChanged :
thisWindow->MacHiliteChanged() ; thisWindow->MacHiliteChanged() ;
break ; break ;
case kEventControlActivate : case kEventControlActivate :
case kEventControlDeactivate : case kEventControlDeactivate :
// FIXME: we should have a virtual function for this! // FIXME: we should have a virtual function for this!
@@ -382,7 +382,7 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl
case kEventControlGetClickActivation : case kEventControlGetClickActivation :
{ {
// fix to always have a proper activation for DataBrowser controls (stay in bkgnd otherwise) // fix to always have a proper activation for DataBrowser controls (stay in bkgnd otherwise)
WindowRef owner = cEvent.GetParameter<WindowRef>(kEventParamWindowRef); WindowRef owner = cEvent.GetParameter<WindowRef>(kEventParamWindowRef);
if ( !IsWindowActive(owner) ) if ( !IsWindowActive(owner) )
{ {
@@ -451,12 +451,12 @@ static pascal OSStatus wxMacWindowServiceEventHandler( EventHandlerCallRef handl
textCtrl->GetSelection( &from , &to ) ; textCtrl->GetSelection( &from , &to ) ;
wxString val = textCtrl->GetValue() ; wxString val = textCtrl->GetValue() ;
val = val.Mid( from , to - from ) ; val = val.Mid( from , to - from ) ;
PasteboardRef pasteboard = cEvent.GetParameter<PasteboardRef>( kEventParamPasteboardRef, typePasteboardRef ); PasteboardRef pasteboard = cEvent.GetParameter<PasteboardRef>( kEventParamPasteboardRef, typePasteboardRef );
verify_noerr( PasteboardClear( pasteboard ) ) ; verify_noerr( PasteboardClear( pasteboard ) ) ;
PasteboardSynchronize( pasteboard ); PasteboardSynchronize( pasteboard );
CFDataRef data = CFDataCreate( kCFAllocatorDefault, (UInt8*)val.c_str(), val.length() ); CFDataRef data = CFDataCreate( kCFAllocatorDefault, (UInt8*)val.c_str(), val.length() );
PasteboardPutItemFlavor( pasteboard, (PasteboardItemID) 1, CFSTR("com.apple.traditional-mac-plain-text"), data, 0); PasteboardPutItemFlavor( pasteboard, (PasteboardItemID) 1, CFSTR("com.apple.traditional-mac-plain-text"), data, 0);
CFRelease( data ); CFRelease( data );
result = noErr ; result = noErr ;
} }
break ; break ;
@@ -464,34 +464,34 @@ static pascal OSStatus wxMacWindowServiceEventHandler( EventHandlerCallRef handl
case kEventServicePaste : case kEventServicePaste :
if ( textCtrl ) if ( textCtrl )
{ {
PasteboardRef pasteboard = cEvent.GetParameter<PasteboardRef>( kEventParamPasteboardRef, typePasteboardRef ); PasteboardRef pasteboard = cEvent.GetParameter<PasteboardRef>( kEventParamPasteboardRef, typePasteboardRef );
PasteboardSynchronize( pasteboard ); PasteboardSynchronize( pasteboard );
ItemCount itemCount; ItemCount itemCount;
verify_noerr( PasteboardGetItemCount( pasteboard, &itemCount ) ); verify_noerr( PasteboardGetItemCount( pasteboard, &itemCount ) );
for( UInt32 itemIndex = 1; itemIndex <= itemCount; itemIndex++ ) for( UInt32 itemIndex = 1; itemIndex <= itemCount; itemIndex++ )
{ {
PasteboardItemID itemID; PasteboardItemID itemID;
if ( PasteboardGetItemIdentifier( pasteboard, itemIndex, &itemID ) == noErr ) if ( PasteboardGetItemIdentifier( pasteboard, itemIndex, &itemID ) == noErr )
{ {
CFDataRef flavorData = NULL; CFDataRef flavorData = NULL;
if ( PasteboardCopyItemFlavorData( pasteboard, itemID, CFSTR("com.apple.traditional-mac-plain-text"), &flavorData ) == noErr ) if ( PasteboardCopyItemFlavorData( pasteboard, itemID, CFSTR("com.apple.traditional-mac-plain-text"), &flavorData ) == noErr )
{ {
CFIndex flavorDataSize = CFDataGetLength( flavorData ); CFIndex flavorDataSize = CFDataGetLength( flavorData );
char *content = new char[flavorDataSize+1] ; char *content = new char[flavorDataSize+1] ;
memcpy( content, CFDataGetBytePtr( flavorData ), flavorDataSize ); memcpy( content, CFDataGetBytePtr( flavorData ), flavorDataSize );
content[flavorDataSize]=0; content[flavorDataSize]=0;
CFRelease( flavorData ); CFRelease( flavorData );
#if wxUSE_UNICODE #if wxUSE_UNICODE
textCtrl->WriteText( wxString( content , wxConvLocal ) ); textCtrl->WriteText( wxString( content , wxConvLocal ) );
#else #else
textCtrl->WriteText( wxString( content ) ) ; textCtrl->WriteText( wxString( content ) ) ;
#endif #endif
delete[] content ; delete[] content ;
result = noErr ; result = noErr ;
} }
} }
} }
} }
break ; break ;
@@ -529,7 +529,7 @@ pascal OSStatus wxMacUnicodeTextEventHandler( EventHandlerCallRef handler , Even
charBuf[ numChars - 1 ] = 0; charBuf[ numChars - 1 ] = 0;
#if SIZEOF_WCHAR_T == 2 #if SIZEOF_WCHAR_T == 2
uniChars = (wchar_t*) charBuf ; uniChars = (wchar_t*) charBuf ;
/* memcpy( uniChars , charBuf , numChars * 2 ) ;*/ // is there any point in copying charBuf over itself? (in fact, memcpy isn't even guaranteed to work correctly if the source and destination ranges overlap...) /* memcpy( uniChars , charBuf , numChars * 2 ) ;*/ // is there any point in copying charBuf over itself? (in fact, memcpy isn't even guaranteed to work correctly if the source and destination ranges overlap...)
#else #else
// the resulting string will never have more chars than the utf16 version, so this is safe // the resulting string will never have more chars than the utf16 version, so this is safe
wxMBConvUTF16 converter ; wxMBConvUTF16 converter ;
@@ -551,29 +551,29 @@ pascal OSStatus wxMacUnicodeTextEventHandler( EventHandlerCallRef handler , Even
UInt32 message = uniChars[pos] < 128 ? (char)uniChars[pos] : '?'; UInt32 message = uniChars[pos] < 128 ? (char)uniChars[pos] : '?';
/* /*
NB: faking a charcode here is problematic. The kEventTextInputUpdateActiveInputArea event is sent NB: faking a charcode here is problematic. The kEventTextInputUpdateActiveInputArea event is sent
multiple times to update the active range during inline input, so this handler will often receive multiple times to update the active range during inline input, so this handler will often receive
uncommited text, which should usually not trigger side effects. It might be a good idea to check the uncommited text, which should usually not trigger side effects. It might be a good idea to check the
kEventParamTextInputSendFixLen parameter and verify if input is being confirmed (see CarbonEvents.h). kEventParamTextInputSendFixLen parameter and verify if input is being confirmed (see CarbonEvents.h).
On the other hand, it can be useful for some applications to react to uncommitted text (for example, On the other hand, it can be useful for some applications to react to uncommitted text (for example,
to update a status display), as long as it does not disrupt the inline input session. Ideally, wx to update a status display), as long as it does not disrupt the inline input session. Ideally, wx
should add new event types to support advanced text input. For now, I would keep things as they are. should add new event types to support advanced text input. For now, I would keep things as they are.
However, the code that was being used caused additional problems: However, the code that was being used caused additional problems:
UInt32 message = (0 << 8) + ((char)uniChars[pos] ); UInt32 message = (0 << 8) + ((char)uniChars[pos] );
Since it simply truncated the unichar to the last byte, it ended up causing weird bugs with inline Since it simply truncated the unichar to the last byte, it ended up causing weird bugs with inline
input, such as switching to another field when one attempted to insert the character U+4E09 (the kanji input, such as switching to another field when one attempted to insert the character U+4E09 (the kanji
for "three"), because it was truncated to 09 (kTabCharCode), which was later "converted" to WXK_TAB for "three"), because it was truncated to 09 (kTabCharCode), which was later "converted" to WXK_TAB
(still 09) in wxMacTranslateKey; or triggering the default button when one attempted to insert U+840D (still 09) in wxMacTranslateKey; or triggering the default button when one attempted to insert U+840D
(the kanji for "name"), which got truncated to 0D and interpreted as a carriage return keypress. (the kanji for "name"), which got truncated to 0D and interpreted as a carriage return keypress.
Note that even single-byte characters could have been misinterpreted, since MacRoman charcodes only Note that even single-byte characters could have been misinterpreted, since MacRoman charcodes only
overlap with Unicode within the (7-bit) ASCII range. overlap with Unicode within the (7-bit) ASCII range.
But simply passing a NUL charcode would disable text updated events, because wxTextCtrl::OnChar checks But simply passing a NUL charcode would disable text updated events, because wxTextCtrl::OnChar checks
for codes within a specific range. Therefore I went for the solution seen above, which keeps ASCII for codes within a specific range. Therefore I went for the solution seen above, which keeps ASCII
characters as they are and replaces the rest with '?', ensuring that update events are triggered. characters as they are and replaces the rest with '?', ensuring that update events are triggered.
It would be better to change wxTextCtrl::OnChar to look at the actual unicode character instead, but It would be better to change wxTextCtrl::OnChar to look at the actual unicode character instead, but
I don't have time to look into that right now. I don't have time to look into that right now.
-- CL -- CL
*/ */
if ( wxTheApp->MacSendCharEvent((wxWindow*) if ( wxTheApp->MacSendCharEvent((wxWindow*)
focus , message , 0 , when , 0 , 0 , uniChars[pos] ) ) focus , message , 0 , when , 0 , 0 , uniChars[pos] ) )
@@ -1778,7 +1778,7 @@ bool wxWindowMac::SetCursor(const wxCursor& cursor)
HIGetMousePosition(kHICoordSpaceWindow, window, &hiPoint); HIGetMousePosition(kHICoordSpaceWindow, window, &hiPoint);
pt.h = hiPoint.x; pt.h = hiPoint.x;
pt.v = hiPoint.y; pt.v = hiPoint.y;
#else #else
CGrafPtr savePort ; CGrafPtr savePort ;
Boolean swapped = QDSwapPort( GetWindowPort( window ) , &savePort ) ; Boolean swapped = QDSwapPort( GetWindowPort( window ) , &savePort ) ;
@@ -2516,7 +2516,7 @@ void wxWindowMac::MacPaintBorders( int leftOrigin , int rightOrigin )
m_peer->GetRect( &rect ) ; m_peer->GetRect( &rect ) ;
InsetRect( &rect, -1 , -1 ) ; InsetRect( &rect, -1 , -1 ) ;
#if wxMAC_USE_CORE_GRAPHICS #if wxMAC_USE_CORE_GRAPHICS
{ {
CGRect cgrect = CGRectMake( rect.left , rect.top , rect.right - rect.left , CGRect cgrect = CGRectMake( rect.left , rect.top , rect.right - rect.left ,
rect.bottom - rect.top ) ; rect.bottom - rect.top ) ;
@@ -2815,7 +2815,7 @@ void wxWindowMac::OnInternalIdle()
{ {
// This calls the UI-update mechanism (querying windows for // This calls the UI-update mechanism (querying windows for
// menu/toolbar/control state information) // menu/toolbar/control state information)
if (wxUpdateUIEvent::CanUpdate(this)) if (wxUpdateUIEvent::CanUpdate(this) && IsShown())
UpdateWindowUI(wxUPDATE_UI_FROMIDLE); UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
} }
@@ -3123,7 +3123,7 @@ bool wxWindowMac::MacDoRedraw( WXHRGN updatergnr , long time )
eventNc.SetEventObject( child ); eventNc.SetEventObject( child );
if ( !child->GetEventHandler()->ProcessEvent( eventNc ) ) if ( !child->GetEventHandler()->ProcessEvent( eventNc ) )
{ {
#if wxMAC_USE_CORE_GRAPHICS #if wxMAC_USE_CORE_GRAPHICS
child->MacPaintBorders(0, 0) ; child->MacPaintBorders(0, 0) ;
#else #else
{ {
@@ -3195,7 +3195,7 @@ bool wxWindowMac::MacHasScrollBarCorner() const
const wxFrame *frame = wxDynamicCast( win, wxFrame ) ; const wxFrame *frame = wxDynamicCast( win, wxFrame ) ;
if ( frame ) if ( frame )
{ {
if ( frame->GetWindowStyleFlag() & wxRESIZE_BORDER ) if ( frame->GetWindowStyleFlag() & wxRESIZE_BORDER )
{ {
// Parent frame has resize handle // Parent frame has resize handle
wxPoint frameBottomRight = frame->GetScreenRect().GetBottomRight(); wxPoint frameBottomRight = frame->GetScreenRect().GetBottomRight();
@@ -3534,7 +3534,7 @@ bool wxWindowMac::CanSetTransparent()
#endif #endif
} }
wxByte wxWindowMac::GetTransparent() const wxByte wxWindowMac::GetTransparent() const
{ {
return m_macAlpha ; return m_macAlpha ;
} }

View File

@@ -1225,6 +1225,6 @@ wxWindow* wxFindWindowAtPoint(const wxPoint& pt)
void wxWindowMGL::OnInternalIdle() void wxWindowMGL::OnInternalIdle()
{ {
if (wxUpdateUIEvent::CanUpdate(this)) if (wxUpdateUIEvent::CanUpdate(this) && IsShown())
UpdateWindowUI(wxUPDATE_UI_FROMIDLE); UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
} }

View File

@@ -1644,7 +1644,7 @@ void wxWindow::OnInternalIdle()
{ {
// This calls the UI-update mechanism (querying windows for // This calls the UI-update mechanism (querying windows for
// menu/toolbar/control state information) // menu/toolbar/control state information)
if (wxUpdateUIEvent::CanUpdate(this)) if (wxUpdateUIEvent::CanUpdate(this) && IsShown())
UpdateWindowUI(wxUPDATE_UI_FROMIDLE); UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
} }

View File

@@ -1479,7 +1479,7 @@ void wxWindowMSW::OnInternalIdle()
} }
#endif // !HAVE_TRACKMOUSEEVENT #endif // !HAVE_TRACKMOUSEEVENT
if (wxUpdateUIEvent::CanUpdate(this)) if (wxUpdateUIEvent::CanUpdate(this) && IsShown())
UpdateWindowUI(wxUPDATE_UI_FROMIDLE); UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
} }

View File

@@ -1308,7 +1308,7 @@ void wxWindowX11::OnInternalIdle()
// This calls the UI-update mechanism (querying windows for // This calls the UI-update mechanism (querying windows for
// menu/toolbar/control state information) // menu/toolbar/control state information)
if (wxUpdateUIEvent::CanUpdate((wxWindow*) this)) if (wxUpdateUIEvent::CanUpdate((wxWindow*) this) && IsShown())
UpdateWindowUI(wxUPDATE_UI_FROMIDLE); UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
// Set the input focus if couldn't do it before // Set the input focus if couldn't do it before