Added wxFileName::GetModificationTime()
for Unix. Don't send events when constructing a text ctrl. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9691 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
		@@ -36,6 +36,7 @@
 | 
			
		||||
 | 
			
		||||
// ridiculously enough, this will replace DirExists with wxDirExists etc
 | 
			
		||||
#include "wx/filefn.h"
 | 
			
		||||
#include "wx/datetime.h"
 | 
			
		||||
 | 
			
		||||
// ----------------------------------------------------------------------------
 | 
			
		||||
// constants
 | 
			
		||||
@@ -147,6 +148,9 @@ public:
 | 
			
		||||
    bool DirExists();
 | 
			
		||||
    static bool DirExists( const wxString &dir );
 | 
			
		||||
 | 
			
		||||
        // Well, get modification time with sec resolution
 | 
			
		||||
    wxDateTime GetModificationTime();
 | 
			
		||||
    
 | 
			
		||||
        // VZ: also need: IsDirWritable(), IsFileExecutable() &c (TODO)
 | 
			
		||||
 | 
			
		||||
    // various file/dir operations
 | 
			
		||||
 
 | 
			
		||||
@@ -48,6 +48,19 @@
 | 
			
		||||
#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
 | 
			
		||||
// ============================================================================
 | 
			
		||||
@@ -152,6 +165,29 @@ bool wxFileName::DirExists( const wxString &dir )
 | 
			
		||||
    return ::wxDirExists( dir );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
wxDateTime wxFileName::GetModificationTime()
 | 
			
		||||
{
 | 
			
		||||
#ifdef __WXGTK__
 | 
			
		||||
    struct stat buff;
 | 
			
		||||
    stat( GetFullName().fn_str(), &buff );
 | 
			
		||||
 | 
			
		||||
#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;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ----------------------------------------------------------------------------
 | 
			
		||||
// CWD and HOME stuff
 | 
			
		||||
// ----------------------------------------------------------------------------
 | 
			
		||||
 
 | 
			
		||||
@@ -327,10 +327,6 @@ bool wxTextCtrl::Create( wxWindow *parent,
 | 
			
		||||
    if (multi_line)
 | 
			
		||||
        gtk_widget_show(m_text);
 | 
			
		||||
 | 
			
		||||
    /* we want to be notified about text changes */
 | 
			
		||||
    gtk_signal_connect( GTK_OBJECT(m_text), "changed",
 | 
			
		||||
      GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this);
 | 
			
		||||
 | 
			
		||||
    if (multi_line)
 | 
			
		||||
    {
 | 
			
		||||
        gtk_signal_connect(GTK_OBJECT(GTK_TEXT(m_text)->vadj), "changed",
 | 
			
		||||
@@ -393,6 +389,10 @@ bool wxTextCtrl::Create( wxWindow *parent,
 | 
			
		||||
            gtk_text_set_editable( GTK_TEXT(m_text), 1 );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /* we want to be notified about text changes */
 | 
			
		||||
    gtk_signal_connect( GTK_OBJECT(m_text), "changed",
 | 
			
		||||
      GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this);
 | 
			
		||||
 | 
			
		||||
    SetBackgroundColour( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW) );
 | 
			
		||||
    SetForegroundColour( parent->GetForegroundColour() );
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -327,10 +327,6 @@ bool wxTextCtrl::Create( wxWindow *parent,
 | 
			
		||||
    if (multi_line)
 | 
			
		||||
        gtk_widget_show(m_text);
 | 
			
		||||
 | 
			
		||||
    /* we want to be notified about text changes */
 | 
			
		||||
    gtk_signal_connect( GTK_OBJECT(m_text), "changed",
 | 
			
		||||
      GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this);
 | 
			
		||||
 | 
			
		||||
    if (multi_line)
 | 
			
		||||
    {
 | 
			
		||||
        gtk_signal_connect(GTK_OBJECT(GTK_TEXT(m_text)->vadj), "changed",
 | 
			
		||||
@@ -393,6 +389,10 @@ bool wxTextCtrl::Create( wxWindow *parent,
 | 
			
		||||
            gtk_text_set_editable( GTK_TEXT(m_text), 1 );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /* we want to be notified about text changes */
 | 
			
		||||
    gtk_signal_connect( GTK_OBJECT(m_text), "changed",
 | 
			
		||||
      GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this);
 | 
			
		||||
 | 
			
		||||
    SetBackgroundColour( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW) );
 | 
			
		||||
    SetForegroundColour( parent->GetForegroundColour() );
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user