#include "wx/msw/winundef.h"
#endif
-// at least some of these are required for file mod time
-#ifdef __WXGTK__
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <dirent.h>
-#include <pwd.h>
-#ifndef __VMS
-# include <grp.h>
-#endif
-# include <time.h>
-#include <unistd.h>
-#endif
-
// ============================================================================
// implementation
// ============================================================================
wxDateTime wxFileName::GetModificationTime()
{
-#ifdef __WXGTK__
- struct stat buff;
- stat( GetFullName().fn_str(), &buff );
+ wxDateTime ret( wxFileModificationTime( GetFullPath() ) );
-#if !defined( __EMX__ ) && !defined(__VMS)
- struct stat lbuff;
- lstat( GetFullName().fn_str(), &lbuff );
- struct tm *t = localtime( &lbuff.st_mtime );
-#else
- struct tm *t = localtime( &buff.st_mtime );
-#endif
-
- wxDateTime ret( t->tm_mday, (wxDateTime::Month)t->tm_mon, t->tm_year+1900, t->tm_hour, t->tm_min, t->tm_sec );
-#else
-
- wxDateTime ret = wxDateTime::Now();
-
-#endif
return ret;
}
s_triedToLoad = TRUE;
wxDllType dllKernel = wxDllLoader::LoadLibrary(_T("kernel32"));
- short avoidCompilerWarning = 0;
+ short avoidCompilerWarning = 0;
if ( avoidCompilerWarning ) // dllKernel )
{
// may succeed or fail depending on the Windows version
if (bpp == 1)
{
int bit = 0;
- for (bit = 0; bit < 8; bit++)
+ for (bit = 0; bit < 8 && column < width; bit++)
{
index = ((aByte & (0x80 >> bit)) ? 1 : 0);
ptr[poffset] = cmap[index].r;
else
{
int nibble = 0;
- for (nibble = 0; nibble < 2; nibble++)
+ for (nibble = 0; nibble < 2 && column < width; nibble++)
{
index = ((aByte & (0xF0 >> nibble * 4)) >> (!nibble * 4));
if (index >= 16)
}
else
{
- for (int l = 0; l < first; l++)
+ for (int l = 0; l < first && column < width; l++)
{
ptr[poffset ] = cmap[aByte].r;
ptr[poffset + 1] = cmap[aByte].g;
{
m_file = new wxFile(fileName, wxFile::write);
m_file_destroy = TRUE;
+
+ if (!m_file->IsOpened())
+ {
+ m_lasterror = wxSTREAM_WRITE_ERROR;
+ }
+ else
+ {
+ if (m_file->Error())
+ m_lasterror = wxSTREAM_WRITE_ERROR;
+ }
}
wxFileOutputStream::wxFileOutputStream(wxFile& file)
{
m_file = new wxFFile(fileName, "w+b");
m_file_destroy = TRUE;
+
+ if (!m_file->IsOpened())
+ {
+ m_lasterror = wxSTREAM_WRITE_ERROR;
+ }
+ else
+ {
+ if (m_file->Error())
+ m_lasterror = wxSTREAM_WRITE_ERROR;
+ }
}
wxFFileOutputStream::wxFFileOutputStream(wxFFile& file)
}
#endif // wxUSE_CARET
- wxFocusEvent event( wxEVT_SET_FOCUS, win->GetId() );
- event.SetEventObject( win );
+ if (win->IsTopLevel())
+ {
+ wxActivateEvent event( wxEVT_ACTIVATE, TRUE, win->GetId() );
+ event.SetEventObject( win );
- if (win->GetEventHandler()->ProcessEvent( event ))
+ if (win->GetEventHandler()->ProcessEvent( event ))
+ {
+ gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "focus_in_event" );
+ return TRUE;
+ }
+ }
+ else
{
- gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "focus_in_event" );
- return TRUE;
+ wxFocusEvent event( wxEVT_SET_FOCUS, win->GetId() );
+ event.SetEventObject( win );
+
+ if (win->GetEventHandler()->ProcessEvent( event ))
+ {
+ gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "focus_in_event" );
+ return TRUE;
+ }
}
+
return FALSE;
}
}
#endif // wxUSE_CARET
- wxFocusEvent event( wxEVT_KILL_FOCUS, win->GetId() );
- event.SetEventObject( win );
+ if (win->IsTopLevel())
+ {
+ wxActivateEvent event( wxEVT_ACTIVATE, FALSE, win->GetId() );
+ event.SetEventObject( win );
- if (win->GetEventHandler()->ProcessEvent( event ))
+ if (win->GetEventHandler()->ProcessEvent( event ))
+ {
+ gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "focus_out_event" );
+ return TRUE;
+ }
+ }
+ else
{
- gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "focus_out_event" );
- return TRUE;
+ wxFocusEvent event( wxEVT_KILL_FOCUS, win->GetId() );
+ event.SetEventObject( win );
+
+ if (win->GetEventHandler()->ProcessEvent( event ))
+ {
+ gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "focus_out_event" );
+ return TRUE;
+ }
}
return FALSE;
// do it only once
g_sendActivateEvent = -1;
- wxActivateEvent event(wxEVT_ACTIVATE, activate, GetId());
+ wxActivateEvent event(wxEVT_ACTIVATE_APP, activate, GetId());
event.SetEventObject(this);
(void)GetEventHandler()->ProcessEvent(event);
}
#endif // wxUSE_CARET
- wxFocusEvent event( wxEVT_SET_FOCUS, win->GetId() );
- event.SetEventObject( win );
+ if (win->IsTopLevel())
+ {
+ wxActivateEvent event( wxEVT_ACTIVATE, TRUE, win->GetId() );
+ event.SetEventObject( win );
- if (win->GetEventHandler()->ProcessEvent( event ))
+ if (win->GetEventHandler()->ProcessEvent( event ))
+ {
+ gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "focus_in_event" );
+ return TRUE;
+ }
+ }
+ else
{
- gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "focus_in_event" );
- return TRUE;
+ wxFocusEvent event( wxEVT_SET_FOCUS, win->GetId() );
+ event.SetEventObject( win );
+
+ if (win->GetEventHandler()->ProcessEvent( event ))
+ {
+ gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "focus_in_event" );
+ return TRUE;
+ }
}
+
return FALSE;
}
}
#endif // wxUSE_CARET
- wxFocusEvent event( wxEVT_KILL_FOCUS, win->GetId() );
- event.SetEventObject( win );
+ if (win->IsTopLevel())
+ {
+ wxActivateEvent event( wxEVT_ACTIVATE, FALSE, win->GetId() );
+ event.SetEventObject( win );
- if (win->GetEventHandler()->ProcessEvent( event ))
+ if (win->GetEventHandler()->ProcessEvent( event ))
+ {
+ gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "focus_out_event" );
+ return TRUE;
+ }
+ }
+ else
{
- gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "focus_out_event" );
- return TRUE;
+ wxFocusEvent event( wxEVT_KILL_FOCUS, win->GetId() );
+ event.SetEventObject( win );
+
+ if (win->GetEventHandler()->ProcessEvent( event ))
+ {
+ gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "focus_out_event" );
+ return TRUE;
+ }
}
return FALSE;
// do it only once
g_sendActivateEvent = -1;
- wxActivateEvent event(wxEVT_ACTIVATE, activate, GetId());
+ wxActivateEvent event(wxEVT_ACTIVATE_APP, activate, GetId());
event.SetEventObject(this);
(void)GetEventHandler()->ProcessEvent(event);