virtual int GetFilterIndex() 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 );
// no need for the copy constructor as the default one will be fine.
virtual wxEvent *Clone() const { return new wxFileCtrlEvent( *this ); }
- void SetFiles( const wxArrayString &files ) { this->files = files; }
- void SetDirectory( const wxString &directory ) { this->directory = directory; }
+ void SetFiles( const wxArrayString &files ) { m_files = files; }
+ void SetDirectory( const wxString &directory ) { m_directory = directory; }
- wxArrayString GetFiles() const { return files; }
- wxString GetDirectory() const { return directory; }
+ wxArrayString GetFiles() const { return m_files; }
+ wxString GetDirectory() const { return m_directory; }
wxString GetFile() const;
protected:
- wxString directory;
- wxArrayString files;
+ wxString m_directory;
+ wxArrayString m_files;
DECLARE_DYNAMIC_CLASS_NO_ASSIGN( wxFileCtrlEvent )
};
void OnListEndLabelEdit( wxListEvent &event );
void OnListColClick( wxListEvent &event );
- virtual void SortItems(wxFileData::fileListFieldType field, bool foward);
- bool GetSortDirection() const { return m_sort_foward; }
+ virtual void SortItems(wxFileData::fileListFieldType field, bool forward);
+ bool GetSortDirection() const { return m_sort_forward; }
wxFileData::fileListFieldType GetSortField() const { return m_sort_field; }
protected:
bool m_showHidden;
wxString m_wild;
- bool m_sort_foward;
+ bool m_sort_forward;
wxFileData::fileListFieldType m_sort_field;
private:
virtual int GetFilterIndex() const { return m_filterIndex; }
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 GoToHomeDir();
virtual int GetFilterIndex() const { return m_fc.GetFilterIndex(); }
virtual bool HasMultipleFileSelection() const { return HasFlag( wxFC_MULTIPLE ); }
- virtual void ShowHidden(const bool show);
+ virtual void ShowHidden(bool show);
bool m_checkNextSelEvent;
bool m_ignoreNextFolderChangeEvent;
wxASSERT_MSG( !wxDynamicCast( GetEventObject(), wxFileCtrl )->HasMultipleFileSelection(),
wxT( "Please use GetFiles() to get all files instead of this function" ) );
- if ( files.Count() == 0 )
- return wxEmptyString;
- else
- return files[0];
+ wxString string;
+ if (m_files.Count() != 0)
+ string = m_files[0];
+ return string;
}
#endif // wxUSE_FILECTRL
#if defined(__UNIX__) && (!defined( __OS2__ ) && !defined(__VMS))
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()
// only translate to file charset if we don't go by our
// wxStat implementation
// wxFileListCtrl
//-----------------------------------------------------------------------------
+// FIXME: what is this for? It's never read
static bool ignoreChanges = false;
IMPLEMENT_DYNAMIC_CLASS(wxFileListCtrl,wxListCtrl)
wxFileListCtrl::wxFileListCtrl()
{
m_showHidden = false;
- m_sort_foward = 1;
+ m_sort_forward = true;
m_sort_field = wxFileData::FileList_Name;
}
m_showHidden = showHidden;
- m_sort_foward = 1;
+ m_sort_forward = true;
m_sort_field = wxFileData::FileList_Name;
m_dirName = wxT("*");
}
}
- SortItems(m_sort_field, m_sort_foward);
+ SortItems(m_sort_field, m_sort_forward);
}
void wxFileListCtrl::SetWild( const wxString &wild )
if (id != -1)
{
- SortItems(m_sort_field, m_sort_foward);
+ SortItems(m_sort_field, m_sort_forward);
id = FindItem( 0, wxPtrToUInt(fd) );
EnsureVisible( id );
EditLabel( id );
}
if ((wxFileData::fileListFieldType)col == m_sort_field)
- m_sort_foward = !m_sort_foward;
+ m_sort_forward = !m_sort_forward;
else
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)
{
m_sort_field = field;
- m_sort_foward = forward;
+ m_sort_forward = forward;
const long sort_dir = forward ? 1 : -1;
switch (m_sort_field)
{
wxGtkString str( gtk_file_chooser_get_filename( m_widget ) );
- if ( str.c_str() == NULL )
- return wxEmptyString;
-
- return wxConvFileName->cMB2WX( str );
+ wxString string;
+ if (str.c_str() != NULL)
+ string = wxConvFileName->cMB2WX(str);
+ return string;
}
void wxGtkFileChooser::GetFilenames( wxArrayString& files ) const
const gboolean b =
gtk_file_chooser_set_current_folder( m_widget,
wxConvFileName->cWX2MB( dir.c_str() ) );
- return b == TRUE;
+ return b != 0;
}
wxString wxGtkFileChooser::GetDirectory() const
return false;
}
- GtkFileChooserAction gtkAction;
+ GtkFileChooserAction gtkAction = GTK_FILE_CHOOSER_ACTION_OPEN;
if ( style & wxFC_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_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_container_add ( GTK_CONTAINER ( m_widget ), GTK_WIDGET( m_fcWidget ) );
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