int wxEntry( int argc, char *argv[] )
{
+#ifdef __MWERKS__
+#if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT
+ // This seems to be necessary since there are 'rogue'
+ // objects present at this point (perhaps global objects?)
+ // Setting a checkpoint will ignore them as far as the
+ // memory checking facility is concerned.
+ // Of course you may argue that memory allocated in globals should be
+ // checked, but this is a reasonable compromise.
+ wxDebugContext::SetCheckpoint();
+#endif
+#endif
if (!wxApp::Initialize())
return FALSE;
if (!wxTheApp)
}
}
-long wxMacTranslateKey(char key, char code)
+long wxMacTranslateKey(unsigned char key, unsigned char code)
{
+ long retval = key ;
switch (key)
{
case 0x01 :
- key = WXK_HOME;
+ retval = WXK_HOME;
break;
case 0x03 :
- key = WXK_RETURN;
+ retval = WXK_RETURN;
break;
case 0x04 :
- key = WXK_END;
+ retval = WXK_END;
break;
case 0x05 :
- key = WXK_HELP;
+ retval = WXK_HELP;
break;
case 0x08 :
- key = WXK_BACK;
+ retval = WXK_BACK;
break;
case 0x09 :
- key = WXK_TAB;
+ retval = WXK_TAB;
break;
case 0x0b :
- key = WXK_PAGEUP;
+ retval = WXK_PAGEUP;
break;
case 0x0c :
- key = WXK_PAGEDOWN;
+ retval = WXK_PAGEDOWN;
break;
case 0x0d :
- key = WXK_RETURN;
+ retval = WXK_RETURN;
break;
case 0x10 :
{
switch( code )
{
case 0x7a :
- key = WXK_F1 ;
+ retval = WXK_F1 ;
break;
case 0x78 :
- key = WXK_F2 ;
+ retval = WXK_F2 ;
break;
case 0x63 :
- key = WXK_F3 ;
+ retval = WXK_F3 ;
break;
case 0x76 :
- key = WXK_F4 ;
+ retval = WXK_F4 ;
break;
case 0x60 :
- key = WXK_F5 ;
+ retval = WXK_F5 ;
break;
case 0x61 :
- key = WXK_F6 ;
+ retval = WXK_F6 ;
break;
case 0x62:
- key = WXK_F7 ;
+ retval = WXK_F7 ;
break;
case 0x64 :
- key = WXK_F8 ;
+ retval = WXK_F8 ;
break;
case 0x65 :
- key = WXK_F9 ;
+ retval = WXK_F9 ;
break;
case 0x6D :
- key = WXK_F10 ;
+ retval = WXK_F10 ;
break;
case 0x67 :
- key = WXK_F11 ;
+ retval = WXK_F11 ;
break;
case 0x6F :
- key = WXK_F12 ;
+ retval = WXK_F12 ;
break;
case 0x69 :
- key = WXK_F13 ;
+ retval = WXK_F13 ;
break;
case 0x6B :
- key = WXK_F14 ;
+ retval = WXK_F14 ;
break;
case 0x71 :
- key = WXK_F15 ;
+ retval = WXK_F15 ;
break;
}
}
break ;
case 0x1b :
- key = WXK_DELETE ;
+ retval = WXK_ESCAPE ;
break ;
case 0x1c :
- key = WXK_LEFT ;
+ retval = WXK_LEFT ;
break ;
case 0x1d :
- key = WXK_RIGHT ;
+ retval = WXK_RIGHT ;
break ;
case 0x1e :
- key = WXK_UP ;
+ retval = WXK_UP ;
break ;
case 0x1f :
- key = WXK_DOWN ;
+ retval = WXK_DOWN ;
break ;
+ case 0x7F :
+ retval = WXK_DELETE ;
default:
break ;
} // end switch
- return key;
+ return retval;
}
void wxApp::MacHandleKeyDownEvent( EventRecord *ev )
wxWindow* focus = wxWindow::FindFocus() ;
if ( focus )
{
- wxKeyEvent event(wxEVT_CHAR);
+ long keyval = wxMacTranslateKey(keychar, keycode) ;
+
+ wxKeyEvent event(wxEVT_KEY_DOWN);
event.m_shiftDown = ev->modifiers & shiftKey;
event.m_controlDown = ev->modifiers & controlKey;
event.m_altDown = ev->modifiers & optionKey;
event.m_metaDown = ev->modifiers & cmdKey;
- event.m_keyCode = wxMacTranslateKey(keychar, keycode);
+ event.m_keyCode = keyval;
event.m_x = ev->where.h;
event.m_y = ev->where.v;
event.m_timeStamp = ev->when;
event.SetEventObject(focus);
- focus->GetEventHandler()->ProcessEvent( event ) ;
+ bool handled = focus->GetEventHandler()->ProcessEvent( event ) ;
+ if ( !handled )
+ {
+ #if wxUSE_ACCEL
+ if (!handled)
+ {
+ wxWindow *ancestor = focus;
+ /*
+ while (ancestor)
+ {
+ int command = ancestor->GetAcceleratorTable()->GetCommand( event );
+ if (command != -1)
+ {
+ wxCommandEvent command_event( wxEVT_COMMAND_MENU_SELECTED, command );
+ handled = ancestor->GetEventHandler()->ProcessEvent( command_event );
+ break;
+ }
+ if (ancestor->m_isFrame)
+ break;
+ ancestor = ancestor->GetParent();
+ }
+ */
+ }
+ #endif // wxUSE_ACCEL
+ }
+ if (!handled)
+ {
+ wxKeyEvent event(wxEVT_CHAR);
+ event.m_shiftDown = ev->modifiers & shiftKey;
+ event.m_controlDown = ev->modifiers & controlKey;
+ event.m_altDown = ev->modifiers & optionKey;
+ event.m_metaDown = ev->modifiers & cmdKey;
+ event.m_keyCode = keyval;
+ event.m_x = ev->where.h;
+ event.m_y = ev->where.v;
+ event.m_timeStamp = ev->when;
+ event.SetEventObject(focus);
+ handled = focus->GetEventHandler()->ProcessEvent( event ) ;
+ }
+ if ( !handled &&
+ (keyval == WXK_TAB) &&
+ (!focus->HasFlag(wxTE_PROCESS_TAB)) &&
+ (focus->GetParent()) &&
+ (focus->GetParent()->HasFlag( wxTAB_TRAVERSAL)) )
+ {
+ wxNavigationKeyEvent new_event;
+ new_event.SetEventObject( focus );
+ new_event.SetDirection( !event.ShiftDown() );
+ /* CTRL-TAB changes the (parent) window, i.e. switch notebook page */
+ new_event.SetWindowChange( event.ControlDown() );
+ new_event.SetCurrentFocus( focus );
+ handled = focus->GetEventHandler()->ProcessEvent( new_event );
+ }
+ /* generate wxID_CANCEL if command-. or <esc> has been pressed (typically in dialogs) */
+ if ( (!handled) &&
+ (keyval == '.' && event.ControlDown() ) )
+ {
+ wxCommandEvent new_event(wxEVT_COMMAND_BUTTON_CLICKED,wxID_CANCEL);
+ new_event.SetEventObject( focus );
+ handled = focus->GetEventHandler()->ProcessEvent( new_event );
+ }
}
}
}
IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton, wxButton)
#endif
+#include <wx/mac/uma.h>
+
+PicHandle MakePict(GWorldPtr wp) ;
+
bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bitmap,
const wxPoint& pos,
const wxSize& size, long style,
const wxString& name)
{
m_buttonBitmap = bitmap;
- SetName(name);
- SetValidator(validator);
- parent->AddChild(this);
-
- m_backgroundColour = parent->GetBackgroundColour() ;
- m_foregroundColour = parent->GetForegroundColour() ;
- m_windowStyle = style;
+
m_marginX = 0;
m_marginY = 0;
if ( height == -1 && bitmap.Ok())
height = bitmap.GetHeight() + 2*m_marginY;
- /* TODO: create bitmap button
- */
+ m_macHorizontalBorder = 2 ; // additional pixels around the real control
+ m_macVerticalBorder = 2 ;
+ Rect bounds ;
+ Str255 title ;
+ MacPreControlCreate( parent , id , "" , pos , wxSize( width , height ) ,style, validator , name , &bounds , title ) ;
+
+ m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 ,
+ kControlBehaviorOffsetContents + kControlContentPictHandle , 0,
+ kControlBevelButtonNormalBevelProc , (long) this ) ;
+ wxASSERT_MSG( m_macControl != NULL , "No valid mac control" ) ;
+
+ m_buttonBitmap = bitmap;
+ PicHandle icon = NULL ;
+ if ( m_buttonBitmap.Ok() )
+ {
+ wxBitmapRefData * bmap = (wxBitmapRefData*) ( m_buttonBitmap.GetRefData()) ;
+ if ( bmap->m_bitmapType == kMacBitmapTypePict )
+ icon = bmap->m_hPict ;
+ else if ( bmap->m_bitmapType == kMacBitmapTypeGrafWorld )
+ {
+ icon = MakePict( bmap->m_hBitmap ) ;
+ }
+ }
+ ControlButtonContentInfo info ;
+
+ info.contentType = kControlContentPictHandle ;
+ info.u.picture = icon ;
+
+ UMASetControlData( m_macControl , kControlButtonPart , kControlBevelButtonContentTag , sizeof(info) , (char*) &info ) ;
+
+ MacPostControlCreate() ;
- return FALSE;
+ return TRUE;
}
void wxBitmapButton::SetBitmapLabel(const wxBitmap& bitmap)
{
m_buttonBitmap = bitmap;
+ PicHandle icon = NULL ;
+ if ( m_buttonBitmap.Ok() )
+ {
+ wxBitmapRefData * bmap = (wxBitmapRefData*) ( m_buttonBitmap.GetRefData()) ;
+ if ( bmap->m_bitmapType == kMacBitmapTypePict )
+ icon = bmap->m_hPict ;
+ else if ( bmap->m_bitmapType == kMacBitmapTypeGrafWorld )
+ {
+ icon = MakePict( bmap->m_hBitmap ) ;
+ }
+ }
+ ControlButtonContentInfo info ;
+
+ info.contentType = kControlContentPictHandle ;
+ info.u.picture = icon ;
+
+ UMASetControlData( m_macControl , kControlButtonPart , kControlBevelButtonContentTag , sizeof(info) , (char*) &info ) ;
}
int wxEntry( int argc, char *argv[] )
{
+#ifdef __MWERKS__
+#if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT
+ // This seems to be necessary since there are 'rogue'
+ // objects present at this point (perhaps global objects?)
+ // Setting a checkpoint will ignore them as far as the
+ // memory checking facility is concerned.
+ // Of course you may argue that memory allocated in globals should be
+ // checked, but this is a reasonable compromise.
+ wxDebugContext::SetCheckpoint();
+#endif
+#endif
if (!wxApp::Initialize())
return FALSE;
if (!wxTheApp)
}
}
-long wxMacTranslateKey(char key, char code)
+long wxMacTranslateKey(unsigned char key, unsigned char code)
{
+ long retval = key ;
switch (key)
{
case 0x01 :
- key = WXK_HOME;
+ retval = WXK_HOME;
break;
case 0x03 :
- key = WXK_RETURN;
+ retval = WXK_RETURN;
break;
case 0x04 :
- key = WXK_END;
+ retval = WXK_END;
break;
case 0x05 :
- key = WXK_HELP;
+ retval = WXK_HELP;
break;
case 0x08 :
- key = WXK_BACK;
+ retval = WXK_BACK;
break;
case 0x09 :
- key = WXK_TAB;
+ retval = WXK_TAB;
break;
case 0x0b :
- key = WXK_PAGEUP;
+ retval = WXK_PAGEUP;
break;
case 0x0c :
- key = WXK_PAGEDOWN;
+ retval = WXK_PAGEDOWN;
break;
case 0x0d :
- key = WXK_RETURN;
+ retval = WXK_RETURN;
break;
case 0x10 :
{
switch( code )
{
case 0x7a :
- key = WXK_F1 ;
+ retval = WXK_F1 ;
break;
case 0x78 :
- key = WXK_F2 ;
+ retval = WXK_F2 ;
break;
case 0x63 :
- key = WXK_F3 ;
+ retval = WXK_F3 ;
break;
case 0x76 :
- key = WXK_F4 ;
+ retval = WXK_F4 ;
break;
case 0x60 :
- key = WXK_F5 ;
+ retval = WXK_F5 ;
break;
case 0x61 :
- key = WXK_F6 ;
+ retval = WXK_F6 ;
break;
case 0x62:
- key = WXK_F7 ;
+ retval = WXK_F7 ;
break;
case 0x64 :
- key = WXK_F8 ;
+ retval = WXK_F8 ;
break;
case 0x65 :
- key = WXK_F9 ;
+ retval = WXK_F9 ;
break;
case 0x6D :
- key = WXK_F10 ;
+ retval = WXK_F10 ;
break;
case 0x67 :
- key = WXK_F11 ;
+ retval = WXK_F11 ;
break;
case 0x6F :
- key = WXK_F12 ;
+ retval = WXK_F12 ;
break;
case 0x69 :
- key = WXK_F13 ;
+ retval = WXK_F13 ;
break;
case 0x6B :
- key = WXK_F14 ;
+ retval = WXK_F14 ;
break;
case 0x71 :
- key = WXK_F15 ;
+ retval = WXK_F15 ;
break;
}
}
break ;
case 0x1b :
- key = WXK_DELETE ;
+ retval = WXK_ESCAPE ;
break ;
case 0x1c :
- key = WXK_LEFT ;
+ retval = WXK_LEFT ;
break ;
case 0x1d :
- key = WXK_RIGHT ;
+ retval = WXK_RIGHT ;
break ;
case 0x1e :
- key = WXK_UP ;
+ retval = WXK_UP ;
break ;
case 0x1f :
- key = WXK_DOWN ;
+ retval = WXK_DOWN ;
break ;
+ case 0x7F :
+ retval = WXK_DELETE ;
default:
break ;
} // end switch
- return key;
+ return retval;
}
void wxApp::MacHandleKeyDownEvent( EventRecord *ev )
wxWindow* focus = wxWindow::FindFocus() ;
if ( focus )
{
- wxKeyEvent event(wxEVT_CHAR);
+ long keyval = wxMacTranslateKey(keychar, keycode) ;
+
+ wxKeyEvent event(wxEVT_KEY_DOWN);
event.m_shiftDown = ev->modifiers & shiftKey;
event.m_controlDown = ev->modifiers & controlKey;
event.m_altDown = ev->modifiers & optionKey;
event.m_metaDown = ev->modifiers & cmdKey;
- event.m_keyCode = wxMacTranslateKey(keychar, keycode);
+ event.m_keyCode = keyval;
event.m_x = ev->where.h;
event.m_y = ev->where.v;
event.m_timeStamp = ev->when;
event.SetEventObject(focus);
- focus->GetEventHandler()->ProcessEvent( event ) ;
+ bool handled = focus->GetEventHandler()->ProcessEvent( event ) ;
+ if ( !handled )
+ {
+ #if wxUSE_ACCEL
+ if (!handled)
+ {
+ wxWindow *ancestor = focus;
+ /*
+ while (ancestor)
+ {
+ int command = ancestor->GetAcceleratorTable()->GetCommand( event );
+ if (command != -1)
+ {
+ wxCommandEvent command_event( wxEVT_COMMAND_MENU_SELECTED, command );
+ handled = ancestor->GetEventHandler()->ProcessEvent( command_event );
+ break;
+ }
+ if (ancestor->m_isFrame)
+ break;
+ ancestor = ancestor->GetParent();
+ }
+ */
+ }
+ #endif // wxUSE_ACCEL
+ }
+ if (!handled)
+ {
+ wxKeyEvent event(wxEVT_CHAR);
+ event.m_shiftDown = ev->modifiers & shiftKey;
+ event.m_controlDown = ev->modifiers & controlKey;
+ event.m_altDown = ev->modifiers & optionKey;
+ event.m_metaDown = ev->modifiers & cmdKey;
+ event.m_keyCode = keyval;
+ event.m_x = ev->where.h;
+ event.m_y = ev->where.v;
+ event.m_timeStamp = ev->when;
+ event.SetEventObject(focus);
+ handled = focus->GetEventHandler()->ProcessEvent( event ) ;
+ }
+ if ( !handled &&
+ (keyval == WXK_TAB) &&
+ (!focus->HasFlag(wxTE_PROCESS_TAB)) &&
+ (focus->GetParent()) &&
+ (focus->GetParent()->HasFlag( wxTAB_TRAVERSAL)) )
+ {
+ wxNavigationKeyEvent new_event;
+ new_event.SetEventObject( focus );
+ new_event.SetDirection( !event.ShiftDown() );
+ /* CTRL-TAB changes the (parent) window, i.e. switch notebook page */
+ new_event.SetWindowChange( event.ControlDown() );
+ new_event.SetCurrentFocus( focus );
+ handled = focus->GetEventHandler()->ProcessEvent( new_event );
+ }
+ /* generate wxID_CANCEL if command-. or <esc> has been pressed (typically in dialogs) */
+ if ( (!handled) &&
+ (keyval == '.' && event.ControlDown() ) )
+ {
+ wxCommandEvent new_event(wxEVT_COMMAND_BUTTON_CLICKED,wxID_CANCEL);
+ new_event.SetEventObject( focus );
+ handled = focus->GetEventHandler()->ProcessEvent( new_event );
+ }
}
}
}
IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton, wxButton)
#endif
+#include <wx/mac/uma.h>
+
+PicHandle MakePict(GWorldPtr wp) ;
+
bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bitmap,
const wxPoint& pos,
const wxSize& size, long style,
const wxString& name)
{
m_buttonBitmap = bitmap;
- SetName(name);
- SetValidator(validator);
- parent->AddChild(this);
-
- m_backgroundColour = parent->GetBackgroundColour() ;
- m_foregroundColour = parent->GetForegroundColour() ;
- m_windowStyle = style;
+
m_marginX = 0;
m_marginY = 0;
if ( height == -1 && bitmap.Ok())
height = bitmap.GetHeight() + 2*m_marginY;
- /* TODO: create bitmap button
- */
+ m_macHorizontalBorder = 2 ; // additional pixels around the real control
+ m_macVerticalBorder = 2 ;
+ Rect bounds ;
+ Str255 title ;
+ MacPreControlCreate( parent , id , "" , pos , wxSize( width , height ) ,style, validator , name , &bounds , title ) ;
+
+ m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 ,
+ kControlBehaviorOffsetContents + kControlContentPictHandle , 0,
+ kControlBevelButtonNormalBevelProc , (long) this ) ;
+ wxASSERT_MSG( m_macControl != NULL , "No valid mac control" ) ;
+
+ m_buttonBitmap = bitmap;
+ PicHandle icon = NULL ;
+ if ( m_buttonBitmap.Ok() )
+ {
+ wxBitmapRefData * bmap = (wxBitmapRefData*) ( m_buttonBitmap.GetRefData()) ;
+ if ( bmap->m_bitmapType == kMacBitmapTypePict )
+ icon = bmap->m_hPict ;
+ else if ( bmap->m_bitmapType == kMacBitmapTypeGrafWorld )
+ {
+ icon = MakePict( bmap->m_hBitmap ) ;
+ }
+ }
+ ControlButtonContentInfo info ;
+
+ info.contentType = kControlContentPictHandle ;
+ info.u.picture = icon ;
+
+ UMASetControlData( m_macControl , kControlButtonPart , kControlBevelButtonContentTag , sizeof(info) , (char*) &info ) ;
+
+ MacPostControlCreate() ;
- return FALSE;
+ return TRUE;
}
void wxBitmapButton::SetBitmapLabel(const wxBitmap& bitmap)
{
m_buttonBitmap = bitmap;
+ PicHandle icon = NULL ;
+ if ( m_buttonBitmap.Ok() )
+ {
+ wxBitmapRefData * bmap = (wxBitmapRefData*) ( m_buttonBitmap.GetRefData()) ;
+ if ( bmap->m_bitmapType == kMacBitmapTypePict )
+ icon = bmap->m_hPict ;
+ else if ( bmap->m_bitmapType == kMacBitmapTypeGrafWorld )
+ {
+ icon = MakePict( bmap->m_hBitmap ) ;
+ }
+ }
+ ControlButtonContentInfo info ;
+
+ info.contentType = kControlContentPictHandle ;
+ info.u.picture = icon ;
+
+ UMASetControlData( m_macControl , kControlButtonPart , kControlBevelButtonContentTag , sizeof(info) , (char*) &info ) ;
}
wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, m_windowId );
event.SetInt(GetSelection());
event.SetEventObject(this);
- event.SetString(copystring(GetStringSelection()));
+ event.SetString(GetStringSelection());
ProcessCommand(event);
- delete[] event.GetString();
}
{
Width = width; Height = height; Depth = depth;
ColorType = (colortype>=0) ? colortype: ((Depth>8) ? COLORTYPE_COLOR: 0);
+ delete Palette;
+ delete[] RawImage ;
+ RawImage = 0;
+ Palette = 0;
if (lpbi)
{
wxMacDestroyGWorld( lpbi ) ;
-// delete Palette;
}
- RawImage = 0;
- Palette = 0;
if (lpbi = wxMacCreateGWorld( Width , Height , Depth) )
{
EfeWidth = (long)(((long)Width*Depth + 31) / 32) * 4;
bool wxPNGReader::SetPalette(wxPalette* colourmap)
{
+ delete Palette ;
if (!colourmap)
return FALSE;
ColorType |= (COLORTYPE_PALETTE | COLORTYPE_COLOR);
- Palette = colourmap;
+ Palette = new wxPalette( *colourmap );
return true ;
// return (DibSetUsage(lpbi, (HPALETTE) Palette->GetHPALETTE(), WXIMA_COLORS ) != 0);
}
bool
wxPNGReader::SetPalette(int n, byte *r, byte *g, byte *b)
{
+ delete Palette ;
Palette = new wxPalette();
if (!Palette)
return FALSE;
bool
wxPNGReader::SetPalette(int n, rgb_color_struct *rgb_struct)
{
+ delete Palette ;
Palette = new wxPalette();
if (!Palette)
return FALSE;
void wxPNGReader::NullData()
{
+ if (lpbi) {
+ wxMacDestroyGWorld( lpbi ) ;
+ }
+ delete Palette;
lpbi = NULL;
Palette = NULL;
}
{
if ( pixel_depth == 8 )
{
+ for ( int i = 0 ; i < info_ptr->width ; ++i )
+ {
+ png_color_struct* color ;
+ RGBColor col ;
+
+ int index = row_pointers[i] ;
+ color = &info_ptr->palette[index] ;
+ col.red = (((int)color->red) << 8) | ((int)color->red) ;
+ col.green = (((int)color->green) << 8) | ((int)color->green) ;
+ col.blue = (((int)color->blue) << 8) | ((int)color->blue) ;
+ SetCPixel( i, y, &col);
+ }
+ /*
png_color_struct* color ;
RGBColor col ;
unsigned char* p = &row_pointers[0] ;
+ PenNormal() ;
MoveTo( 0 , y ) ;
- unsigned char lastcol = *p ;
- color = &info_ptr->palette[lastcol] ;
+ int index = *p ;
+ color = &info_ptr->palette[index] ;
col.red = (color->red << 8) | color->red ;
col.green = (color->green << 8) | color->green ;
col.blue = (color->blue << 8) | color->blue ;
RGBForeColor( &col ) ;
+ col.red = col.green = col.blue = 0xFFFF ;
+ RGBBackColor( &col ) ;
for ( int i = 0 ; i < info_ptr->width ; ++i , ++p)
{
- if ( *p != lastcol )
+ if ( *p != index )
{
LineTo( i , y ) ;
- lastcol = *p ;
- color = &info_ptr->palette[lastcol] ;
- col.red = (color->red << 8) | color->red ;
- col.green = (color->green << 8) | color->green ;
- col.blue = (color->blue << 8) | color->blue ;
+ index = *p ;
+ color = &info_ptr->palette[index] ;
+ col.red = (((int)color->red) << 8) | ((int)color->red) ;
+ col.green = (((int)color->green) << 8) | ((int)color->green) ;
+ col.blue = (((int)color->blue) << 8) | ((int)color->blue) ;
RGBForeColor( &col ) ;
}
}
- LineTo( info_ptr->width - 1 , y ) ;
+ LineTo( info_ptr->width , y ) ;
+ */
}
else
{
int index = ( row_pointers[byte] >> offset ) & ( 0xFF >> ( 8 - pixel_depth ) );
color = &info_ptr->palette[index] ;
- col.red = (color->red << 8) | color->red ;
- col.green = (color->green << 8) | color->green ;
- col.blue = (color->blue << 8) | color->blue ;
+ col.red = (((int)color->red) << 8) | ((int)color->red) ;
+ col.green = (((int)color->green) << 8) | ((int)color->green) ;
+ col.blue = (((int)color->blue) << 8) | ((int)color->blue) ;
SetCPixel( i, y, &col);
}
}
png_color_struct* color ;
RGBColor col ;
color =(png_color_struct*) (&row_pointers[i*3]) ;
- col.red = (color->red << 8) | color->red ;
- col.green = (color->green << 8) | color->green ;
- col.blue = (color->blue << 8) | color->blue ;
+ col.red = (((int)color->red) << 8) | ((int)color->red) ;
+ col.green = (((int)color->green) << 8) | ((int)color->green) ;
+ col.blue = (((int)color->blue) << 8) | ((int)color->blue) ;
SetCPixel( i, y, &col);
}
}
long style,
const wxString& name)
{
- m_messageBitmap = bitmap;
SetName(name);
- if (parent) parent->AddChild(this);
+
+ m_backgroundColour = parent->GetBackgroundColour() ;
+ m_foregroundColour = parent->GetForegroundColour() ;
+
+ m_messageBitmap = bitmap;
if ( id == -1 )
m_windowId = (int)NewControlId();
m_windowStyle = style;
bool ret = wxControl::Create( parent, id, pos, size, style , name );
-
+
+ SetSizeOrDefault() ;
+
return ret;
}
void wxStaticBitmap::SetBitmap(const wxBitmap& bitmap)
{
m_messageBitmap = bitmap;
-
- Refresh() ;
+ SetSizeOrDefault();
}
void wxStaticBitmap::OnPaint( wxPaintEvent &event )
{
wxPaintDC dc(this);
PrepareDC(dc);
- dc.SetPalette( *m_messageBitmap.GetPalette() ) ;
- dc.DrawBitmap( m_messageBitmap , 0 , 0 ) ;
+ dc.SetPalette( *m_messageBitmap.GetPalette() ) ;
+ dc.DrawBitmap( m_messageBitmap , 0 , 0 ) ;
+}
+
+wxSize wxStaticBitmap::DoGetBestSize() const
+{
+ if ( m_messageBitmap.Ok() )
+ return wxSize(m_messageBitmap.GetWidth(), m_messageBitmap.GetHeight());
+ else
+ return wxSize(16, 16); // completely arbitrary
}
bool wxToolBar::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
long style, const wxString& name)
{
- m_maxWidth = -1;
- m_maxHeight = -1;
+ m_maxWidth = m_maxHeight = 0;
m_defaultWidth = 24;
m_defaultHeight = 22;
wxNode *node = m_tools.First();
int noButtons = 0;
int x = 0 ;
-
+ wxSize toolSize = GetToolSize() ;
+ int tw, th;
+ GetSize(& tw, & th);
while (node)
{
wxToolBarTool *tool = (wxToolBarTool *)node->Data();
if( tool->m_toolStyle != wxTOOL_STYLE_SEPARATOR )
{
Rect toolrect = { toolbarrect.top + kwxMacToolBarTopMargin , toolbarrect.left + x + kwxMacToolBarLeftMargin , 0 , 0 } ;
- toolrect.right = toolrect.left + m_defaultWidth ;
- toolrect.bottom = toolrect.top + m_defaultHeight ;
+ toolrect.right = toolrect.left + toolSize.x ;
+ toolrect.bottom = toolrect.top + toolSize.y ;
PicHandle icon = NULL ;
if ( bmap )
UMASetControlFontStyle( m_macToolHandle , &controlstyle ) ;
UMAEmbedControl( m_macToolHandle , m_macControl ) ;
- x += (int)m_defaultWidth;
+ x += (int)toolSize.x;
noButtons ++;
}
else
{
m_macToolHandles.Add( NULL ) ;
- x += (int)m_defaultWidth / 4;
+ x += (int)toolSize.x / 4;
}
+ if ( toolbarrect.left + x + kwxMacToolBarLeftMargin > m_maxWidth)
+ m_maxWidth = toolbarrect.left + x + kwxMacToolBarLeftMargin;
+ if (toolbarrect.top + kwxMacToolBarTopMargin + toolSize.y > m_maxHeight)
+ m_maxHeight = toolbarrect.top + kwxMacToolBarTopMargin ;
+
node = node->Next();
}
+ if ( GetWindowStyleFlag() & wxTB_HORIZONTAL )
+ {
+ m_maxWidth = tw ; // +=toolSize.x;
+ m_maxHeight += toolSize.y;
+ m_maxHeight += m_yMargin;
+ }
+ else
+ {
+ m_maxHeight = th ;// += toolSize.y;
+ m_maxWidth += toolSize.x;
+ m_maxWidth += m_xMargin;
+ }
+
+ SetSize(m_maxWidth, m_maxHeight);
+
return TRUE;
}
wxSize wxToolBar::GetMaxSize() const
{
- // TODO
- return wxSize(0, 0);
+ return wxSize(m_maxWidth, m_maxHeight);
}
// The button size is bigger than the bitmap size
else
tool->m_y = m_yMargin;
- tool->SetSize(m_defaultWidth, m_defaultHeight);
+ tool->SetSize(GetToolSize().x, GetToolSize().y);
+
+ if ((tool->m_x + bitmap.GetWidth() + m_xMargin) > m_maxWidth)
+ m_maxWidth = (tool->m_x + tool->GetWidth() + m_xMargin);
+
+ if ((tool->m_y + bitmap.GetHeight() + m_yMargin) > m_maxHeight)
+ m_maxHeight = (tool->m_y + tool->GetHeight() + m_yMargin);
m_tools.Append((long)index, tool);
return tool;
#include "wx/menuitem.h"
#include "wx/log.h"
+#if wxUSE_CARET
+ #include "wx/caret.h"
+#endif // wxUSE_CARET
+
#define wxWINDOW_HSCROLL 5998
#define wxWINDOW_VSCROLL 5997
#define MAC_SCROLLBAR_SIZE 16
{
if (gFocusWindow )
{
+ #if wxUSE_CARET
+ // Deal with caret
+ if ( gFocusWindow->m_caret )
+ {
+ gFocusWindow->m_caret->OnKillFocus();
+ }
+ #endif // wxUSE_CARET
wxControl* control = wxDynamicCast( gFocusWindow , wxControl ) ;
if ( control && control->GetMacControl() )
{
UMASetKeyboardFocus( gFocusWindow->GetMacRootWindow() , control->GetMacControl() , kControlFocusNoPart ) ;
}
- wxFocusEvent event(wxEVT_KILL_FOCUS, gFocusWindow->m_windowId);
- event.SetEventObject(gFocusWindow);
+ wxFocusEvent event(wxEVT_KILL_FOCUS, gFocusWindow->m_windowId);
+ event.SetEventObject(gFocusWindow);
gFocusWindow->GetEventHandler()->ProcessEvent(event) ;
}
gFocusWindow = this ;
{
+ #if wxUSE_CARET
+ // Deal with caret
+ if ( m_caret )
+ {
+ m_caret->OnSetFocus();
+ }
+ #endif // wxUSE_CARET
+ // panel wants to track the window which was the last to have focus in it
+ wxPanel *panel = wxDynamicCast(GetParent(), wxPanel);
+ if ( panel )
+ {
+ panel->SetLastFocus(this);
+ }
wxControl* control = wxDynamicCast( gFocusWindow , wxControl ) ;
if ( control && control->GetMacControl() )
{
UMASetKeyboardFocus( gFocusWindow->GetMacRootWindow() , control->GetMacControl() , kControlEditTextPart ) ;
}
- wxFocusEvent event(wxEVT_SET_FOCUS, m_windowId);
- event.SetEventObject(this);
+ wxFocusEvent event(wxEVT_SET_FOCUS, m_windowId);
+ event.SetEventObject(this);
GetEventHandler()->ProcessEvent(event) ;
}
}
if ( focus.Ok() )
{
WindowRef window = GetMacRootWindow() ;
+ bool eraseBackground = false ;
+ if ( m_macWindowData )
+ eraseBackground = true ;
if ( m_backgroundColour == wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE) )
{
UMASetThemeWindowBackground( window , kThemeBrushDocumentWindowBackground , false ) ;
if ( parent->m_backgroundColour != wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE ) )
{
// if we have any other colours in the hierarchy
- RGBBackColor( &parent->m_backgroundColour.GetPixel()) ;
- break ;
+ RGBBackColor( &parent->m_backgroundColour.GetPixel()) ;
+ break ;
}
// if we have the normal colours in the hierarchy but another control etc. -> use it's background
if ( parent->IsKindOf( CLASSINFO( wxNotebook ) ) || parent->IsKindOf( CLASSINFO( wxTabCtrl ) ))
{
- ApplyThemeBackground (kThemeBackgroundTabPane, &(**updatergn).rgnBBox , kThemeStateActive,8,true);
+ ApplyThemeBackground(kThemeBackgroundTabPane, &(**updatergn).rgnBBox , kThemeStateActive,8,true);
break ;
}
}
{
RGBBackColor( &m_backgroundColour.GetPixel()) ;
}
+ if ( GetParent() && m_backgroundColour != GetParent()->GetBackgroundColour() )
+ eraseBackground = true ;
SetClip( updatergn ) ;
- EraseRgn( updatergn ) ;
+ if ( eraseBackground )
+ {
+ EraseRgn( updatergn ) ;
+ }
}
}
}
-
+bool wxWindow::AcceptsFocus() const
+{
+ return MacCanFocus() && wxWindowBase::AcceptsFocus();
+}
ControlHandle wxWindow::MacGetContainerForEmbedding()
{
wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, m_windowId );
event.SetInt(GetSelection());
event.SetEventObject(this);
- event.SetString(copystring(GetStringSelection()));
+ event.SetString(GetStringSelection());
ProcessCommand(event);
- delete[] event.GetString();
}
--- /dev/null
+#include "extldef.h"
+
+/*************************************************************************
+
+ function prototypes
+
+*************************************************************************/
+
+void DrawMsg(Boolean fSelect, Rect *r, Cell cell, ListHandle lh);
+void HiliteMsg(Boolean fSelect, Rect *r);
+
+/*************************************************************************
+
+ main
+
+*************************************************************************/
+
+pascal void main(short message, Boolean fSelect, Rect *r, Cell cell,
+ short dataOffset, short dataLen, ListHandle lh)
+{
+
+ switch(message) {
+ case lInitMsg:
+ break;
+
+ case lDrawMsg:
+ DrawMsg(fSelect, r, cell, lh);
+ break;
+
+ case lHiliteMsg:
+ HiliteMsg(fSelect, r);
+ break;
+
+ case lCloseMsg:
+ break;
+
+ default:
+ break;
+ }
+}
+
+/*************************************************************************
+
+ DrawMsg
+
+*************************************************************************/
+
+void DrawMsg(Boolean fSelect, Rect *r, Cell cell, ListHandle lh)
+{
+ ExtLDEFInfo* info = (ExtLDEFInfo*) (**lh).refCon ;
+ GrafPtr savePort;
+
+ // set up the port
+ GetPort(&savePort);
+ SetPort((**lh).port);
+ PenNormal();
+ ForeColor( blackColor ) ;
+ BackColor( whiteColor ) ;
+
+ EraseRect(r);
+ if ( info )
+ {
+ if ( info->drawProc)
+ {
+ CallExtLDEFDrawProc(info->drawProc, r, cell, lh, info->refCon );
+ }
+
+ }
+ // hilite if selected
+ if (fSelect)
+ HiliteMsg(fSelect, r);
+
+ SetPort(savePort);
+
+}
+
+/*************************************************************************
+
+ HiliteMsg
+
+*************************************************************************/
+
+void HiliteMsg(Boolean fSelect, Rect *r)
+{
+ unsigned char hMode;
+
+ hMode = LMGetHiliteMode();
+ BitClr((Ptr)(&hMode),(long)pHiliteBit);
+ LMSetHiliteMode(hMode);
+ InvertRect(r);
+}
--- /dev/null
+#pragma once
+
+#include <Lists.h>
+#include <stdlib.h>
+
+#define kExtLDEFID 128 // resource id of our LDEF resource
+
+typedef void (*ExtLDEFDrawProcType)(Rect *r, Cell cell, ListHandle lh, long refcon);
+
+enum {
+ uppExtLDEFDrawProcInfo = kCStackBased
+ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(Rect *)))
+ | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Cell)))
+ | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(ListHandle)))
+ | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(long)))
+};
+
+#if USESROUTINEDESCRIPTORS
+typedef UniversalProcPtr ExtLDEFDrawProcUPP;
+
+#define CallExtLDEFDrawProc(userRoutine, r, cell, lh , refcon ) \
+ CallUniversalProc((UniversalProcPtr)(userRoutine), uppExtLDEFDrawProcInfo, r, cell, lh , refcon )
+#define NewExtLDEFDrawProc(userRoutine) \
+ (ExtLDEFDrawProcUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppExtLDEFDrawProcInfo, GetCurrentISA())
+
+#else
+typedef ExtLDEFDrawProcType ExtLDEFDrawProcUPP;
+
+#define CallExtLDEFDrawProc(userRoutine, r, cell, lh , refcon) \
+ (*(userRoutine))(r, cell, lh, refcon)
+#define NewExtLDEFDrawProc(userRoutine) \
+ (ExtLDEFDrawProcUPP)(userRoutine)
+#endif
+
+typedef struct
+{
+ long refCon ;
+ ExtLDEFDrawProcUPP drawProc ;
+} ExtLDEFInfo ;
+
+static void NewExtLDEFInfo( ListHandle lh , ExtLDEFDrawProcType drawproc , long refcon ) ;
+static void NewExtLDEFInfo( ListHandle lh , ExtLDEFDrawProcType drawproc , long refcon )
+{
+ ExtLDEFInfo* info = (ExtLDEFInfo* ) malloc( sizeof( ExtLDEFInfo ) ) ;
+ info->drawProc = NewExtLDEFDrawProc( drawproc ) ;
+ info->refCon = refcon ;
+ (**lh).refCon = (long) info ;
+}
+
+static void DisposeExtLDEFInfo( ListHandle lh) ;
+static void DisposeExtLDEFInfo( ListHandle lh)
+{
+ ExtLDEFInfo* info = (ExtLDEFInfo* ) (**lh).refCon ;
+ if ( info )
+ {
+ DisposeRoutineDescriptor( (RoutineDescriptor*) info->drawProc ) ;
+ free( (void*) (**lh).refCon ) ;
+ }
+}
{
Width = width; Height = height; Depth = depth;
ColorType = (colortype>=0) ? colortype: ((Depth>8) ? COLORTYPE_COLOR: 0);
+ delete Palette;
+ delete[] RawImage ;
+ RawImage = 0;
+ Palette = 0;
if (lpbi)
{
wxMacDestroyGWorld( lpbi ) ;
-// delete Palette;
}
- RawImage = 0;
- Palette = 0;
if (lpbi = wxMacCreateGWorld( Width , Height , Depth) )
{
EfeWidth = (long)(((long)Width*Depth + 31) / 32) * 4;
bool wxPNGReader::SetPalette(wxPalette* colourmap)
{
+ delete Palette ;
if (!colourmap)
return FALSE;
ColorType |= (COLORTYPE_PALETTE | COLORTYPE_COLOR);
- Palette = colourmap;
+ Palette = new wxPalette( *colourmap );
return true ;
// return (DibSetUsage(lpbi, (HPALETTE) Palette->GetHPALETTE(), WXIMA_COLORS ) != 0);
}
bool
wxPNGReader::SetPalette(int n, byte *r, byte *g, byte *b)
{
+ delete Palette ;
Palette = new wxPalette();
if (!Palette)
return FALSE;
bool
wxPNGReader::SetPalette(int n, rgb_color_struct *rgb_struct)
{
+ delete Palette ;
Palette = new wxPalette();
if (!Palette)
return FALSE;
void wxPNGReader::NullData()
{
+ if (lpbi) {
+ wxMacDestroyGWorld( lpbi ) ;
+ }
+ delete Palette;
lpbi = NULL;
Palette = NULL;
}
{
if ( pixel_depth == 8 )
{
+ for ( int i = 0 ; i < info_ptr->width ; ++i )
+ {
+ png_color_struct* color ;
+ RGBColor col ;
+
+ int index = row_pointers[i] ;
+ color = &info_ptr->palette[index] ;
+ col.red = (((int)color->red) << 8) | ((int)color->red) ;
+ col.green = (((int)color->green) << 8) | ((int)color->green) ;
+ col.blue = (((int)color->blue) << 8) | ((int)color->blue) ;
+ SetCPixel( i, y, &col);
+ }
+ /*
png_color_struct* color ;
RGBColor col ;
unsigned char* p = &row_pointers[0] ;
+ PenNormal() ;
MoveTo( 0 , y ) ;
- unsigned char lastcol = *p ;
- color = &info_ptr->palette[lastcol] ;
+ int index = *p ;
+ color = &info_ptr->palette[index] ;
col.red = (color->red << 8) | color->red ;
col.green = (color->green << 8) | color->green ;
col.blue = (color->blue << 8) | color->blue ;
RGBForeColor( &col ) ;
+ col.red = col.green = col.blue = 0xFFFF ;
+ RGBBackColor( &col ) ;
for ( int i = 0 ; i < info_ptr->width ; ++i , ++p)
{
- if ( *p != lastcol )
+ if ( *p != index )
{
LineTo( i , y ) ;
- lastcol = *p ;
- color = &info_ptr->palette[lastcol] ;
- col.red = (color->red << 8) | color->red ;
- col.green = (color->green << 8) | color->green ;
- col.blue = (color->blue << 8) | color->blue ;
+ index = *p ;
+ color = &info_ptr->palette[index] ;
+ col.red = (((int)color->red) << 8) | ((int)color->red) ;
+ col.green = (((int)color->green) << 8) | ((int)color->green) ;
+ col.blue = (((int)color->blue) << 8) | ((int)color->blue) ;
RGBForeColor( &col ) ;
}
}
- LineTo( info_ptr->width - 1 , y ) ;
+ LineTo( info_ptr->width , y ) ;
+ */
}
else
{
int index = ( row_pointers[byte] >> offset ) & ( 0xFF >> ( 8 - pixel_depth ) );
color = &info_ptr->palette[index] ;
- col.red = (color->red << 8) | color->red ;
- col.green = (color->green << 8) | color->green ;
- col.blue = (color->blue << 8) | color->blue ;
+ col.red = (((int)color->red) << 8) | ((int)color->red) ;
+ col.green = (((int)color->green) << 8) | ((int)color->green) ;
+ col.blue = (((int)color->blue) << 8) | ((int)color->blue) ;
SetCPixel( i, y, &col);
}
}
png_color_struct* color ;
RGBColor col ;
color =(png_color_struct*) (&row_pointers[i*3]) ;
- col.red = (color->red << 8) | color->red ;
- col.green = (color->green << 8) | color->green ;
- col.blue = (color->blue << 8) | color->blue ;
+ col.red = (((int)color->red) << 8) | ((int)color->red) ;
+ col.green = (((int)color->green) << 8) | ((int)color->green) ;
+ col.blue = (((int)color->blue) << 8) | ((int)color->blue) ;
SetCPixel( i, y, &col);
}
}
long style,
const wxString& name)
{
- m_messageBitmap = bitmap;
SetName(name);
- if (parent) parent->AddChild(this);
+
+ m_backgroundColour = parent->GetBackgroundColour() ;
+ m_foregroundColour = parent->GetForegroundColour() ;
+
+ m_messageBitmap = bitmap;
if ( id == -1 )
m_windowId = (int)NewControlId();
m_windowStyle = style;
bool ret = wxControl::Create( parent, id, pos, size, style , name );
-
+
+ SetSizeOrDefault() ;
+
return ret;
}
void wxStaticBitmap::SetBitmap(const wxBitmap& bitmap)
{
m_messageBitmap = bitmap;
-
- Refresh() ;
+ SetSizeOrDefault();
}
void wxStaticBitmap::OnPaint( wxPaintEvent &event )
{
wxPaintDC dc(this);
PrepareDC(dc);
- dc.SetPalette( *m_messageBitmap.GetPalette() ) ;
- dc.DrawBitmap( m_messageBitmap , 0 , 0 ) ;
+ dc.SetPalette( *m_messageBitmap.GetPalette() ) ;
+ dc.DrawBitmap( m_messageBitmap , 0 , 0 ) ;
+}
+
+wxSize wxStaticBitmap::DoGetBestSize() const
+{
+ if ( m_messageBitmap.Ok() )
+ return wxSize(m_messageBitmap.GetWidth(), m_messageBitmap.GetHeight());
+ else
+ return wxSize(16, 16); // completely arbitrary
}
bool wxToolBar::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
long style, const wxString& name)
{
- m_maxWidth = -1;
- m_maxHeight = -1;
+ m_maxWidth = m_maxHeight = 0;
m_defaultWidth = 24;
m_defaultHeight = 22;
wxNode *node = m_tools.First();
int noButtons = 0;
int x = 0 ;
-
+ wxSize toolSize = GetToolSize() ;
+ int tw, th;
+ GetSize(& tw, & th);
while (node)
{
wxToolBarTool *tool = (wxToolBarTool *)node->Data();
if( tool->m_toolStyle != wxTOOL_STYLE_SEPARATOR )
{
Rect toolrect = { toolbarrect.top + kwxMacToolBarTopMargin , toolbarrect.left + x + kwxMacToolBarLeftMargin , 0 , 0 } ;
- toolrect.right = toolrect.left + m_defaultWidth ;
- toolrect.bottom = toolrect.top + m_defaultHeight ;
+ toolrect.right = toolrect.left + toolSize.x ;
+ toolrect.bottom = toolrect.top + toolSize.y ;
PicHandle icon = NULL ;
if ( bmap )
UMASetControlFontStyle( m_macToolHandle , &controlstyle ) ;
UMAEmbedControl( m_macToolHandle , m_macControl ) ;
- x += (int)m_defaultWidth;
+ x += (int)toolSize.x;
noButtons ++;
}
else
{
m_macToolHandles.Add( NULL ) ;
- x += (int)m_defaultWidth / 4;
+ x += (int)toolSize.x / 4;
}
+ if ( toolbarrect.left + x + kwxMacToolBarLeftMargin > m_maxWidth)
+ m_maxWidth = toolbarrect.left + x + kwxMacToolBarLeftMargin;
+ if (toolbarrect.top + kwxMacToolBarTopMargin + toolSize.y > m_maxHeight)
+ m_maxHeight = toolbarrect.top + kwxMacToolBarTopMargin ;
+
node = node->Next();
}
+ if ( GetWindowStyleFlag() & wxTB_HORIZONTAL )
+ {
+ m_maxWidth = tw ; // +=toolSize.x;
+ m_maxHeight += toolSize.y;
+ m_maxHeight += m_yMargin;
+ }
+ else
+ {
+ m_maxHeight = th ;// += toolSize.y;
+ m_maxWidth += toolSize.x;
+ m_maxWidth += m_xMargin;
+ }
+
+ SetSize(m_maxWidth, m_maxHeight);
+
return TRUE;
}
wxSize wxToolBar::GetMaxSize() const
{
- // TODO
- return wxSize(0, 0);
+ return wxSize(m_maxWidth, m_maxHeight);
}
// The button size is bigger than the bitmap size
else
tool->m_y = m_yMargin;
- tool->SetSize(m_defaultWidth, m_defaultHeight);
+ tool->SetSize(GetToolSize().x, GetToolSize().y);
+
+ if ((tool->m_x + bitmap.GetWidth() + m_xMargin) > m_maxWidth)
+ m_maxWidth = (tool->m_x + tool->GetWidth() + m_xMargin);
+
+ if ((tool->m_y + bitmap.GetHeight() + m_yMargin) > m_maxHeight)
+ m_maxHeight = (tool->m_y + tool->GetHeight() + m_yMargin);
m_tools.Append((long)index, tool);
return tool;
#include "wx/menuitem.h"
#include "wx/log.h"
+#if wxUSE_CARET
+ #include "wx/caret.h"
+#endif // wxUSE_CARET
+
#define wxWINDOW_HSCROLL 5998
#define wxWINDOW_VSCROLL 5997
#define MAC_SCROLLBAR_SIZE 16
{
if (gFocusWindow )
{
+ #if wxUSE_CARET
+ // Deal with caret
+ if ( gFocusWindow->m_caret )
+ {
+ gFocusWindow->m_caret->OnKillFocus();
+ }
+ #endif // wxUSE_CARET
wxControl* control = wxDynamicCast( gFocusWindow , wxControl ) ;
if ( control && control->GetMacControl() )
{
UMASetKeyboardFocus( gFocusWindow->GetMacRootWindow() , control->GetMacControl() , kControlFocusNoPart ) ;
}
- wxFocusEvent event(wxEVT_KILL_FOCUS, gFocusWindow->m_windowId);
- event.SetEventObject(gFocusWindow);
+ wxFocusEvent event(wxEVT_KILL_FOCUS, gFocusWindow->m_windowId);
+ event.SetEventObject(gFocusWindow);
gFocusWindow->GetEventHandler()->ProcessEvent(event) ;
}
gFocusWindow = this ;
{
+ #if wxUSE_CARET
+ // Deal with caret
+ if ( m_caret )
+ {
+ m_caret->OnSetFocus();
+ }
+ #endif // wxUSE_CARET
+ // panel wants to track the window which was the last to have focus in it
+ wxPanel *panel = wxDynamicCast(GetParent(), wxPanel);
+ if ( panel )
+ {
+ panel->SetLastFocus(this);
+ }
wxControl* control = wxDynamicCast( gFocusWindow , wxControl ) ;
if ( control && control->GetMacControl() )
{
UMASetKeyboardFocus( gFocusWindow->GetMacRootWindow() , control->GetMacControl() , kControlEditTextPart ) ;
}
- wxFocusEvent event(wxEVT_SET_FOCUS, m_windowId);
- event.SetEventObject(this);
+ wxFocusEvent event(wxEVT_SET_FOCUS, m_windowId);
+ event.SetEventObject(this);
GetEventHandler()->ProcessEvent(event) ;
}
}
if ( focus.Ok() )
{
WindowRef window = GetMacRootWindow() ;
+ bool eraseBackground = false ;
+ if ( m_macWindowData )
+ eraseBackground = true ;
if ( m_backgroundColour == wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE) )
{
UMASetThemeWindowBackground( window , kThemeBrushDocumentWindowBackground , false ) ;
if ( parent->m_backgroundColour != wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE ) )
{
// if we have any other colours in the hierarchy
- RGBBackColor( &parent->m_backgroundColour.GetPixel()) ;
- break ;
+ RGBBackColor( &parent->m_backgroundColour.GetPixel()) ;
+ break ;
}
// if we have the normal colours in the hierarchy but another control etc. -> use it's background
if ( parent->IsKindOf( CLASSINFO( wxNotebook ) ) || parent->IsKindOf( CLASSINFO( wxTabCtrl ) ))
{
- ApplyThemeBackground (kThemeBackgroundTabPane, &(**updatergn).rgnBBox , kThemeStateActive,8,true);
+ ApplyThemeBackground(kThemeBackgroundTabPane, &(**updatergn).rgnBBox , kThemeStateActive,8,true);
break ;
}
}
{
RGBBackColor( &m_backgroundColour.GetPixel()) ;
}
+ if ( GetParent() && m_backgroundColour != GetParent()->GetBackgroundColour() )
+ eraseBackground = true ;
SetClip( updatergn ) ;
- EraseRgn( updatergn ) ;
+ if ( eraseBackground )
+ {
+ EraseRgn( updatergn ) ;
+ }
}
}
}
-
+bool wxWindow::AcceptsFocus() const
+{
+ return MacCanFocus() && wxWindowBase::AcceptsFocus();
+}
ControlHandle wxWindow::MacGetContainerForEmbedding()
{