Initial revision
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
1
user/wxFile/Makefile
Normal file
1
user/wxFile/Makefile
Normal file
@@ -0,0 +1 @@
|
||||
include ../../src/gtk/setup/general/makeapp
|
26
user/wxFile/Makefile.in
Normal file
26
user/wxFile/Makefile.in
Normal file
@@ -0,0 +1,26 @@
|
||||
# WXXT base directory
|
||||
WXBASEDIR=@WXBASEDIR@
|
||||
|
||||
# set the OS type for compilation
|
||||
OS=@OS@
|
||||
# compile a library only
|
||||
RULE=bin
|
||||
|
||||
# define library name
|
||||
BIN_TARGET=wxFile
|
||||
# define library sources
|
||||
BIN_SRC=\
|
||||
wxFile.cpp filectrl.cpp dirctrl.cpp
|
||||
|
||||
#define library objects
|
||||
BIN_OBJ=\
|
||||
wxFile.o filectrl.o dirctrl.o
|
||||
|
||||
# additional things needed to link
|
||||
BIN_LINK=
|
||||
|
||||
# additional things needed to compile
|
||||
ADD_COMPILE=
|
||||
|
||||
# include the definitions now
|
||||
include ../../../template.mak
|
31
user/wxFile/commanderview.xpm
Normal file
31
user/wxFile/commanderview.xpm
Normal file
@@ -0,0 +1,31 @@
|
||||
/* XPM */
|
||||
static char * commanderview_xpm[] = {
|
||||
"22 22 3 1",
|
||||
" c None",
|
||||
". c #000000000000",
|
||||
"X c #FFFFFFFFFFFF",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ................. ",
|
||||
" .XXXXXXX.XXXXXXX. ",
|
||||
" .XX...XX.XX...XX. ",
|
||||
" .XXXXXXX.XXXXXXX. ",
|
||||
" .XX...XX.XX..XXX. ",
|
||||
" .XXXXXXX.XXXXXXX. ",
|
||||
" .XX..XXX.XX...XX. ",
|
||||
" .XXXXXXX.XXXXXXX. ",
|
||||
" .XX...XX.XX...XX. ",
|
||||
" .XXXXXXX.XXXXXXX. ",
|
||||
" .XX...XX.XX...XX. ",
|
||||
" .XXXXXXX.XXXXXXX. ",
|
||||
" ................. ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
||||
|
||||
|
||||
|
31
user/wxFile/delete.xpm
Normal file
31
user/wxFile/delete.xpm
Normal file
@@ -0,0 +1,31 @@
|
||||
/* XPM */
|
||||
static char * delete_xpm[] = {
|
||||
"22 22 6 1",
|
||||
" s None c None",
|
||||
". c black",
|
||||
"X c red2",
|
||||
"o c white",
|
||||
"O c #DEF6DEF6DEF6",
|
||||
"+ c grey70",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ........ ",
|
||||
" XXX .ooooooO. ",
|
||||
" XXXXOoooooOo. X ",
|
||||
" XXXOoooo Oo. XX ",
|
||||
" .XXXOoo ...XX ",
|
||||
" .+XXXOo OOXX ",
|
||||
" .O++XXXOXXX. ",
|
||||
" .ooO+XXXXX+. ",
|
||||
" .oooOXXXX+o. ",
|
||||
" .ooXXXX+XXo. ",
|
||||
" .XXXX++OXXO. ",
|
||||
" XXXX++Ooo+XX. ",
|
||||
" XXXX++OooooO+XX ",
|
||||
" XXX .OoooooooOXX ",
|
||||
" .ooooooooo+XX ",
|
||||
" ...........XX ",
|
||||
" X ",
|
||||
" ",
|
||||
" "};
|
220
user/wxFile/dirctrl.cpp
Normal file
220
user/wxFile/dirctrl.cpp
Normal file
@@ -0,0 +1,220 @@
|
||||
/*
|
||||
* Author: Robert Roebling
|
||||
*
|
||||
* Copyright: (C) 1997,1998 Robert Roebling
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the wxWindows Licence, which
|
||||
* you have received with this library (see Licence.htm).
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "dirctrl.h"
|
||||
#endif
|
||||
|
||||
#include "dirctrl.h"
|
||||
#include "wx/gdicmn.h"
|
||||
#include "wx/utils.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxDirInfo
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxDirInfo,wxObject)
|
||||
|
||||
wxDirInfo::wxDirInfo( const wxString &path )
|
||||
{
|
||||
m_showHidden = FALSE;
|
||||
m_path = path;
|
||||
if (m_path == "/") m_name ="The Computer";
|
||||
else
|
||||
if (m_path == "/home")
|
||||
{
|
||||
m_name = "My Home";
|
||||
m_path += "/";
|
||||
char buf[300];
|
||||
wxGetHomeDir( buf );
|
||||
m_path = buf;
|
||||
}
|
||||
else
|
||||
if (m_path == "/proc") m_name = "Info Filesystem";
|
||||
else
|
||||
if (m_path == "/mnt") m_name = "Mounted Devices";
|
||||
else
|
||||
if (m_path == "/usr/X11R6") m_name = "User X11";
|
||||
else
|
||||
if (m_path == "/usr") m_name = "User";
|
||||
else
|
||||
if (m_path == "/var") m_name = "Variables";
|
||||
else
|
||||
if (m_path == "/usr/local") m_name = "User local";
|
||||
else
|
||||
if (m_path == "/mnt") m_name = "Mounted Devices";
|
||||
else
|
||||
m_name = wxFileNameFromPath( m_path );
|
||||
};
|
||||
|
||||
wxString wxDirInfo::GetName(void) const
|
||||
{
|
||||
return m_name;
|
||||
};
|
||||
|
||||
wxString wxDirInfo::GetPath(void) const
|
||||
{
|
||||
return m_path;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxDirCtrl
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxDirCtrl,wxTreeCtrl)
|
||||
|
||||
BEGIN_EVENT_TABLE(wxDirCtrl,wxTreeCtrl)
|
||||
EVT_TREE_ITEM_EXPANDED (-1, wxDirCtrl::OnExpandItem)
|
||||
EVT_TREE_DELETE_ITEM (-1, wxDirCtrl::OnDeleteItem)
|
||||
EVT_MOUSE_EVENTS (wxDirCtrl::OnMouse)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
wxDirCtrl::wxDirCtrl(void)
|
||||
{
|
||||
m_showHidden = FALSE;
|
||||
};
|
||||
|
||||
wxDirCtrl::wxDirCtrl(wxWindow *parent, const wxWindowID id, const wxString &dir,
|
||||
const wxPoint& pos, const wxSize& size,
|
||||
const long style, const wxString& name )
|
||||
:
|
||||
wxTreeCtrl( parent, id, pos, size, style, name )
|
||||
{
|
||||
m_showHidden = FALSE;
|
||||
|
||||
wxTreeItem item;
|
||||
item.m_mask = wxTREE_MASK_TEXT | wxTREE_MASK_CHILDREN | wxTREE_MASK_DATA;
|
||||
item.m_text = "root.";
|
||||
item.m_children = 1;
|
||||
wxDirInfo *info = new wxDirInfo( dir );
|
||||
item.m_data = (long)info;
|
||||
|
||||
long root_id = InsertItem( 0, item );
|
||||
|
||||
info = new wxDirInfo( "/" );
|
||||
item.m_text = info->GetName();
|
||||
item.m_data = (long)info;
|
||||
InsertItem( root_id, item );
|
||||
|
||||
info = new wxDirInfo( "/home" );
|
||||
item.m_text = info->GetName();
|
||||
item.m_data = (long)info;
|
||||
InsertItem( root_id, item );
|
||||
|
||||
info = new wxDirInfo( "/mnt" );
|
||||
item.m_text = info->GetName();
|
||||
item.m_data = (long)info;
|
||||
InsertItem( root_id, item );
|
||||
|
||||
info = new wxDirInfo( "/usr" );
|
||||
item.m_text = info->GetName();
|
||||
item.m_data = (long)info;
|
||||
InsertItem( root_id, item );
|
||||
|
||||
info = new wxDirInfo( "/usr/X11R6" );
|
||||
item.m_text = info->GetName();
|
||||
item.m_data = (long)info;
|
||||
InsertItem( root_id, item );
|
||||
|
||||
info = new wxDirInfo( "/usr/local" );
|
||||
item.m_text = info->GetName();
|
||||
item.m_data = (long)info;
|
||||
InsertItem( root_id, item );
|
||||
|
||||
info = new wxDirInfo( "/var" );
|
||||
item.m_text = info->GetName();
|
||||
item.m_data = (long)info;
|
||||
InsertItem( root_id, item );
|
||||
|
||||
info = new wxDirInfo( "/proc" );
|
||||
item.m_text = info->GetName();
|
||||
item.m_data = (long)info;
|
||||
InsertItem( root_id, item );
|
||||
};
|
||||
|
||||
void wxDirCtrl::OnExpandItem( const wxTreeEvent &event )
|
||||
{
|
||||
wxDirInfo *info = (wxDirInfo *)event.m_item.m_data;
|
||||
if (!info) return;
|
||||
|
||||
wxArrayString slist;
|
||||
wxString search,path,filename;
|
||||
|
||||
search = info->GetPath();
|
||||
search += "/*";
|
||||
|
||||
path = wxFindFirstFile( search, wxDIR );
|
||||
while (!path.IsNull())
|
||||
{
|
||||
filename = wxFileNameFromPath( path );
|
||||
if (m_showHidden || (filename[0] != '.'))
|
||||
{
|
||||
if ((filename != ".") &&
|
||||
(filename != "..") &&
|
||||
(path != "/home") &&
|
||||
(path != "/usr/X11R6") &&
|
||||
(path != "/usr/local") &&
|
||||
(path != "/usr") &&
|
||||
(path != "/var") &&
|
||||
(path != "/home") &&
|
||||
(path != "/proc") &&
|
||||
(path != "/mnt")
|
||||
)
|
||||
slist.Add( path ); // ref counting in action !
|
||||
};
|
||||
path = wxFindNextFile();
|
||||
};
|
||||
|
||||
for (int i = 0; i < slist.Count(); i++)
|
||||
{
|
||||
search = slist[i];
|
||||
search += "/*";
|
||||
path = wxFindFirstFile( search, wxDIR );
|
||||
|
||||
wxDirInfo *child = new wxDirInfo( slist[i] );
|
||||
wxTreeItem item;
|
||||
item.m_mask = wxTREE_MASK_TEXT | wxTREE_MASK_CHILDREN | wxTREE_MASK_DATA;
|
||||
item.m_text = child->GetName();
|
||||
item.m_children = 0;
|
||||
if (!path.IsNull()) item.m_children = 1;
|
||||
item.m_data = (long)child;
|
||||
InsertItem( event.m_item.m_itemId, item );
|
||||
};
|
||||
};
|
||||
|
||||
void wxDirCtrl::OnDeleteItem( const wxTreeEvent &event )
|
||||
{
|
||||
wxDirInfo *info = (wxDirInfo *)event.m_item.m_data;
|
||||
if (info) delete info;
|
||||
};
|
||||
|
||||
void wxDirCtrl::OnMouse( wxMouseEvent &event )
|
||||
{
|
||||
event.Skip(TRUE);
|
||||
|
||||
if (event.LeftDown())
|
||||
{
|
||||
m_dragX = event.GetX();
|
||||
m_dragY = event.GetY();
|
||||
return;
|
||||
};
|
||||
|
||||
if (event.Dragging())
|
||||
{
|
||||
if ((abs(m_dragX-event.GetX()) < 2) &&
|
||||
(abs(m_dragY-event.GetY()) < 2)) return;
|
||||
|
||||
wxTextDragSource drag( this );
|
||||
drag.SetTextData( "Oh, what a drag." );
|
||||
drag.Start( event.GetX(), event.GetY() );
|
||||
};
|
||||
};
|
||||
|
74
user/wxFile/dirctrl.h
Normal file
74
user/wxFile/dirctrl.h
Normal file
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* File: DirCtrl.h
|
||||
* Purpose: dir tree control
|
||||
* Author: Robert Roebling
|
||||
* Created: 1997
|
||||
* Updated:
|
||||
* Copyright:
|
||||
*/
|
||||
|
||||
#ifndef __DIRCTRLH__
|
||||
#define __DIRCTRLH__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include "wx/treectrl.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// classes
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxDirInfo;
|
||||
class wxDirCtrl;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxDirInfo
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxDirInfo: public wxObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxDirInfo)
|
||||
|
||||
public:
|
||||
|
||||
wxString m_name;
|
||||
wxString m_path;
|
||||
bool m_showHidden;
|
||||
|
||||
|
||||
wxDirInfo() {};
|
||||
wxDirInfo( const wxString &path );
|
||||
wxString GetName(void) const;
|
||||
wxString GetPath(void) const;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxDirCtrl
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxDirCtrl: public wxTreeCtrl
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxDirCtrl)
|
||||
|
||||
public:
|
||||
|
||||
bool m_showHidden;
|
||||
int m_dragX,m_dragY;
|
||||
|
||||
wxDirCtrl(void);
|
||||
wxDirCtrl(wxWindow *parent, const wxWindowID id = -1, const wxString &dir = "/",
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
const long style = wxTR_HAS_BUTTONS,
|
||||
const wxString& name = "wxTreeCtrl" )
|
||||
;
|
||||
void OnExpandItem( const wxTreeEvent &event );
|
||||
void OnDeleteItem( const wxTreeEvent &event );
|
||||
void OnMouse( wxMouseEvent &event );
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif
|
29
user/wxFile/exit.xpm
Normal file
29
user/wxFile/exit.xpm
Normal file
@@ -0,0 +1,29 @@
|
||||
/* XPM */
|
||||
static char * exit_xpm[] = {
|
||||
"22 22 4 1",
|
||||
" c None",
|
||||
". c #000000000000",
|
||||
"X c #820782078207",
|
||||
"o c #FFFFFFFFFFFF",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" . ",
|
||||
" ..X .o.X ",
|
||||
" ..X .ooo.X ",
|
||||
" .o..oo ..XX ",
|
||||
" .oo .XXXX ",
|
||||
" .o .XXX ",
|
||||
" .o .XX ",
|
||||
" .o.X.o.X ",
|
||||
" .o.XX .o.X ",
|
||||
" .o.XX ..X ",
|
||||
" ..XX ..X ",
|
||||
" .XX .X ",
|
||||
" XX XX ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
541
user/wxFile/filectrl.cpp
Normal file
541
user/wxFile/filectrl.cpp
Normal file
@@ -0,0 +1,541 @@
|
||||
/*
|
||||
* Author: Robert Roebling
|
||||
*
|
||||
* Copyright: (C) 1997,1998 Robert Roebling
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the wxWindows Licence, which
|
||||
* you have received with this library (see Licence.htm).
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "filectrl.h"
|
||||
#endif
|
||||
|
||||
#include "filectrl.h"
|
||||
|
||||
#include "wx/dnd.h"
|
||||
|
||||
#include "sys/types.h"
|
||||
#include "sys/stat.h"
|
||||
#include "dirent.h"
|
||||
#include "pwd.h"
|
||||
#include "grp.h"
|
||||
#include "time.h"
|
||||
|
||||
#include "folder.xpm"
|
||||
#include "txt.xpm"
|
||||
#include "list.xpm"
|
||||
#include "find.xpm"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxFileData
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxFileData,wxObject);
|
||||
|
||||
wxFileData::wxFileData( const wxString &name, const wxString &fname )
|
||||
{
|
||||
m_name = name;
|
||||
m_fileName = fname;
|
||||
|
||||
struct stat buff;
|
||||
stat( m_fileName.GetData(), &buff );
|
||||
struct stat lbuff;
|
||||
lstat( m_fileName.GetData(), &lbuff );
|
||||
|
||||
struct tm *t = localtime( &lbuff.st_mtime );
|
||||
// struct passwd *user = getpwuid( buff.st_uid );
|
||||
// struct group *grp = getgrgid( buff.st_gid );
|
||||
|
||||
m_isDir = S_ISDIR( buff.st_mode );
|
||||
m_isLink = S_ISLNK( lbuff.st_mode );
|
||||
m_isExe = ((buff.st_mode & S_IXUSR ) == S_IXUSR );
|
||||
|
||||
m_size = buff.st_size;
|
||||
|
||||
m_hour = t->tm_hour;
|
||||
m_minute = t->tm_min;
|
||||
m_month = t->tm_mon+1;
|
||||
m_day = t->tm_mday;
|
||||
m_year = t->tm_year;
|
||||
|
||||
m_permissions.sprintf( "%c%c%c",
|
||||
((( buff.st_mode & S_IRUSR ) == S_IRUSR ) ? 'r' : '-'),
|
||||
((( buff.st_mode & S_IWUSR ) == S_IWUSR ) ? 'w' : '-'),
|
||||
((( buff.st_mode & S_IXUSR ) == S_IXUSR ) ? 'x' : '-') );
|
||||
};
|
||||
|
||||
wxString wxFileData::GetName(void) const
|
||||
{
|
||||
return m_name;
|
||||
};
|
||||
|
||||
wxString wxFileData::GetFullName(void) const
|
||||
{
|
||||
return m_fileName;
|
||||
};
|
||||
|
||||
wxString wxFileData::GetHint(void) const
|
||||
{
|
||||
wxString s = m_fileName;
|
||||
s += " ";
|
||||
if (m_isDir) s += "<DIR> ";
|
||||
else if (m_isLink) s += "<LINK> ";
|
||||
else
|
||||
{
|
||||
s += LongToString( m_size );
|
||||
s += " bytes ";
|
||||
};
|
||||
s += IntToString( m_day );
|
||||
s += ".";
|
||||
s += IntToString( m_month );
|
||||
s += ".";
|
||||
s += IntToString( m_year );
|
||||
s += " ";
|
||||
s += IntToString( m_hour );
|
||||
s += ":";
|
||||
s += IntToString( m_minute );
|
||||
s += " ";
|
||||
s += m_permissions;
|
||||
return s;
|
||||
};
|
||||
|
||||
wxString wxFileData::GetEntry( const int num )
|
||||
{
|
||||
wxString s;
|
||||
switch (num)
|
||||
{
|
||||
case 0:
|
||||
s = m_name;
|
||||
break;
|
||||
case 1:
|
||||
if (m_isDir) s = "<DIR>";
|
||||
else if (m_isLink) s = "<LINK>";
|
||||
else s = LongToString( m_size );
|
||||
break;
|
||||
case 2:
|
||||
if (m_day < 10) s = "0"; else s = "";
|
||||
s += IntToString( m_day );
|
||||
s += ".";
|
||||
if (m_month < 10) s += "0";
|
||||
s += IntToString( m_month );
|
||||
s += ".";
|
||||
if (m_year < 10) s += "0"; // this should happen real soon...
|
||||
s += IntToString( m_year );
|
||||
break;
|
||||
case 3:
|
||||
if (m_hour < 10) s = "0"; else s = "";
|
||||
s += IntToString( m_hour );
|
||||
s += ":";
|
||||
if (m_minute < 10) s += "0";
|
||||
s += IntToString( m_minute );
|
||||
break;
|
||||
case 4:
|
||||
s = m_permissions;
|
||||
break;
|
||||
default:
|
||||
s = "No entry";
|
||||
break;
|
||||
};
|
||||
return s;
|
||||
};
|
||||
|
||||
bool wxFileData::IsDir( void )
|
||||
{
|
||||
return m_isDir;
|
||||
};
|
||||
|
||||
bool wxFileData::IsExe( void )
|
||||
{
|
||||
return m_isExe;
|
||||
};
|
||||
|
||||
bool wxFileData::IsLink( void )
|
||||
{
|
||||
return m_isLink;
|
||||
};
|
||||
|
||||
long wxFileData::GetSize( void )
|
||||
{
|
||||
return m_size;
|
||||
};
|
||||
|
||||
bool wxFileData::NewNameIsLegal( const wxString &s )
|
||||
{
|
||||
wxString fileName = wxPathOnly( m_fileName );
|
||||
fileName += "/";
|
||||
fileName += s;
|
||||
return (!wxFileExists( fileName ));
|
||||
};
|
||||
|
||||
bool wxFileData::Rename( const wxString &s )
|
||||
{
|
||||
wxString fileName = wxPathOnly( m_fileName );
|
||||
fileName += "/";
|
||||
fileName += s;
|
||||
bool ret = wxRenameFile( m_fileName, fileName );
|
||||
if (ret)
|
||||
{
|
||||
m_fileName = fileName;
|
||||
m_name = s;
|
||||
};
|
||||
return ret;
|
||||
};
|
||||
|
||||
void wxFileData::MakeItem( wxListItem &item )
|
||||
{
|
||||
item.m_text = m_name;
|
||||
item.m_colour = wxBLACK;
|
||||
if (IsExe()) item.m_colour = wxRED;
|
||||
if (IsDir()) item.m_colour = wxBLUE;
|
||||
if (IsLink())
|
||||
{
|
||||
wxColour *dg = wxTheColourDatabase->FindColour( "MEDIUM GREY" );
|
||||
item.m_colour = dg;
|
||||
};
|
||||
item.m_data = (long)this;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxFileCtrl
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxFileCtrl,wxListCtrl);
|
||||
|
||||
BEGIN_EVENT_TABLE(wxFileCtrl,wxListCtrl)
|
||||
EVT_SET_FOCUS (wxFileCtrl::OnSetFocus)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
wxFileCtrl *wxFileCtrl::m_lastFocus = NULL;
|
||||
|
||||
wxFileCtrl::wxFileCtrl( void )
|
||||
{
|
||||
m_dirName = "/";
|
||||
m_showHidden = FALSE;
|
||||
};
|
||||
|
||||
wxFileCtrl::wxFileCtrl( wxWindow *win, const wxWindowID id, const wxString &dirName,
|
||||
const wxPoint &pos, const wxSize &size,
|
||||
const long style, const wxString &name ) :
|
||||
wxListCtrl( win, id, pos, size, style, name )
|
||||
{
|
||||
wxImageList *imageList = new wxImageList();
|
||||
imageList->Add( wxBitmap( folder_xpm ) );
|
||||
imageList->Add( wxBitmap( txt_xpm ) );
|
||||
imageList->Add( wxBitmap( list_xpm ) );
|
||||
imageList->Add( wxBitmap( find_xpm ) );
|
||||
|
||||
SetImageList( imageList, wxIMAGE_LIST_NORMAL );
|
||||
|
||||
m_dirName = dirName;
|
||||
m_showHidden = FALSE;
|
||||
Update();
|
||||
|
||||
m_lastFocus = this;
|
||||
|
||||
SetDropTarget( new wxTextDropTarget() );
|
||||
};
|
||||
|
||||
void wxFileCtrl::ChangeToListMode()
|
||||
{
|
||||
SetSingleStyle( wxLC_LIST );
|
||||
Update();
|
||||
};
|
||||
|
||||
void wxFileCtrl::ChangeToReportMode()
|
||||
{
|
||||
SetSingleStyle( wxLC_REPORT );
|
||||
Update();
|
||||
};
|
||||
|
||||
void wxFileCtrl::ChangeToIconMode()
|
||||
{
|
||||
SetSingleStyle( wxLC_ICON );
|
||||
Update();
|
||||
};
|
||||
|
||||
void wxFileCtrl::ShowHidden( bool show )
|
||||
{
|
||||
m_showHidden = show;
|
||||
Update();
|
||||
};
|
||||
|
||||
int ListCompare( const long data1, const long data2, const long WXUNUSED(data) )
|
||||
{
|
||||
wxFileData *fd1 = (wxFileData*)data1 ;
|
||||
wxFileData *fd2 = (wxFileData*)data2 ;
|
||||
if (fd1->IsDir() && !fd2->IsDir()) return -1;
|
||||
if (fd2->IsDir() && !fd1->IsDir()) return 1;
|
||||
return strcmp( fd1->GetName(), fd2->GetName() );
|
||||
};
|
||||
|
||||
void wxFileCtrl::Update( void )
|
||||
{
|
||||
DeleteAllItems();
|
||||
for (int i = 0; i < 5; i++) DeleteColumn( 0 );
|
||||
long my_style = GetWindowStyleFlag();
|
||||
if (my_style & wxLC_REPORT)
|
||||
{
|
||||
InsertColumn( 0, "Name", wxLIST_FORMAT_LEFT, 110 );
|
||||
InsertColumn( 1, "Size", wxLIST_FORMAT_LEFT, 60 );
|
||||
InsertColumn( 2, "Date", wxLIST_FORMAT_LEFT, 55 );
|
||||
InsertColumn( 3, "Time", wxLIST_FORMAT_LEFT, 50 );
|
||||
InsertColumn( 4, "Permissions", wxLIST_FORMAT_LEFT, 120 );
|
||||
};
|
||||
wxFileData *fd = NULL;
|
||||
wxListItem item;
|
||||
item.m_mask = wxLIST_MASK_TEXT + wxLIST_MASK_DATA;
|
||||
if (my_style & wxLC_ICON) item.m_mask += wxLIST_MASK_IMAGE;
|
||||
item.m_itemId = 0;
|
||||
item.m_col = 0;
|
||||
wxString s;
|
||||
wxString res = m_dirName + "/*";
|
||||
char *f = wxFindFirstFile( res.GetData(), 0 );
|
||||
while (f)
|
||||
{
|
||||
res = wxFileNameFromPath( f );
|
||||
fd = new wxFileData( res, f );
|
||||
s = fd->GetName();
|
||||
if (m_showHidden || (s[0] != '.'))
|
||||
{
|
||||
fd->MakeItem( item );
|
||||
if (my_style & wxLC_REPORT)
|
||||
{
|
||||
InsertItem( item );
|
||||
for (int i = 1; i < 5; i++) SetItem( item.m_itemId, i, fd->GetEntry( i) );
|
||||
}
|
||||
else if (my_style & wxLC_LIST)
|
||||
{
|
||||
InsertItem( item );
|
||||
}
|
||||
else if (my_style & wxLC_ICON)
|
||||
{
|
||||
if (fd->IsDir()) item.m_image = 0; else item.m_image = 1;
|
||||
InsertItem( item );
|
||||
};
|
||||
item.m_itemId++;
|
||||
};
|
||||
f = wxFindNextFile();
|
||||
};
|
||||
SortItems( ListCompare, 0 );
|
||||
RealizeChanges();
|
||||
};
|
||||
|
||||
|
||||
int wxFileCtrl::FillList( wxStringList &list )
|
||||
{
|
||||
long index = -1;
|
||||
int count = 0;
|
||||
wxString s;
|
||||
for (;;)
|
||||
{
|
||||
index = GetNextItem( index, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
|
||||
if (index == -1) break;
|
||||
wxListItem item;
|
||||
item.m_itemId = index;
|
||||
GetItem( item );
|
||||
wxFileData *fd = (wxFileData*)item.m_data;
|
||||
list.Add( fd->GetFullName() );
|
||||
index++;
|
||||
count++;
|
||||
};
|
||||
if (count == 0)
|
||||
{
|
||||
index = GetNextItem( -1, wxLIST_NEXT_ALL, wxLIST_STATE_FOCUSED );
|
||||
if (index == -1) return 0;
|
||||
wxListItem item;
|
||||
item.m_itemId = index;
|
||||
GetItem( item );
|
||||
wxFileData *fd = (wxFileData*)item.m_data;
|
||||
list.Add( fd->GetFullName() );
|
||||
count = 1;
|
||||
};
|
||||
return count;
|
||||
};
|
||||
|
||||
void wxFileCtrl::DeleteFiles(void)
|
||||
{
|
||||
/*
|
||||
wxStringList list;
|
||||
int count = FillList( list );
|
||||
if (count > 0)
|
||||
{
|
||||
wxString s = "Delete ";
|
||||
s += wxIntToString( count );
|
||||
s += " selected file";
|
||||
if (count > 1) s += "s";
|
||||
s += " or director";
|
||||
if (count > 1) s += "ies?"; else s+= "y?";
|
||||
if (wxYES == wxMessageBox( s, "Delete", wxYES_NO ))
|
||||
wxDeleteStatusDia( NULL, &list );
|
||||
};
|
||||
*/
|
||||
};
|
||||
|
||||
void wxFileCtrl::CopyFiles( char *WXUNUSED(dest) )
|
||||
{
|
||||
/*
|
||||
wxStringList list;
|
||||
int count = FillList( list );
|
||||
wxString s = dest;
|
||||
int ret = 0; // 0 = nix, 1 = copy, 2 = move
|
||||
wxCopyMoveDia( (wxFrame*)GetParent(), count, &ret, &s );
|
||||
if (ret == 1)
|
||||
wxCopyStatusDia( NULL, s, &list );
|
||||
*/
|
||||
};
|
||||
|
||||
void wxFileCtrl::MoveFiles( char *WXUNUSED(dest) )
|
||||
{
|
||||
};
|
||||
|
||||
void wxFileCtrl::RenameFile(void)
|
||||
{
|
||||
};
|
||||
|
||||
void wxFileCtrl::MakeDir(void)
|
||||
{
|
||||
/*
|
||||
wxString s = wxGetTextFromUser( "Enter new directory name:", "Make directory" );
|
||||
if (s.IsNull()) return;
|
||||
if (s == "") return;
|
||||
if ((s == ".") || (s == ".."))
|
||||
{
|
||||
wxMessageBox( "This was obviously an invalid directory name.", "Go away." );
|
||||
return;
|
||||
};
|
||||
wxString dir;
|
||||
GetDir( dir );
|
||||
dir += "/";
|
||||
dir += s;
|
||||
if (wxFileExists( dir ))
|
||||
{
|
||||
wxMessageBox( "Filename exists already. Cannot create directoy.", "Make directory" );
|
||||
return;
|
||||
};
|
||||
wxMkdir( dir );
|
||||
Update();
|
||||
*/
|
||||
};
|
||||
|
||||
void wxFileCtrl::GoToParentDir(void)
|
||||
{
|
||||
wxString s = m_dirName;
|
||||
int pos = s.Last( '/' );
|
||||
if ((pos >= 0) && (s != "/"))
|
||||
{
|
||||
s.Remove( pos, s.Length()-pos );
|
||||
if (s.Length() == 0) s = "/";
|
||||
m_dirName = s;
|
||||
Update();
|
||||
};
|
||||
};
|
||||
|
||||
void wxFileCtrl::GoToHomeDir(void)
|
||||
{
|
||||
wxString s = wxGetUserHome( wxString() );
|
||||
m_dirName = s;
|
||||
Update();
|
||||
};
|
||||
|
||||
void wxFileCtrl::GoToDir( const wxString &dir )
|
||||
{
|
||||
m_dirName = dir;
|
||||
Update();
|
||||
};
|
||||
|
||||
void wxFileCtrl::GetDir( wxString &dir )
|
||||
{
|
||||
dir = m_dirName;
|
||||
};
|
||||
|
||||
/*
|
||||
void wxFileCtrl::OnDropFiles( int WXUNUSED(n), char **WXUNUSED(data), int WXUNUSED(x), int WXUNUSED(y) )
|
||||
{
|
||||
wxString destDir;
|
||||
wxPoint pt( x, y );
|
||||
int flag = wxLIST_HITTEST_ONITEM;
|
||||
long hit = HitTest( pt, flag );
|
||||
if (hit > -1)
|
||||
{
|
||||
wxListItem li;
|
||||
li.m_itemId = hit;
|
||||
GetItem( li );
|
||||
wxFileData *fd = (wxFileData*)li.m_data;
|
||||
if (fd->IsDir()) fd->GetFullName( destDir );
|
||||
};
|
||||
if (destDir.IsNull()) destDir = m_dirName;
|
||||
int ret = 0; // 0 = nix, 1 = copy, 2 = move
|
||||
wxCopyMoveDia( (wxFrame*)GetParent(), n, &ret, &destDir );
|
||||
if (ret == 1)
|
||||
{
|
||||
wxStringList slist;
|
||||
for (int i = 0; i < n; i++) slist.Add( data[i] );
|
||||
wxCopyStatusDia( NULL, destDir.GetData(), &slist );
|
||||
Update();
|
||||
};
|
||||
};
|
||||
*/
|
||||
|
||||
void wxFileCtrl::OnListDeleteItem( wxListEvent &event )
|
||||
{
|
||||
wxFileData *fd = (wxFileData*)event.m_item.m_data;
|
||||
delete fd;
|
||||
};
|
||||
|
||||
void wxFileCtrl::OnListKeyDown( wxListEvent &event )
|
||||
{
|
||||
wxFileData *fd = (wxFileData*)event.m_item.m_data;
|
||||
if (fd->IsDir())
|
||||
{
|
||||
m_dirName = fd->GetFullName();
|
||||
Update();
|
||||
Refresh();
|
||||
return;
|
||||
};
|
||||
if (fd->IsExe())
|
||||
{
|
||||
wxExecute( fd->GetFullName() );
|
||||
return;
|
||||
};
|
||||
};
|
||||
|
||||
void wxFileCtrl::OnListEndLabelEdit( wxListEvent &event )
|
||||
{
|
||||
wxFileData *fd = (wxFileData*)event.m_item.m_data;
|
||||
wxString newName = event.m_item.m_text;
|
||||
if (fd->NewNameIsLegal( newName ))
|
||||
{
|
||||
if (fd->Rename( newName ))
|
||||
{
|
||||
Update();
|
||||
}
|
||||
else
|
||||
{
|
||||
wxString s = "Could not rename file to ";
|
||||
s += newName;
|
||||
s += ".";
|
||||
wxMessageBox( s, "FileMaker", wxOK );
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
wxString s = "File name ";
|
||||
s += newName;
|
||||
s += " exists already or is invalid.\n";
|
||||
s += "Could not rename file.";
|
||||
wxMessageBox( s, "FileMaker", wxOK );
|
||||
};
|
||||
return;
|
||||
};
|
||||
|
||||
void wxFileCtrl::OnSetFocus( wxFocusEvent &event )
|
||||
{
|
||||
m_lastFocus = this;
|
||||
event.Skip();
|
||||
};
|
||||
|
||||
|
112
user/wxFile/filectrl.h
Normal file
112
user/wxFile/filectrl.h
Normal file
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* Author: Robert Roebling
|
||||
*
|
||||
* Copyright: (C) 1997,1998 Robert Roebling
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the wxWindows Licence, which
|
||||
* you have received with this library (see Licence.htm).
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef FileList_h
|
||||
#define FileList_h
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include "wx/wx.h"
|
||||
#include "wx/listctrl.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// derived classes
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxFileData;
|
||||
class wxFileCtrl;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxFileData
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxFileData : public wxObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxFileData);
|
||||
|
||||
private:
|
||||
wxString m_name;
|
||||
wxString m_fileName;
|
||||
long m_size;
|
||||
int m_hour;
|
||||
int m_minute;
|
||||
int m_year;
|
||||
int m_month;
|
||||
int m_day;
|
||||
wxString m_permissions;
|
||||
bool m_isDir;
|
||||
bool m_isLink;
|
||||
bool m_isExe;
|
||||
|
||||
public:
|
||||
wxFileData( void ) {};
|
||||
wxFileData( const wxString &name, const wxString &fname );
|
||||
wxString GetName(void) const;
|
||||
wxString GetFullName(void) const;
|
||||
wxString GetHint(void) const;
|
||||
wxString GetEntry( const int num );
|
||||
bool IsDir( void );
|
||||
bool IsLink( void );
|
||||
bool IsExe( void );
|
||||
long GetSize( void );
|
||||
bool NewNameIsLegal( const wxString &s );
|
||||
bool Rename( const wxString &s );
|
||||
void MakeItem( wxListItem &item );
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxFileCtrl
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxFileCtrl : public wxListCtrl
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxFileCtrl);
|
||||
|
||||
public:
|
||||
|
||||
static wxFileCtrl* m_lastFocus;
|
||||
|
||||
private:
|
||||
wxString m_dirName;
|
||||
bool m_showHidden;
|
||||
|
||||
public:
|
||||
wxFileCtrl( void );
|
||||
wxFileCtrl( wxWindow *win, const wxWindowID id, const wxString &dirName,
|
||||
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
|
||||
const long style = wxLC_LIST, const wxString &name = "filelist" );
|
||||
void ChangeToListMode();
|
||||
void ChangeToReportMode();
|
||||
void ChangeToIconMode();
|
||||
void ShowHidden( bool show = TRUE );
|
||||
void Update( void );
|
||||
virtual void StatusbarText( char *WXUNUSED(text) ) {};
|
||||
int FillList( wxStringList &list );
|
||||
void DeleteFiles(void);
|
||||
void CopyFiles( char *dest );
|
||||
void MoveFiles( char *dest );
|
||||
void RenameFile(void);
|
||||
void MakeDir(void);
|
||||
void GoToParentDir(void);
|
||||
void GoToHomeDir(void);
|
||||
void GoToDir( const wxString &dir );
|
||||
void GetDir( wxString &dir );
|
||||
void OnListDeleteItem( wxListEvent &event );
|
||||
void OnListKeyDown( wxListEvent &event );
|
||||
void OnListEndLabelEdit( wxListEvent &event );
|
||||
void OnSetFocus( wxFocusEvent &event );
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif // FileList_h
|
30
user/wxFile/fileopen.xpm
Normal file
30
user/wxFile/fileopen.xpm
Normal file
@@ -0,0 +1,30 @@
|
||||
/* XPM */
|
||||
static char * fileopen_xpm[] = {
|
||||
"22 22 5 1",
|
||||
" c None",
|
||||
". c #000000000000",
|
||||
"X c #D75CD75CD75C",
|
||||
"o c #FFFFFFFFFFFF",
|
||||
"O c #6DB66DB66DB6",
|
||||
" ",
|
||||
" ",
|
||||
" .... ",
|
||||
" .. . ",
|
||||
" ... ",
|
||||
" ... ",
|
||||
" .... ",
|
||||
" .... ",
|
||||
" .XoX....... ",
|
||||
" .oXoXoXoXo. ",
|
||||
" .XoXoXoXoX. ",
|
||||
" .oXoXo .......... ",
|
||||
" .XoXo . O O O OO. ",
|
||||
" .oXo . O O OOOO. ",
|
||||
" .Xo .OO OOOOOO. ",
|
||||
" .o . O OOOOOO. ",
|
||||
" ... O OOOOOO. ",
|
||||
" ..OOOOOOOOO. ",
|
||||
" ........... ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
99
user/wxFile/find.xpm
Normal file
99
user/wxFile/find.xpm
Normal file
@@ -0,0 +1,99 @@
|
||||
/* XPM */
|
||||
static char * find_xpm[] = {
|
||||
"32 32 64 1",
|
||||
" s background c None",
|
||||
". c black",
|
||||
"X c #FFFFFBEEFFFF",
|
||||
"o c #AEBAAAAAAEBA",
|
||||
"O c #4924618579E7",
|
||||
"+ c #AEBA8A286185",
|
||||
"@ c #BEFB8A2871C6",
|
||||
"# c #71C682078617",
|
||||
"$ c #4924410330C2",
|
||||
"% c #492451446185",
|
||||
"& c #49243CF338E3",
|
||||
"* c #EFBEAAAA8E38",
|
||||
"= c #AEBA71C66185",
|
||||
"- c #9E79820769A6",
|
||||
"; c #5144410338E3",
|
||||
": c #514434D338E3",
|
||||
"> c #D75CA28971C6",
|
||||
", c #514430C230C2",
|
||||
"< c #618541034103",
|
||||
"1 c #BEFB8A286185",
|
||||
"2 c #B6DA7DF75965",
|
||||
"3 c #410338E330C2",
|
||||
"4 c #514441034103",
|
||||
"5 c #AEBA9A696185",
|
||||
"6 c #9E7971C65144",
|
||||
"7 c #9E7971C66185",
|
||||
"8 c #DF7DAEBA9E79",
|
||||
"9 c #38E338E330C2",
|
||||
"0 c #410330C22081",
|
||||
"q c #A69961855144",
|
||||
"w c #618549244924",
|
||||
"e c #30C230C22081",
|
||||
"r c #38E32CB230C2",
|
||||
"t c #8E3851445144",
|
||||
"y c #28A228A230C2",
|
||||
"u c #79E759654924",
|
||||
"i c #A69969A65965",
|
||||
"p c #8E3861855144",
|
||||
"a c #71C661854103",
|
||||
"s c #208120812081",
|
||||
"d c #596538E330C2",
|
||||
"f c #8E3871C65144",
|
||||
"g c #71C651445144",
|
||||
"h c #186118611861",
|
||||
"j c #8E3861854103",
|
||||
"k c #71C651444103",
|
||||
"l c #71C641034103",
|
||||
"z c #514451445144",
|
||||
"x c #5144514430C2",
|
||||
"c c #104010401040",
|
||||
"v c #410330C230C2",
|
||||
"b c #30C220812081",
|
||||
"n c #618551444103",
|
||||
"m c #79E779E779E7",
|
||||
"M c #6185410330C2",
|
||||
"N c #38E330C22081",
|
||||
"B c #6185514430C2",
|
||||
"V c #38E324922081",
|
||||
"C c #514400000000",
|
||||
"Z c #E79DD34CD75C",
|
||||
"A c #C71BC71BBEFB",
|
||||
"S c #8E387DF769A6",
|
||||
"D c #208128A228A2",
|
||||
"F c #30C238E34103",
|
||||
" ........ XXXo ",
|
||||
" ..O......O..Xoo+@ ",
|
||||
" .#..$.###%..&.@+*X=- ",
|
||||
" ...;;;.%$:;;;...XX>XXXo ",
|
||||
" ...$$,$+XXX.##<#..o111@2 ",
|
||||
" .&.34&+XXoo5.XX#%.$.@@5*X=6 ",
|
||||
" ..3378X+@@++@@++@@..XX>XXoo+2 ",
|
||||
".9.0qXXX2++12+XXX.X.w.XXo11@@1 ",
|
||||
"..erX66==66=11111.o1..1111*XX>>t",
|
||||
"..yuXi76678X+@2++@@+..:+XXX>+ppa",
|
||||
"..sdXpppXX=++@=++=8X..w+fqppupge",
|
||||
"..h<XajtX67==67=*XX*..&qqpjttak.",
|
||||
"..h<XkwlXfqqiXX*=66=..9qqjjtukd.",
|
||||
"..h0Xz<xXpppX*i6-==6..yfpppaak,.",
|
||||
".c.vXz4dXzguXi=&-=7.9.rputgawk.z",
|
||||
"X..bX,d<XwklX+2==66..rettakkln.m",
|
||||
"X.c.Xb0,XkM<X$i=q6.v.NjtulkllB. ",
|
||||
"X4..XbVvXz:hX==66...Nytaakknn<. ",
|
||||
"X<c...bnX,v0>=76.....pganknwBMz ",
|
||||
"XM.w.h..Xb0,*6..v..CC.kklkB<<;m ",
|
||||
"ZMzX#..;......9..N.rC...lBM<dem ",
|
||||
" =zXXsc........9eNN..CCC.<M:dVm ",
|
||||
" =oXA<.##hc$9vNryrye.VCCC.4de.z ",
|
||||
" SoXZMzXXyc;vrNttaVV..VCCC.V.z ",
|
||||
" -Xk82zXXM.*qjjtukkbb..sCCC.z ",
|
||||
" SXlA=oXZM.Xpptaakknss..VCCC. ",
|
||||
" ..z-oXA=zXatganknBx.D..FCCC. ",
|
||||
" zmSXk82zXtakllBB<.zDD..FCCC. ",
|
||||
" Xl.SoXuknl<.zz FF..%CCC.",
|
||||
" ..z-oXakkn.zz %%..OCC.",
|
||||
" SXkn.zzz %O..OO.",
|
||||
" Xk.z OO... "};
|
48
user/wxFile/folder.xpm
Normal file
48
user/wxFile/folder.xpm
Normal file
@@ -0,0 +1,48 @@
|
||||
/* XPM */
|
||||
static char * folder_xpm[] = {
|
||||
"33 33 12 1",
|
||||
" c None",
|
||||
". c #D75CA69979E7",
|
||||
"X c #208120812081",
|
||||
"o c #FFFFFFFFFFFF",
|
||||
"O c #B6DA79E74924",
|
||||
"+ c #596559655965",
|
||||
"@ c #410341034103",
|
||||
"# c #514451445144",
|
||||
"$ c #000000000820",
|
||||
"% c #8E38596530C2",
|
||||
"& c #8E3886178617",
|
||||
"* c #492479E769A6",
|
||||
" ",
|
||||
" .. XXX ",
|
||||
" .o.. X.XXX ",
|
||||
" .ooo..OOOXXX ",
|
||||
" .ooooo..OOOXXX ++ ",
|
||||
"XXX .ooooooo..OOOXXX @#++@ ",
|
||||
"XOX@X.ooooooooo...OOO@XX+X#+++ ",
|
||||
"X...@@$.oooooooooo...OOXXX@X@+ ",
|
||||
"O.....@XXOooooooooooo..OOOX@@X ",
|
||||
"XO......@%X.ooooooooooo..%%OX@ ",
|
||||
".O........@XX.oooooooooo.X%XX ",
|
||||
" %O.........@@$.oooooooo.XX%X ",
|
||||
" %O...........@@$.oooooo.X%X# ",
|
||||
" %O.............@@X.oooo.XX%& ",
|
||||
" .@...............@XX.oo.@XX ",
|
||||
" %.................@X.o.XXX ",
|
||||
" OO................O%X..XX@ ",
|
||||
" +OO.......O..OOOOOOO@..@X& ",
|
||||
" .%O....OOOOOOOOOOOOOX.+XX ",
|
||||
" XOOOOOOOOOOOOOOOOOOX+*XX ",
|
||||
" @OOOOO.OOOOOOOOOOOOX*+XX ",
|
||||
" .%OOOOOOOOOOOOOOO%OXX#XX ",
|
||||
" XOOOOOOOOOOO%O%O%%OX++& ",
|
||||
" @O%O%OO%O%%O%%%%%%%XXX ",
|
||||
" XXXO%%%%%%%%%%%%%%XXX ",
|
||||
" OXXX%%%%%%%%%%%%@XX# ",
|
||||
" OX@X%%%%%%%%%%%XXX ",
|
||||
" OXXX%%%O%%%%%XXX ",
|
||||
" OXXX%%%%%%%XX* ",
|
||||
" OX@X%%%%X%X& ",
|
||||
" OXXX%%%XX ",
|
||||
" OXXX%%@ ",
|
||||
" OXXX "};
|
29
user/wxFile/help.xpm
Normal file
29
user/wxFile/help.xpm
Normal file
@@ -0,0 +1,29 @@
|
||||
/* XPM */
|
||||
static char * help_xpm[] = {
|
||||
"22 22 4 1",
|
||||
" c None",
|
||||
". c #000000000000",
|
||||
"X c #000000008617",
|
||||
"o c #861782078617",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" . XXXXXo ",
|
||||
" .. XX oXXo ",
|
||||
" ... XXo XXX ",
|
||||
" .... XXo XXX ",
|
||||
" ..... oXX oXXo ",
|
||||
" ...... XXo ",
|
||||
" ....... XX ",
|
||||
" ........ XXo ",
|
||||
" ..... XXo ",
|
||||
" .. .. ",
|
||||
" . .. XXX ",
|
||||
" .. XXX ",
|
||||
" .. ",
|
||||
" .. ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
28
user/wxFile/home.xpm
Normal file
28
user/wxFile/home.xpm
Normal file
@@ -0,0 +1,28 @@
|
||||
/* XPM */
|
||||
static char * home_xpm[] = {
|
||||
"22 22 3 1",
|
||||
" c None",
|
||||
". c #000000000000",
|
||||
"X c #FFFFFFFFFFFF",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" .. ",
|
||||
" . .... ",
|
||||
" . .XX . ",
|
||||
" . .XXXX . ",
|
||||
" ..XXXXXX . ",
|
||||
" .XXXXXXXX . ",
|
||||
" .XXXXXXXXX . ",
|
||||
" ...XXXXXXXX ... ",
|
||||
" .XXXXXXXX . ",
|
||||
" .XXX...XX . ",
|
||||
" .XXX. .XX . ",
|
||||
" .XXX. .XX . ",
|
||||
" .XXX. .XX . ",
|
||||
" .XXX. .XX . ",
|
||||
" ..... ...... ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
31
user/wxFile/iconview.xpm
Normal file
31
user/wxFile/iconview.xpm
Normal file
@@ -0,0 +1,31 @@
|
||||
/* XPM */
|
||||
static char * iconview_xpm[] = {
|
||||
"22 22 3 1",
|
||||
" c None",
|
||||
". c #000000000000",
|
||||
"X c #FFFFFFFFFFFF",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ................. ",
|
||||
" .XXXXXXXXXXXXXXX. ",
|
||||
" .XX...XXXXX...XX. ",
|
||||
" .XX...XXXXX...XX. ",
|
||||
" .XXXXXXXXXXXXXXX. ",
|
||||
" .X.....XXX.....X. ",
|
||||
" .XXXXXXXXXXXXXXX. ",
|
||||
" .XX...XXXXX...XX. ",
|
||||
" .XX...XXXXX...XX. ",
|
||||
" .XXXXXXXXXXXXXXX. ",
|
||||
" .X.....XXX.....X. ",
|
||||
" .XXXXXXXXXXXXXXX. ",
|
||||
" ................. ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
||||
|
||||
|
||||
|
45
user/wxFile/list.xpm
Normal file
45
user/wxFile/list.xpm
Normal file
@@ -0,0 +1,45 @@
|
||||
/* XPM */
|
||||
static char * list_xpm[] = {
|
||||
"32 32 10 1",
|
||||
" c #DF7DDF7DDF7D",
|
||||
". c #9E799E79A699",
|
||||
"X c #AEBAAEBAAEBA",
|
||||
"o c #FFFFFFFFFFFF",
|
||||
"O c #514451445144",
|
||||
"+ c #410341034103",
|
||||
"@ c #596559655965",
|
||||
"# c #000000000000",
|
||||
"$ c #BEFBBEFBBEFB",
|
||||
"% c #208120812081",
|
||||
" ",
|
||||
" . ",
|
||||
" Xo.. ",
|
||||
" Xoooo.X ",
|
||||
" Xooooooo.X ",
|
||||
" XooooO+ooooXX ",
|
||||
" XoooooooO+ooo.. ",
|
||||
" XooooOOoooo@@ooo.. ",
|
||||
" XoooooooOOooooooooo.X ",
|
||||
" Xoooo@Ooooo+@oooO+oooo.X",
|
||||
" Xooooooo@OoooooooooO+oooo",
|
||||
" XooooooooooO@oooOOoooo@@oo",
|
||||
" XooooO+ooooooooooooOOoooooo",
|
||||
" XoooooooO+oooooo@Ooooo+@oooX",
|
||||
" XooooOOoooo@@oooooo@OooooooOX",
|
||||
" XoooooooOOooooooooooooO@oooOX#",
|
||||
" Xoooo@Ooooo+@oooO+oooooooooOX#X",
|
||||
"Xooooooo@OoooooooooO+ooooooOX#XX",
|
||||
"O@$oooooooO@oooOOoooo@@oooOX#XX ",
|
||||
"X#+@$ooooooooooooOOooooooOX#XX ",
|
||||
" XX#O@ooooooo@Ooooo+@oooOX#XX ",
|
||||
" XX#OXooooooo@OooooooOX#X ",
|
||||
" XXO@XoooooooO@oooOX#X ",
|
||||
" XX#%@XoooooooooOX#X ",
|
||||
" XX#%@XooooooOX#X ",
|
||||
" XX#%@XoooOX#X ",
|
||||
" XX#%@XOX#X ",
|
||||
" XX#+X#X ",
|
||||
" XXXX ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
30
user/wxFile/listview.xpm
Normal file
30
user/wxFile/listview.xpm
Normal file
@@ -0,0 +1,30 @@
|
||||
/* XPM */
|
||||
static char * listview_xpm[] = {
|
||||
"22 22 3 1",
|
||||
" c None",
|
||||
". c #000000000000",
|
||||
"X c #FFFFFFFFFFFF",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ................. ",
|
||||
" .XXXXXXXXXXXXXXX. ",
|
||||
" .XX.....XXX....X. ",
|
||||
" .XXXXXXXXXXXXXXX. ",
|
||||
" .XX...XXXXX..XXX. ",
|
||||
" .XXXXXXXXXXXXXXX. ",
|
||||
" .XX..XXXXXX...XX. ",
|
||||
" .XXXXXXXXXXXXXXX. ",
|
||||
" .XX.....XXX...XX. ",
|
||||
" .XXXXXXXXXXXXXXX. ",
|
||||
" .XX...XXXXXXXXXX. ",
|
||||
" .XXXXXXXXXXXXXXX. ",
|
||||
" ................. ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
||||
|
||||
|
29
user/wxFile/prev.xpm
Normal file
29
user/wxFile/prev.xpm
Normal file
@@ -0,0 +1,29 @@
|
||||
/* XPM */
|
||||
static char * prev_xpm[] = {
|
||||
"22 22 4 1",
|
||||
" c None",
|
||||
". c #000000000000",
|
||||
"X c #861782078617",
|
||||
"o c #FFFFFFFFFFFF",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ....... ",
|
||||
" ....... ",
|
||||
" ......X ",
|
||||
" ........ .ooooo. ",
|
||||
" .o o. ",
|
||||
" ..... .o o. ",
|
||||
" .o o. ",
|
||||
" ........ . . . ",
|
||||
" ........ .. . . ",
|
||||
" . ",
|
||||
" .... ",
|
||||
" ",
|
||||
" ...... ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
31
user/wxFile/reportview.xpm
Normal file
31
user/wxFile/reportview.xpm
Normal file
@@ -0,0 +1,31 @@
|
||||
/* XPM */
|
||||
static char * reportview_xpm[] = {
|
||||
"22 22 3 1",
|
||||
" c None",
|
||||
". c #000000000000",
|
||||
"X c #FFFFFFFFFFFF",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ................. ",
|
||||
" .XXXXXXXXXXXXXXX. ",
|
||||
" ................. ",
|
||||
" .XXXXXXXXXXXXXXX. ",
|
||||
" .XX..XXXX.XX..XX. ",
|
||||
" .XXXXXXXXXXXXXXX. ",
|
||||
" .XX...XXX.XX..XX. ",
|
||||
" .XXXXXXXXXXXXXXX. ",
|
||||
" .XX...XXX.XX..XX. ",
|
||||
" .XXXXXXXXXXXXXXX. ",
|
||||
" .XX...XXX.XX..XX. ",
|
||||
" .XXXXXXXXXXXXXXX. ",
|
||||
" ................. ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
||||
|
||||
|
||||
|
30
user/wxFile/save.xpm
Normal file
30
user/wxFile/save.xpm
Normal file
@@ -0,0 +1,30 @@
|
||||
/* XPM */
|
||||
static char * save_xpm[] = {
|
||||
"22 22 5 1",
|
||||
" c None",
|
||||
". c #000000000000",
|
||||
"X c #FFFFFFFFFFFF",
|
||||
"o c #CB2BCB2BCB2B",
|
||||
"O c #82077DF77DF7",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" .............. ",
|
||||
" . XXXXXXXXXo .O ",
|
||||
" . X.....XXXo .O ",
|
||||
" . XXXXXXXXXo .O ",
|
||||
" . X...XXXXXo .O ",
|
||||
" . XXXXXXXXXo .O ",
|
||||
" . XXXXXXXXXo .O ",
|
||||
" . oooooooooo .O ",
|
||||
" . OOOOOOOOOO .O ",
|
||||
" . OOOOOOOOOO .O ",
|
||||
" . OO OOo .O ",
|
||||
" . OO OO OOo .O ",
|
||||
" . OO OO OOo .O ",
|
||||
" . OO OOo .O ",
|
||||
" ..............O ",
|
||||
" OOOOOOOOOOOOOO ",
|
||||
" ",
|
||||
" "};
|
32
user/wxFile/search.xpm
Normal file
32
user/wxFile/search.xpm
Normal file
@@ -0,0 +1,32 @@
|
||||
/* XPM */
|
||||
static char * search_xpm[] = {
|
||||
"22 22 4 1",
|
||||
" c None",
|
||||
". c #000000000000",
|
||||
"X c #FFFFFFFFFFFF",
|
||||
"o c #CB2BCB2BCB2B",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" o.......o ",
|
||||
" o..o o.. ",
|
||||
" o. o .o ",
|
||||
" .o .. ",
|
||||
" .o o.o ",
|
||||
" o.o .. ",
|
||||
" .o .. ",
|
||||
" o.o o.. ",
|
||||
" o.o o... ",
|
||||
" ........oo ",
|
||||
" ....oo ",
|
||||
" ...oo ",
|
||||
" ...oo ",
|
||||
" ...oo ",
|
||||
" ...oo ",
|
||||
" ...oo ",
|
||||
" oo ",
|
||||
" ",
|
||||
" "};
|
||||
|
||||
|
||||
|
30
user/wxFile/singleview.xpm
Normal file
30
user/wxFile/singleview.xpm
Normal file
@@ -0,0 +1,30 @@
|
||||
/* XPM */
|
||||
static char * singleview_xpm[] = {
|
||||
"22 22 3 1",
|
||||
" c None",
|
||||
". c #000000000000",
|
||||
"X c #FFFFFFFFFFFF",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ................. ",
|
||||
" .XXXXXXXXXXXXXXX. ",
|
||||
" .XX.....XXX....X. ",
|
||||
" .XXXXXXXXXXXXXXX. ",
|
||||
" .XX...XXXXX..XXX. ",
|
||||
" .XXXXXXXXXXXXXXX. ",
|
||||
" .XX..XXXXXX...XX. ",
|
||||
" .XXXXXXXXXXXXXXX. ",
|
||||
" .XX.....XXX...XX. ",
|
||||
" .XXXXXXXXXXXXXXX. ",
|
||||
" .XX...XXXXXXXXXX. ",
|
||||
" .XXXXXXXXXXXXXXX. ",
|
||||
" ................. ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
||||
|
||||
|
44
user/wxFile/trash.xpm
Normal file
44
user/wxFile/trash.xpm
Normal file
@@ -0,0 +1,44 @@
|
||||
/* XPM */
|
||||
static char * trash_xpm[] = {
|
||||
/* width height ncolors chars_per_pixel */
|
||||
"32 32 6 1",
|
||||
/* colors */
|
||||
" s background c None",
|
||||
". c black",
|
||||
"X c white",
|
||||
"o c grey",
|
||||
"O c slate grey",
|
||||
"+ c dark slate grey",
|
||||
/* pixels */
|
||||
" ...... ",
|
||||
" . . ",
|
||||
" .................... ",
|
||||
" .XXXXXXXXXXooooooOOOO. ",
|
||||
" .ooooOoOOO+O+++.+..... ",
|
||||
" .XXXXoXoOOOO+++++++. ",
|
||||
" .XXXXXXooooOO++++++. ",
|
||||
" .XXXoXooOoOO+O++..+. ",
|
||||
" .XXoXXXOOoo++O++.++. ",
|
||||
" .XXoXXoOooo+++O+..+. ",
|
||||
" .XXoXXXOOoo++O++.++. ",
|
||||
" .XXoXXoOooo+++O+..+. ",
|
||||
" .XXoXXXOOoo++O++.++. ",
|
||||
" .XXoXXoOooo+++O+..+. ",
|
||||
" .XXoXXXOOoo++OO+.++. ",
|
||||
" .XXoXXoOooo+++O+..+. ",
|
||||
" .XXoXXXOOoo++OO+.++. ",
|
||||
" .XXoXXoOooo+++O+..+. ",
|
||||
" .XXoXXXOOoo++OO+.++. ",
|
||||
" .XXoXXoOooo+++O+..+. ",
|
||||
" .XXoXXXOOoo++OO+.++. ",
|
||||
" .XXoXXoOooo+++O+..+. ",
|
||||
" .XXoXXXOOoo++OO+.++. ",
|
||||
" .XXoXXoOooo+++O+..+. ",
|
||||
" .XXoXXXOOoo++OO+.++. ",
|
||||
" .XXoXXoOooo+++O+..+. ",
|
||||
" .XXoXXXOOoo++OO+.++. ",
|
||||
" .XXoXXoOooO+++++..+. ",
|
||||
" .XXXoXXoOooO+OOO.++. ",
|
||||
" .XXXXXXoooOoOOOOO++. ",
|
||||
" .XXXXXooooooOOOOO++. ",
|
||||
" .................... "};
|
31
user/wxFile/treeview.xpm
Normal file
31
user/wxFile/treeview.xpm
Normal file
@@ -0,0 +1,31 @@
|
||||
/* XPM */
|
||||
static char * treeview_xpm[] = {
|
||||
"22 22 3 1",
|
||||
" c None",
|
||||
". c #000000000000",
|
||||
"X c #FFFFFFFFFFFF",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ................. ",
|
||||
" .XXXXXXXXXXXXXXX. ",
|
||||
" .XX.......XXXXXX. ",
|
||||
" .XXXX.XXXXXXXXXX. ",
|
||||
" .XXXX.....XXXXXX. ",
|
||||
" .XXXX.XXXXXXXXXX. ",
|
||||
" .XXXX.......XXXX. ",
|
||||
" .XXXX.XXX.XXXXXX. ",
|
||||
" .XXXX.XXX.....XX. ",
|
||||
" .XXXX.XXXXXXXXXX. ",
|
||||
" .XXXX.....XXXXXX. ",
|
||||
" .XXXXXXXXXXXXXXX. ",
|
||||
" ................. ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
||||
|
||||
|
||||
|
53
user/wxFile/txt.xpm
Normal file
53
user/wxFile/txt.xpm
Normal file
@@ -0,0 +1,53 @@
|
||||
/* XPM */
|
||||
static char * txt_xpm[] = {
|
||||
"32 32 18 1",
|
||||
" c None",
|
||||
". c #D75CA69979E7",
|
||||
"X c #BEFBBEFBBEFB",
|
||||
"o c #208120812081",
|
||||
"O c #F7DE28A22081",
|
||||
"+ c #AEBAAEBAAEBA",
|
||||
"@ c #FFFFD75C0000",
|
||||
"# c #8E38596530C2",
|
||||
"$ c #FFFFFFFFFFFF",
|
||||
"% c #B6DA79E74924",
|
||||
"& c #9E799E79A699",
|
||||
"* c #514451445144",
|
||||
"= c #492479E769A6",
|
||||
"- c #410341034103",
|
||||
"; c #000000000000",
|
||||
": c #596559655965",
|
||||
"> c #8E3886178617",
|
||||
", c #410341038E38",
|
||||
" ",
|
||||
" .X ",
|
||||
" Xoo. ",
|
||||
" O.Xo ",
|
||||
" ++ +X@O#o ",
|
||||
" +$$++ +$$%%#o ",
|
||||
" +$$$$$+$$$@%#o& ",
|
||||
" +$$$$$+$$$$O%#o$&& ",
|
||||
" +$$$$$+$$$$$@##o$$$&+ ",
|
||||
" +$$**$+$$$$$$%O#o$$$$$& ",
|
||||
" +$$$$$+$$**$$+@%#o$$$$$$=",
|
||||
" +$$**$+$$$$$*&$O%-o$$$$$-+",
|
||||
" +$$$$$+$$**$$+$$@%o;+$$$*+;",
|
||||
" +$$**$+$$$$$*+$$$O##o$+$*+;+",
|
||||
" +$$$$$+$$**$$+$$$$@#oo$$++;+ ",
|
||||
" +$$**$+$$$$$*+$$$$$%%#;$$$$++ ",
|
||||
" +$$$$$+$$**$$+$$*-$$%#oo$$$$$$*",
|
||||
"+$$$$$+$$$$$*+$$$$$*-O##;$$$$$-+",
|
||||
"*:X$$+oo+$$$+$$**$$$$%%;o$$$$*+;",
|
||||
"+;-:X$$+oo:&$$$$$**$$ooo;$$$*+;+",
|
||||
" +;*:X$$*+$$**$$$$*-X%o$$$*+;+ ",
|
||||
" +;**++$$$$$**$$$$.#o$$*+;+ ",
|
||||
" +*+$$=:$$$$*-$$$##$>Xo+ ",
|
||||
" +$$$$$:*$$$$-*$;X-+-+ ",
|
||||
" *+$$$$$$$:*$$$$$;,+;& ",
|
||||
" +*:+$$$$$$$*:$$$=+;+ ",
|
||||
" +;o:+$$$$$$$$$*+;+ ",
|
||||
" +;o:+$$$$$$*+;+ ",
|
||||
" +;o:+$$$*+;+ ",
|
||||
" +;o:+*+;+ ",
|
||||
" +;-+;+ ",
|
||||
" +;+ "};
|
393
user/wxFile/wxFile.cpp
Normal file
393
user/wxFile/wxFile.cpp
Normal file
@@ -0,0 +1,393 @@
|
||||
/*
|
||||
* Program: wxFile
|
||||
*
|
||||
* Author: Robert Roebling
|
||||
*
|
||||
* Copyright: (C) 1997, GNU (Robert Roebling)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "wxFile.h"
|
||||
#endif
|
||||
|
||||
#include "wxFile.h"
|
||||
#include "wx/dnd.h"
|
||||
|
||||
#include "delete.xpm"
|
||||
#include "home.xpm"
|
||||
#include "prev.xpm"
|
||||
#include "fileopen.xpm"
|
||||
#include "exit.xpm"
|
||||
#include "listview.xpm"
|
||||
#include "iconview.xpm"
|
||||
#include "reportview.xpm"
|
||||
#include "treeview.xpm"
|
||||
#include "commanderview.xpm"
|
||||
#include "singleview.xpm"
|
||||
#include "save.xpm"
|
||||
#include "search.xpm"
|
||||
#include "help.xpm"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// main program
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_APP(MyApp)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// MyFrame
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
const ID_FILECTRL = 1000;
|
||||
const ID_DIRCTRL = 1001;
|
||||
const ID_TOOLBAR = 1002;
|
||||
|
||||
const ID_QUIT = 100;
|
||||
const ID_ABOUT = 101;
|
||||
|
||||
const ID_LIST = 200;
|
||||
const ID_REPORT = 201;
|
||||
const ID_ICON = 202;
|
||||
|
||||
const ID_SINGLE = 203;
|
||||
const ID_TREE = 204;
|
||||
const ID_COMMANDER = 205;
|
||||
|
||||
const ID_HOME = 400;
|
||||
const ID_PARENT = 401;
|
||||
const ID_MOUNT = 402;
|
||||
const ID_SEARCH = 403;
|
||||
|
||||
const ID_DELETE = 501;
|
||||
const ID_MD = 502;
|
||||
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS( MyFrame, wxFrame )
|
||||
|
||||
BEGIN_EVENT_TABLE(MyFrame,wxFrame)
|
||||
EVT_SIZE (MyFrame::OnSize)
|
||||
EVT_MENU (ID_ABOUT, MyFrame::OnAbout)
|
||||
EVT_TOOL (ID_ABOUT, MyFrame::OnAbout)
|
||||
EVT_MENU (ID_QUIT, MyFrame::OnCommand)
|
||||
EVT_TOOL (ID_QUIT, MyFrame::OnCommand)
|
||||
EVT_MENU (ID_HOME, MyFrame::OnCommand)
|
||||
EVT_TOOL (ID_HOME, MyFrame::OnCommand)
|
||||
EVT_MENU (ID_PARENT, MyFrame::OnCommand)
|
||||
EVT_TOOL (ID_PARENT, MyFrame::OnCommand)
|
||||
EVT_MENU (ID_LIST, MyFrame::OnView)
|
||||
EVT_MENU (ID_REPORT, MyFrame::OnView)
|
||||
EVT_MENU (ID_ICON, MyFrame::OnView)
|
||||
EVT_TOOL (ID_LIST, MyFrame::OnView)
|
||||
EVT_TOOL (ID_REPORT, MyFrame::OnView)
|
||||
EVT_TOOL (ID_ICON, MyFrame::OnView)
|
||||
EVT_TOOL (ID_TREE, MyFrame::OnView)
|
||||
EVT_TOOL (ID_SINGLE, MyFrame::OnView)
|
||||
EVT_TOOL (ID_COMMANDER, MyFrame::OnView)
|
||||
EVT_LIST_KEY_DOWN (ID_FILECTRL, MyFrame::OnListKeyDown)
|
||||
EVT_LIST_DELETE_ITEM (ID_FILECTRL, MyFrame::OnListDeleteItem)
|
||||
EVT_LIST_END_LABEL_EDIT (ID_FILECTRL, MyFrame::OnListEndLabelEdit)
|
||||
EVT_LIST_BEGIN_DRAG (ID_FILECTRL, MyFrame::OnListDrag)
|
||||
EVT_TREE_KEY_DOWN (ID_DIRCTRL, MyFrame::OnTreeKeyDown)
|
||||
EVT_TREE_SEL_CHANGED (ID_DIRCTRL, MyFrame::OnTreeSelected)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
MyFrame::MyFrame(void) :
|
||||
wxFrame( NULL, -1, "wxFile", wxPoint(20,20), wxSize(470,360) )
|
||||
{
|
||||
wxMenu *file_menu = new wxMenu( "Menu 1" );
|
||||
file_menu->Append( ID_ABOUT, "About..");
|
||||
file_menu->Append( ID_QUIT, "Exit");
|
||||
|
||||
wxMenu *view_menu = new wxMenu( "Menu 2" );
|
||||
view_menu->Append( ID_LIST, "List mode");
|
||||
view_menu->Append( ID_REPORT, "Report mode");
|
||||
view_menu->Append( ID_ICON, "Icon mode");
|
||||
|
||||
wxMenuBar *menu_bar = new wxMenuBar();
|
||||
menu_bar->Append(file_menu, "File" );
|
||||
menu_bar->Append(view_menu, "View" );
|
||||
menu_bar->Show( TRUE );
|
||||
|
||||
SetMenuBar( menu_bar );
|
||||
|
||||
CreateStatusBar( 2 );
|
||||
|
||||
SetStatusText( "Welcome", 0 );
|
||||
SetStatusText( "wxFile v0.2 by Robert Roebling.", 1 );
|
||||
|
||||
m_tb = new wxToolBarGTK( this, ID_TOOLBAR, wxPoint(2,60), wxSize(300-4,26) );
|
||||
m_tb->SetMargins( 2, 2 );
|
||||
|
||||
wxBitmap *bm;
|
||||
m_tb->AddSeparator();
|
||||
|
||||
bm = new wxBitmap( exit_xpm );
|
||||
m_tb->AddTool( ID_QUIT, *bm, wxNullBitmap, FALSE, -1, -1, NULL, "Exit wxFile" );
|
||||
m_tb->AddSeparator();
|
||||
|
||||
bm = new wxBitmap( prev_xpm );
|
||||
m_tb->AddTool( ID_PARENT, *bm, wxNullBitmap, FALSE, -1, -1, NULL, "Go to parent directory" );
|
||||
bm = new wxBitmap( home_xpm );
|
||||
m_tb->AddTool( ID_HOME, *bm, wxNullBitmap, FALSE, -1, -1, NULL, "Go to home directory" );
|
||||
m_tb->AddSeparator();
|
||||
|
||||
bm = new wxBitmap( delete_xpm );
|
||||
m_tb->AddTool( ID_DELETE, *bm, wxNullBitmap, FALSE, -1, -1, NULL, "Delete file" );
|
||||
m_tb->AddSeparator();
|
||||
|
||||
bm = new wxBitmap( fileopen_xpm );
|
||||
m_tb->AddTool( ID_MD, *bm, wxNullBitmap, FALSE, -1, -1, NULL, "Create directory" );
|
||||
m_tb->AddSeparator();
|
||||
|
||||
bm = new wxBitmap( listview_xpm );
|
||||
m_tb->AddTool( ID_LIST, *bm, wxNullBitmap, FALSE, -1, -1, NULL, "List view" );
|
||||
bm = new wxBitmap( reportview_xpm );
|
||||
m_tb->AddTool( ID_REPORT, *bm, wxNullBitmap, FALSE, -1, -1, NULL, "Report view" );
|
||||
bm = new wxBitmap( iconview_xpm );
|
||||
m_tb->AddTool( ID_ICON, *bm, wxNullBitmap, FALSE, -1, -1, NULL, "Icon view" );
|
||||
m_tb->AddSeparator();
|
||||
|
||||
bm = new wxBitmap( treeview_xpm );
|
||||
m_tb->AddTool( ID_TREE, *bm, wxNullBitmap, FALSE, -1, -1, NULL, "Tree view" );
|
||||
bm = new wxBitmap( commanderview_xpm );
|
||||
m_tb->AddTool( ID_COMMANDER, *bm, wxNullBitmap, FALSE, -1, -1, NULL, "Commander view" );
|
||||
bm = new wxBitmap( singleview_xpm );
|
||||
m_tb->AddTool( ID_SINGLE, *bm, wxNullBitmap, FALSE, -1, -1, NULL, "Single view" );
|
||||
m_tb->AddSeparator();
|
||||
|
||||
bm = new wxBitmap( search_xpm );
|
||||
m_tb->AddTool( ID_MOUNT, *bm, wxNullBitmap, FALSE, -1, -1, NULL, "Mount devices" );
|
||||
m_tb->AddSeparator();
|
||||
|
||||
bm = new wxBitmap( save_xpm );
|
||||
m_tb->AddTool( ID_SEARCH, *bm, wxNullBitmap, FALSE, -1, -1, NULL, "Find file(s)" );
|
||||
m_tb->AddSeparator();
|
||||
|
||||
bm = new wxBitmap( help_xpm );
|
||||
m_tb->AddTool( ID_ABOUT, *bm, wxNullBitmap, FALSE, -1, -1, NULL, "About wxFile" );
|
||||
|
||||
m_tb->Layout();
|
||||
|
||||
m_splitter = new wxSplitterWindow( this, -1, wxPoint(0,0), wxSize(400,300), wxSP_3D );
|
||||
|
||||
m_leftFile = NULL;
|
||||
m_dir = new wxDirCtrl( m_splitter, ID_DIRCTRL, "/", wxPoint(10,45), wxSize(200,330) );
|
||||
|
||||
wxString homepath( "/home" );
|
||||
char buf[300];
|
||||
wxGetHomeDir( buf );
|
||||
homepath = buf;
|
||||
m_rightFile = new wxFileCtrl( m_splitter, ID_FILECTRL, homepath, wxPoint(220,5), wxSize(200,330) );
|
||||
|
||||
m_leftFile = new wxFileCtrl( m_splitter, ID_FILECTRL, homepath, wxPoint(0,5), wxSize(200,330) );
|
||||
m_leftFile->Show( FALSE );
|
||||
|
||||
m_leftFile->m_lastFocus = m_rightFile;
|
||||
|
||||
int x = 0;
|
||||
GetClientSize( &x, NULL );
|
||||
|
||||
m_splitter->SplitVertically( m_dir, m_rightFile, x / 3 );
|
||||
m_splitter->SetMinimumPaneSize( 10 );
|
||||
};
|
||||
|
||||
void MyFrame::OnSize( wxSizeEvent &WXUNUSED(event) )
|
||||
{
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
GetClientSize( &x, &y );
|
||||
|
||||
m_tb->SetSize( 1, 0, x-2, 30 );
|
||||
m_splitter->SetSize( 0, 31, x, y-31 );
|
||||
};
|
||||
|
||||
void MyFrame::OnView( wxCommandEvent &event )
|
||||
{
|
||||
int x = 0;
|
||||
GetClientSize( &x, NULL );
|
||||
switch (event.GetId())
|
||||
{
|
||||
case ID_LIST:
|
||||
m_rightFile->ChangeToListMode();
|
||||
if (m_splitter->IsSplit() && (m_splitter->GetWindow1() == m_leftFile))
|
||||
m_leftFile->ChangeToListMode();
|
||||
break;
|
||||
case ID_REPORT:
|
||||
m_rightFile->ChangeToReportMode();
|
||||
if (m_splitter->IsSplit() && (m_splitter->GetWindow1() == m_leftFile))
|
||||
m_leftFile->ChangeToReportMode();
|
||||
break;
|
||||
case ID_ICON:
|
||||
m_rightFile->ChangeToIconMode();
|
||||
if (m_splitter->IsSplit() && (m_splitter->GetWindow1() == m_leftFile))
|
||||
m_leftFile->ChangeToIconMode();
|
||||
break;
|
||||
case ID_TREE:
|
||||
if (m_splitter->IsSplit())
|
||||
{
|
||||
if (m_splitter->GetWindow1() != m_dir)
|
||||
{
|
||||
m_splitter->Unsplit( m_leftFile );
|
||||
m_dir->Show(TRUE);
|
||||
m_splitter->SplitVertically( m_dir, m_rightFile, x/3 );
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
m_dir->Show(TRUE);
|
||||
m_splitter->SplitVertically( m_dir, m_rightFile, x/3 );
|
||||
};
|
||||
break;
|
||||
case ID_SINGLE:
|
||||
if (m_splitter->IsSplit()) m_splitter->Unsplit( m_splitter->GetWindow1() );
|
||||
break;
|
||||
case ID_COMMANDER:
|
||||
if (m_splitter->IsSplit())
|
||||
{
|
||||
if (m_splitter->GetWindow1() != m_leftFile)
|
||||
{
|
||||
m_splitter->Unsplit( m_dir );
|
||||
m_leftFile->ChangeToListMode();
|
||||
m_rightFile->ChangeToListMode();
|
||||
m_leftFile->Show(TRUE);
|
||||
m_splitter->SplitVertically( m_leftFile, m_rightFile, x/2 );
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
m_leftFile->ChangeToListMode();
|
||||
m_rightFile->ChangeToListMode();
|
||||
m_leftFile->Show(TRUE);
|
||||
m_splitter->SplitVertically( m_leftFile, m_rightFile, x/2 );
|
||||
};
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
};
|
||||
|
||||
void MyFrame::OnCommand( wxCommandEvent &event )
|
||||
{
|
||||
switch (event.GetId())
|
||||
{
|
||||
case ID_QUIT:
|
||||
Close( TRUE );
|
||||
break;
|
||||
case ID_HOME:
|
||||
m_leftFile->m_lastFocus->GoToHomeDir();
|
||||
break;
|
||||
case ID_PARENT:
|
||||
m_leftFile->m_lastFocus->GoToParentDir();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
};
|
||||
|
||||
void MyFrame::OnAbout( wxCommandEvent &WXUNUSED(event) )
|
||||
{
|
||||
wxDialog dialog( this, -1, "About wxFile", wxPoint(100,100), wxSize(540,350), wxDIALOG_MODAL );
|
||||
|
||||
int w = 0;
|
||||
int h = 0;
|
||||
dialog.GetSize( &w, &h );
|
||||
|
||||
int x = 30;
|
||||
int y = 20;
|
||||
int step = 20;
|
||||
|
||||
(void)new wxStaticBox( &dialog, -1, (const char*)NULL, wxPoint(10,10), wxSize(w-20,h-80) );
|
||||
|
||||
(void)new wxStaticText( &dialog, -1, "wxFile v0.1", wxPoint(240,y) );
|
||||
y += 2*step-10;
|
||||
|
||||
(void)new wxStaticText( &dialog, -1, "Written by Robert Roebling, 1998.", wxPoint(x,y) );
|
||||
y += 2*step;
|
||||
|
||||
(void)new wxStaticText( &dialog, -1,
|
||||
"wxFile uses wxGTK, the GTK port of the wxWindows GUI-library.", wxPoint(x,y) );
|
||||
y += step;
|
||||
(void)new wxStaticText( &dialog, -1, "http://www.freiburg.linux.de/~wxxt", wxPoint(x+50,y) );
|
||||
y += step;
|
||||
(void)new wxStaticText( &dialog, -1, "http://web.ukonline.co.uk/julian.smart/wxwin", wxPoint(x+50,y) );
|
||||
y += 2*step;
|
||||
|
||||
(void)new wxStaticText( &dialog, -1, "wxFile Copyright: GPL.", wxPoint(x,y) );
|
||||
y += 2*step;
|
||||
(void)new wxStaticText( &dialog, -1, "For questions concerning wxGTK, you may mail to:", wxPoint(x,y) );
|
||||
y += step;
|
||||
(void)new wxStaticText( &dialog, -1, "roebling@ruf.uni-freiburg.de", wxPoint(x+50,y) );
|
||||
|
||||
(void) new wxButton( &dialog, wxID_OK, "Return", wxPoint(w/2-40,h-50), wxSize(80,30) );
|
||||
|
||||
dialog.ShowModal();
|
||||
};
|
||||
|
||||
void MyFrame::OnListKeyDown( wxListEvent &event )
|
||||
{
|
||||
m_rightFile->m_lastFocus->OnListKeyDown( event );
|
||||
};
|
||||
|
||||
void MyFrame::OnListDeleteItem( wxListEvent &event )
|
||||
{
|
||||
m_rightFile->m_lastFocus->OnListDeleteItem( event );
|
||||
};
|
||||
|
||||
void MyFrame::OnListEndLabelEdit( wxListEvent &event )
|
||||
{
|
||||
m_rightFile->m_lastFocus->OnListEndLabelEdit( event );
|
||||
};
|
||||
|
||||
void MyFrame::OnListDrag( wxListEvent &event )
|
||||
{
|
||||
printf( "OnDrag.\n" );
|
||||
return;
|
||||
};
|
||||
|
||||
void MyFrame::OnTreeSelected( wxTreeEvent &event )
|
||||
{
|
||||
wxDirInfo *info = (wxDirInfo*) event.m_item.m_data;
|
||||
SetStatusText( info->GetPath() );
|
||||
};
|
||||
|
||||
void MyFrame::OnTreeKeyDown( wxTreeEvent &event )
|
||||
{
|
||||
wxDirInfo *info = (wxDirInfo*) event.m_item.m_data;
|
||||
m_rightFile->GoToDir( info->GetPath() );
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// MyApp
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
MyApp::MyApp(void) :
|
||||
wxApp( )
|
||||
{
|
||||
};
|
||||
|
||||
bool MyApp::OnInit(void)
|
||||
{
|
||||
wxFrame *frame = new MyFrame();
|
||||
frame->Show( TRUE );
|
||||
|
||||
return TRUE;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
87
user/wxFile/wxFile.h
Normal file
87
user/wxFile/wxFile.h
Normal file
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* Program: wxFile
|
||||
*
|
||||
* Author: Robert Roebling
|
||||
*
|
||||
* Copyright: (C) 1997, GNU (Robert Roebling)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __WXFILEH__
|
||||
#define __WXFILEH__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include "wx/wx.h"
|
||||
#include "wx/dcscreen.h"
|
||||
#include "wx/splitter.h"
|
||||
#include "wx/toolbar.h"
|
||||
#include "filectrl.h"
|
||||
#include "dirctrl.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// derived classes
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class MyFrame;
|
||||
class MyApp;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// MyFrame
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class MyFrame: public wxFrame
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(MyFrame)
|
||||
|
||||
public:
|
||||
|
||||
MyFrame(void);
|
||||
void OnSize( wxSizeEvent &event );
|
||||
void OnCommand( wxCommandEvent &event );
|
||||
void OnAbout( wxCommandEvent &event );
|
||||
void OnView( wxCommandEvent &event );
|
||||
void OnListKeyDown( wxListEvent &event );
|
||||
void OnListDeleteItem( wxListEvent &event );
|
||||
void OnListEndLabelEdit( wxListEvent &event );
|
||||
void OnListDrag( wxListEvent &event );
|
||||
void OnTreeSelected( wxTreeEvent &event );
|
||||
void OnTreeKeyDown( wxTreeEvent &event );
|
||||
|
||||
wxToolBarGTK *m_tb;
|
||||
wxSplitterWindow *m_splitter;
|
||||
wxFileCtrl *m_rightFile;
|
||||
wxFileCtrl *m_leftFile;
|
||||
wxDirCtrl *m_dir;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// MyApp
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class MyApp: public wxApp
|
||||
{
|
||||
public:
|
||||
|
||||
MyApp(void);
|
||||
virtual bool OnInit(void);
|
||||
};
|
||||
|
||||
#endif // __WXFILEH__
|
Reference in New Issue
Block a user