various small cleanups
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48755 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -66,7 +66,7 @@ public:
|
|||||||
virtual int GetFilterIndex() const = 0;
|
virtual int GetFilterIndex() const = 0;
|
||||||
|
|
||||||
virtual bool HasMultipleFileSelection() const = 0;
|
virtual bool HasMultipleFileSelection() const = 0;
|
||||||
virtual void ShowHidden(const bool show) = 0;
|
virtual void ShowHidden(bool show) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
void GenerateFolderChangedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd );
|
void GenerateFolderChangedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd );
|
||||||
@@ -104,17 +104,17 @@ public:
|
|||||||
// no need for the copy constructor as the default one will be fine.
|
// no need for the copy constructor as the default one will be fine.
|
||||||
virtual wxEvent *Clone() const { return new wxFileCtrlEvent( *this ); }
|
virtual wxEvent *Clone() const { return new wxFileCtrlEvent( *this ); }
|
||||||
|
|
||||||
void SetFiles( const wxArrayString &files ) { this->files = files; }
|
void SetFiles( const wxArrayString &files ) { m_files = files; }
|
||||||
void SetDirectory( const wxString &directory ) { this->directory = directory; }
|
void SetDirectory( const wxString &directory ) { m_directory = directory; }
|
||||||
|
|
||||||
wxArrayString GetFiles() const { return files; }
|
wxArrayString GetFiles() const { return m_files; }
|
||||||
wxString GetDirectory() const { return directory; }
|
wxString GetDirectory() const { return m_directory; }
|
||||||
|
|
||||||
wxString GetFile() const;
|
wxString GetFile() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
wxString directory;
|
wxString m_directory;
|
||||||
wxArrayString files;
|
wxArrayString m_files;
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS_NO_ASSIGN( wxFileCtrlEvent )
|
DECLARE_DYNAMIC_CLASS_NO_ASSIGN( wxFileCtrlEvent )
|
||||||
};
|
};
|
||||||
|
@@ -161,8 +161,8 @@ public:
|
|||||||
void OnListEndLabelEdit( wxListEvent &event );
|
void OnListEndLabelEdit( wxListEvent &event );
|
||||||
void OnListColClick( wxListEvent &event );
|
void OnListColClick( wxListEvent &event );
|
||||||
|
|
||||||
virtual void SortItems(wxFileData::fileListFieldType field, bool foward);
|
virtual void SortItems(wxFileData::fileListFieldType field, bool forward);
|
||||||
bool GetSortDirection() const { return m_sort_foward; }
|
bool GetSortDirection() const { return m_sort_forward; }
|
||||||
wxFileData::fileListFieldType GetSortField() const { return m_sort_field; }
|
wxFileData::fileListFieldType GetSortField() const { return m_sort_field; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -173,7 +173,7 @@ protected:
|
|||||||
bool m_showHidden;
|
bool m_showHidden;
|
||||||
wxString m_wild;
|
wxString m_wild;
|
||||||
|
|
||||||
bool m_sort_foward;
|
bool m_sort_forward;
|
||||||
wxFileData::fileListFieldType m_sort_field;
|
wxFileData::fileListFieldType m_sort_field;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -237,7 +237,7 @@ public:
|
|||||||
virtual int GetFilterIndex() const { return m_filterIndex; }
|
virtual int GetFilterIndex() const { return m_filterIndex; }
|
||||||
|
|
||||||
virtual bool HasMultipleFileSelection() const { return m_style & wxFC_MULTIPLE; }
|
virtual bool HasMultipleFileSelection() const { return m_style & wxFC_MULTIPLE; }
|
||||||
virtual void ShowHidden(const bool show) { m_list->ShowHidden( show ); }
|
virtual void ShowHidden(bool show) { m_list->ShowHidden( show ); }
|
||||||
|
|
||||||
void GoToParentDir();
|
void GoToParentDir();
|
||||||
void GoToHomeDir();
|
void GoToHomeDir();
|
||||||
|
@@ -100,7 +100,7 @@ public:
|
|||||||
virtual int GetFilterIndex() const { return m_fc.GetFilterIndex(); }
|
virtual int GetFilterIndex() const { return m_fc.GetFilterIndex(); }
|
||||||
|
|
||||||
virtual bool HasMultipleFileSelection() const { return HasFlag( wxFC_MULTIPLE ); }
|
virtual bool HasMultipleFileSelection() const { return HasFlag( wxFC_MULTIPLE ); }
|
||||||
virtual void ShowHidden(const bool show);
|
virtual void ShowHidden(bool show);
|
||||||
|
|
||||||
bool m_checkNextSelEvent;
|
bool m_checkNextSelEvent;
|
||||||
bool m_ignoreNextFolderChangeEvent;
|
bool m_ignoreNextFolderChangeEvent;
|
||||||
|
@@ -84,10 +84,10 @@ wxString wxFileCtrlEvent::GetFile() const
|
|||||||
wxASSERT_MSG( !wxDynamicCast( GetEventObject(), wxFileCtrl )->HasMultipleFileSelection(),
|
wxASSERT_MSG( !wxDynamicCast( GetEventObject(), wxFileCtrl )->HasMultipleFileSelection(),
|
||||||
wxT( "Please use GetFiles() to get all files instead of this function" ) );
|
wxT( "Please use GetFiles() to get all files instead of this function" ) );
|
||||||
|
|
||||||
if ( files.Count() == 0 )
|
wxString string;
|
||||||
return wxEmptyString;
|
if (m_files.Count() != 0)
|
||||||
else
|
string = m_files[0];
|
||||||
return files[0];
|
return string;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_FILECTRL
|
#endif // wxUSE_FILECTRL
|
||||||
|
@@ -224,7 +224,7 @@ void wxFileData::ReadData()
|
|||||||
|
|
||||||
#if defined(__UNIX__) && (!defined( __OS2__ ) && !defined(__VMS))
|
#if defined(__UNIX__) && (!defined( __OS2__ ) && !defined(__VMS))
|
||||||
lstat( m_filePath.fn_str(), &buff );
|
lstat( m_filePath.fn_str(), &buff );
|
||||||
m_type |= S_ISLNK( buff.st_mode ) != 0 ? is_link : 0;
|
m_type |= S_ISLNK(buff.st_mode) ? is_link : 0;
|
||||||
#else // no lstat()
|
#else // no lstat()
|
||||||
// only translate to file charset if we don't go by our
|
// only translate to file charset if we don't go by our
|
||||||
// wxStat implementation
|
// wxStat implementation
|
||||||
@@ -393,6 +393,7 @@ void wxFileData::MakeItem( wxListItem &item )
|
|||||||
// wxFileListCtrl
|
// wxFileListCtrl
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// FIXME: what is this for? It's never read
|
||||||
static bool ignoreChanges = false;
|
static bool ignoreChanges = false;
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxFileListCtrl,wxListCtrl)
|
IMPLEMENT_DYNAMIC_CLASS(wxFileListCtrl,wxListCtrl)
|
||||||
@@ -408,7 +409,7 @@ END_EVENT_TABLE()
|
|||||||
wxFileListCtrl::wxFileListCtrl()
|
wxFileListCtrl::wxFileListCtrl()
|
||||||
{
|
{
|
||||||
m_showHidden = false;
|
m_showHidden = false;
|
||||||
m_sort_foward = 1;
|
m_sort_forward = true;
|
||||||
m_sort_field = wxFileData::FileList_Name;
|
m_sort_field = wxFileData::FileList_Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -430,7 +431,7 @@ wxFileListCtrl::wxFileListCtrl(wxWindow *win,
|
|||||||
|
|
||||||
m_showHidden = showHidden;
|
m_showHidden = showHidden;
|
||||||
|
|
||||||
m_sort_foward = 1;
|
m_sort_forward = true;
|
||||||
m_sort_field = wxFileData::FileList_Name;
|
m_sort_field = wxFileData::FileList_Name;
|
||||||
|
|
||||||
m_dirName = wxT("*");
|
m_dirName = wxT("*");
|
||||||
@@ -626,7 +627,7 @@ void wxFileListCtrl::UpdateFiles()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SortItems(m_sort_field, m_sort_foward);
|
SortItems(m_sort_field, m_sort_forward);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileListCtrl::SetWild( const wxString &wild )
|
void wxFileListCtrl::SetWild( const wxString &wild )
|
||||||
@@ -677,7 +678,7 @@ void wxFileListCtrl::MakeDir()
|
|||||||
|
|
||||||
if (id != -1)
|
if (id != -1)
|
||||||
{
|
{
|
||||||
SortItems(m_sort_field, m_sort_foward);
|
SortItems(m_sort_field, m_sort_forward);
|
||||||
id = FindItem( 0, wxPtrToUInt(fd) );
|
id = FindItem( 0, wxPtrToUInt(fd) );
|
||||||
EnsureVisible( id );
|
EnsureVisible( id );
|
||||||
EditLabel( id );
|
EditLabel( id );
|
||||||
@@ -834,17 +835,17 @@ void wxFileListCtrl::OnListColClick( wxListEvent &event )
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((wxFileData::fileListFieldType)col == m_sort_field)
|
if ((wxFileData::fileListFieldType)col == m_sort_field)
|
||||||
m_sort_foward = !m_sort_foward;
|
m_sort_forward = !m_sort_forward;
|
||||||
else
|
else
|
||||||
m_sort_field = (wxFileData::fileListFieldType)col;
|
m_sort_field = (wxFileData::fileListFieldType)col;
|
||||||
|
|
||||||
SortItems(m_sort_field, m_sort_foward);
|
SortItems(m_sort_field, m_sort_forward);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileListCtrl::SortItems(wxFileData::fileListFieldType field, bool forward)
|
void wxFileListCtrl::SortItems(wxFileData::fileListFieldType field, bool forward)
|
||||||
{
|
{
|
||||||
m_sort_field = field;
|
m_sort_field = field;
|
||||||
m_sort_foward = forward;
|
m_sort_forward = forward;
|
||||||
const long sort_dir = forward ? 1 : -1;
|
const long sort_dir = forward ? 1 : -1;
|
||||||
|
|
||||||
switch (m_sort_field)
|
switch (m_sort_field)
|
||||||
|
@@ -45,10 +45,10 @@ wxString wxGtkFileChooser::GetPath() const
|
|||||||
{
|
{
|
||||||
wxGtkString str( gtk_file_chooser_get_filename( m_widget ) );
|
wxGtkString str( gtk_file_chooser_get_filename( m_widget ) );
|
||||||
|
|
||||||
if ( str.c_str() == NULL )
|
wxString string;
|
||||||
return wxEmptyString;
|
if (str.c_str() != NULL)
|
||||||
|
string = wxConvFileName->cMB2WX(str);
|
||||||
return wxConvFileName->cMB2WX( str );
|
return string;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGtkFileChooser::GetFilenames( wxArrayString& files ) const
|
void wxGtkFileChooser::GetFilenames( wxArrayString& files ) const
|
||||||
@@ -95,7 +95,7 @@ bool wxGtkFileChooser::SetDirectory( const wxString& dir )
|
|||||||
const gboolean b =
|
const gboolean b =
|
||||||
gtk_file_chooser_set_current_folder( m_widget,
|
gtk_file_chooser_set_current_folder( m_widget,
|
||||||
wxConvFileName->cWX2MB( dir.c_str() ) );
|
wxConvFileName->cWX2MB( dir.c_str() ) );
|
||||||
return b == TRUE;
|
return b != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxGtkFileChooser::GetDirectory() const
|
wxString wxGtkFileChooser::GetDirectory() const
|
||||||
@@ -282,19 +282,13 @@ bool wxGtkFileCtrl::Create( wxWindow *parent,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkFileChooserAction gtkAction;
|
GtkFileChooserAction gtkAction = GTK_FILE_CHOOSER_ACTION_OPEN;
|
||||||
|
|
||||||
if ( style & wxFC_SAVE )
|
if ( style & wxFC_SAVE )
|
||||||
{
|
|
||||||
gtkAction = GTK_FILE_CHOOSER_ACTION_SAVE;
|
gtkAction = GTK_FILE_CHOOSER_ACTION_SAVE;
|
||||||
}
|
|
||||||
else if ( style & wxFC_OPEN )
|
|
||||||
{
|
|
||||||
gtkAction = GTK_FILE_CHOOSER_ACTION_OPEN;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_widget = gtk_alignment_new ( 0, 0, 1, 1 );
|
m_widget = gtk_alignment_new ( 0, 0, 1, 1 );
|
||||||
m_fcWidget = GTK_FILE_CHOOSER( gtk_file_chooser_widget_new( GTK_FILE_CHOOSER_ACTION_OPEN ) );
|
m_fcWidget = GTK_FILE_CHOOSER( gtk_file_chooser_widget_new(gtkAction) );
|
||||||
gtk_widget_show ( GTK_WIDGET( m_fcWidget ) );
|
gtk_widget_show ( GTK_WIDGET( m_fcWidget ) );
|
||||||
gtk_container_add ( GTK_CONTAINER ( m_widget ), GTK_WIDGET( m_fcWidget ) );
|
gtk_container_add ( GTK_CONTAINER ( m_widget ), GTK_WIDGET( m_fcWidget ) );
|
||||||
|
|
||||||
@@ -426,9 +420,9 @@ void wxGtkFileCtrl::GetFilenames( wxArrayString& files ) const
|
|||||||
m_fc.GetFilenames( files );
|
m_fc.GetFilenames( files );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGtkFileCtrl::ShowHidden(const bool show)
|
void wxGtkFileCtrl::ShowHidden(bool show)
|
||||||
{
|
{
|
||||||
gtk_file_chooser_set_show_hidden( m_fcWidget, ( show == true ) ? TRUE : FALSE );
|
gtk_file_chooser_set_show_hidden(m_fcWidget, show);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user