Whole lot of stuff for new wxFileDialog
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3410 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -21,8 +21,6 @@
|
|||||||
#include "wx/dialog.h"
|
#include "wx/dialog.h"
|
||||||
#include "wx/checkbox.h"
|
#include "wx/checkbox.h"
|
||||||
#include "wx/listctrl.h"
|
#include "wx/listctrl.h"
|
||||||
#include "wx/button.h"
|
|
||||||
#include "wx/validate.h"
|
|
||||||
#include "wx/textctrl.h"
|
#include "wx/textctrl.h"
|
||||||
#include "wx/choice.h"
|
#include "wx/choice.h"
|
||||||
|
|
||||||
@@ -72,9 +70,8 @@ public:
|
|||||||
bool IsLink();
|
bool IsLink();
|
||||||
bool IsExe();
|
bool IsExe();
|
||||||
long GetSize();
|
long GetSize();
|
||||||
bool NewNameIsLegal( const wxString &s );
|
|
||||||
bool Rename( const wxString &s );
|
|
||||||
void MakeItem( wxListItem &item );
|
void MakeItem( wxListItem &item );
|
||||||
|
void SetNewName( const wxString &name, const wxString &fname );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_DYNAMIC_CLASS(wxFileData);
|
DECLARE_DYNAMIC_CLASS(wxFileData);
|
||||||
@@ -89,10 +86,12 @@ class wxFileCtrl : public wxListCtrl
|
|||||||
private:
|
private:
|
||||||
wxString m_dirName;
|
wxString m_dirName;
|
||||||
bool m_showHidden;
|
bool m_showHidden;
|
||||||
|
wxString m_wild;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxFileCtrl();
|
wxFileCtrl();
|
||||||
wxFileCtrl( wxWindow *win, const wxWindowID id, const wxString &dirName,
|
wxFileCtrl( wxWindow *win, const wxWindowID id,
|
||||||
|
const wxString &dirName, const wxString &wild,
|
||||||
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
|
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
|
||||||
const long style = wxLC_LIST, const wxValidator &validator = wxDefaultValidator,
|
const long style = wxLC_LIST, const wxValidator &validator = wxDefaultValidator,
|
||||||
const wxString &name = _T("filelist") );
|
const wxString &name = _T("filelist") );
|
||||||
@@ -100,20 +99,16 @@ public:
|
|||||||
void ChangeToReportMode();
|
void ChangeToReportMode();
|
||||||
void ChangeToIconMode();
|
void ChangeToIconMode();
|
||||||
void ShowHidden( bool show = TRUE );
|
void ShowHidden( bool show = TRUE );
|
||||||
|
long Add( wxFileData *fd, wxListItem &item );
|
||||||
void Update();
|
void Update();
|
||||||
virtual void StatusbarText( char *WXUNUSED(text) ) {};
|
virtual void StatusbarText( char *WXUNUSED(text) ) {};
|
||||||
int FillList( wxStringList &list );
|
|
||||||
void DeleteFiles();
|
|
||||||
void CopyFiles( char *dest );
|
|
||||||
void MoveFiles( char *dest );
|
|
||||||
void RenameFile();
|
|
||||||
void MakeDir();
|
void MakeDir();
|
||||||
void GoToParentDir();
|
void GoToParentDir();
|
||||||
void GoToHomeDir();
|
void GoToHomeDir();
|
||||||
void GoToDir( const wxString &dir );
|
void GoToDir( const wxString &dir );
|
||||||
|
void SetWild( const wxString &wild );
|
||||||
void GetDir( wxString &dir );
|
void GetDir( wxString &dir );
|
||||||
void OnListDeleteItem( wxListEvent &event );
|
void OnListDeleteItem( wxListEvent &event );
|
||||||
void OnListKeyDown( wxListEvent &event );
|
|
||||||
void OnListEndLabelEdit( wxListEvent &event );
|
void OnListEndLabelEdit( wxListEvent &event );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -158,10 +153,10 @@ public:
|
|||||||
void OnActivated( wxListEvent &event );
|
void OnActivated( wxListEvent &event );
|
||||||
void OnList( wxCommandEvent &event );
|
void OnList( wxCommandEvent &event );
|
||||||
void OnReport( wxCommandEvent &event );
|
void OnReport( wxCommandEvent &event );
|
||||||
void OnIcon( wxCommandEvent &event );
|
|
||||||
void OnUp( wxCommandEvent &event );
|
void OnUp( wxCommandEvent &event );
|
||||||
void OnHome( wxCommandEvent &event );
|
void OnHome( wxCommandEvent &event );
|
||||||
void OnListOk( wxCommandEvent &event );
|
void OnListOk( wxCommandEvent &event );
|
||||||
|
void OnNew( wxCommandEvent &event );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
wxString m_message;
|
wxString m_message;
|
||||||
|
@@ -1,99 +0,0 @@
|
|||||||
/* 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... "};
|
|
@@ -1,48 +0,0 @@
|
|||||||
/* 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 "};
|
|
28
include/wx/generic/home.xpm
Normal file
28
include/wx/generic/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 . ",
|
||||||
|
" ..... ...... ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" "};
|
@@ -1,45 +0,0 @@
|
|||||||
/* 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
include/wx/generic/listview.xpm
Normal file
30
include/wx/generic/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. ",
|
||||||
|
" ................. ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" "};
|
||||||
|
|
||||||
|
|
31
include/wx/generic/repview.xpm
Normal file
31
include/wx/generic/repview.xpm
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
/* XPM */
|
||||||
|
static char * repview_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. ",
|
||||||
|
" ................. ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" "};
|
||||||
|
|
||||||
|
|
||||||
|
|
@@ -1,53 +0,0 @@
|
|||||||
/* 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:+*+;+ ",
|
|
||||||
" +;-+;+ ",
|
|
||||||
" +;+ "};
|
|
@@ -38,6 +38,21 @@ public:
|
|||||||
wxPoint m_pointDrag;
|
wxPoint m_pointDrag;
|
||||||
|
|
||||||
wxListItem m_item;
|
wxListItem m_item;
|
||||||
|
|
||||||
|
inline int GetCode() { return m_code; }
|
||||||
|
inline long GetIndex() { return m_itemIndex; }
|
||||||
|
inline long GetOldIndex() { return m_oldItemIndex; }
|
||||||
|
inline long GetItem() { return m_itemIndex; }
|
||||||
|
inline long GetOldItem() { return m_oldItemIndex; }
|
||||||
|
inline int GetColumn() { return m_col; }
|
||||||
|
inline bool Cancelled() { return m_cancelled; }
|
||||||
|
inline wxPoint GetPoint() { return m_pointDrag; }
|
||||||
|
inline const wxString &GetLabel() const { return m_item.m_text; }
|
||||||
|
inline const wxString &GetText() const { return m_item.m_text; }
|
||||||
|
inline int GetImage() { return m_item.m_image; }
|
||||||
|
inline long GetData() { return m_item.m_data; }
|
||||||
|
inline long GetMask() { return m_item.m_mask; }
|
||||||
|
inline const wxListItem &GetItem() const { return m_item; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_DYNAMIC_CLASS(wxListEvent)
|
DECLARE_DYNAMIC_CLASS(wxListEvent)
|
||||||
|
@@ -25,12 +25,12 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/filedlg.h"
|
#include "wx/filedlg.h"
|
||||||
#include "wx/dnd.h"
|
|
||||||
#include "wx/debug.h"
|
#include "wx/debug.h"
|
||||||
#include "wx/log.h"
|
#include "wx/log.h"
|
||||||
#include "wx/intl.h"
|
#include "wx/intl.h"
|
||||||
#include "wx/msgdlg.h"
|
#include "wx/msgdlg.h"
|
||||||
#include "wx/sizer.h"
|
#include "wx/sizer.h"
|
||||||
|
#include "wx/bmpbuttn.h"
|
||||||
|
|
||||||
#include "sys/types.h"
|
#include "sys/types.h"
|
||||||
#include "sys/stat.h"
|
#include "sys/stat.h"
|
||||||
@@ -39,10 +39,38 @@
|
|||||||
#include "grp.h"
|
#include "grp.h"
|
||||||
#include "time.h"
|
#include "time.h"
|
||||||
|
|
||||||
#include "wx/generic/folder.xpm"
|
#include "wx/generic/home.xpm"
|
||||||
#include "wx/generic/txt.xpm"
|
#include "wx/generic/listview.xpm"
|
||||||
#include "wx/generic/list.xpm"
|
#include "wx/generic/repview.xpm"
|
||||||
#include "wx/generic/find.xpm"
|
|
||||||
|
/* XPM */
|
||||||
|
static char * folder_xpm[] = {
|
||||||
|
/* width height ncolors chars_per_pixel */
|
||||||
|
"16 16 6 1",
|
||||||
|
/* colors */
|
||||||
|
" s None c None",
|
||||||
|
". c #000000",
|
||||||
|
"+ c #c0c0c0",
|
||||||
|
"@ c #808080",
|
||||||
|
"# c #ffff00",
|
||||||
|
"$ c #ffffff",
|
||||||
|
/* pixels */
|
||||||
|
" ",
|
||||||
|
" @@@@@ ",
|
||||||
|
" @#+#+#@ ",
|
||||||
|
" @#+#+#+#@@@@@@ ",
|
||||||
|
" @$$$$$$$$$$$$@.",
|
||||||
|
" @$#+#+#+#+#+#@.",
|
||||||
|
" @$+#+#+#+#+#+@.",
|
||||||
|
" @$#+#+#+#+#+#@.",
|
||||||
|
" @$+#+#+#+#+#+@.",
|
||||||
|
" @$#+#+#+#+#+#@.",
|
||||||
|
" @$+#+#+#+#+#+@.",
|
||||||
|
" @$#+#+#+#+#+#@.",
|
||||||
|
" @@@@@@@@@@@@@@.",
|
||||||
|
" ..............",
|
||||||
|
" ",
|
||||||
|
" "};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxFileData
|
// wxFileData
|
||||||
@@ -54,7 +82,7 @@ wxFileData::wxFileData( const wxString &name, const wxString &fname )
|
|||||||
{
|
{
|
||||||
m_name = name;
|
m_name = name;
|
||||||
m_fileName = fname;
|
m_fileName = fname;
|
||||||
|
|
||||||
struct stat buff;
|
struct stat buff;
|
||||||
stat( m_fileName.GetData(), &buff );
|
stat( m_fileName.GetData(), &buff );
|
||||||
struct stat lbuff;
|
struct stat lbuff;
|
||||||
@@ -177,26 +205,10 @@ long wxFileData::GetSize()
|
|||||||
return m_size;
|
return m_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxFileData::NewNameIsLegal( const wxString &s )
|
void wxFileData::SetNewName( const wxString &name, const wxString &fname )
|
||||||
{
|
{
|
||||||
wxString fileName = wxPathOnly( m_fileName );
|
m_name = name;
|
||||||
fileName += _T("/");
|
m_fileName = fname;
|
||||||
fileName += s;
|
|
||||||
return (!wxFileExists( fileName ));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxFileData::Rename( const wxString &s )
|
|
||||||
{
|
|
||||||
wxString fileName = wxPathOnly( m_fileName );
|
|
||||||
fileName += _T("/");
|
|
||||||
fileName += s;
|
|
||||||
bool ret = wxRenameFile( m_fileName, fileName );
|
|
||||||
if (ret)
|
|
||||||
{
|
|
||||||
m_fileName = fileName;
|
|
||||||
m_name = s;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileData::MakeItem( wxListItem &item )
|
void wxFileData::MakeItem( wxListItem &item )
|
||||||
@@ -205,6 +217,7 @@ void wxFileData::MakeItem( wxListItem &item )
|
|||||||
item.m_colour = wxBLACK;
|
item.m_colour = wxBLACK;
|
||||||
if (IsExe()) item.m_colour = wxRED;
|
if (IsExe()) item.m_colour = wxRED;
|
||||||
if (IsDir()) item.m_colour = wxBLUE;
|
if (IsDir()) item.m_colour = wxBLUE;
|
||||||
|
if (IsDir()) item.m_image = 0; else item.m_image = -1;
|
||||||
if (IsLink())
|
if (IsLink())
|
||||||
{
|
{
|
||||||
wxColour *dg = wxTheColourDatabase->FindColour( "MEDIUM GREY" );
|
wxColour *dg = wxTheColourDatabase->FindColour( "MEDIUM GREY" );
|
||||||
@@ -220,6 +233,8 @@ void wxFileData::MakeItem( wxListItem &item )
|
|||||||
IMPLEMENT_DYNAMIC_CLASS(wxFileCtrl,wxListCtrl);
|
IMPLEMENT_DYNAMIC_CLASS(wxFileCtrl,wxListCtrl);
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxFileCtrl,wxListCtrl)
|
BEGIN_EVENT_TABLE(wxFileCtrl,wxListCtrl)
|
||||||
|
EVT_LIST_DELETE_ITEM(-1, wxFileCtrl::OnListDeleteItem)
|
||||||
|
EVT_LIST_END_LABEL_EDIT(-1, wxFileCtrl::OnListEndLabelEdit)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
wxFileCtrl::wxFileCtrl()
|
wxFileCtrl::wxFileCtrl()
|
||||||
@@ -228,25 +243,20 @@ wxFileCtrl::wxFileCtrl()
|
|||||||
m_showHidden = FALSE;
|
m_showHidden = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxFileCtrl::wxFileCtrl( wxWindow *win, wxWindowID id, const wxString &dirName,
|
wxFileCtrl::wxFileCtrl( wxWindow *win, wxWindowID id,
|
||||||
|
const wxString &dirName, const wxString &wild,
|
||||||
const wxPoint &pos, const wxSize &size,
|
const wxPoint &pos, const wxSize &size,
|
||||||
long style, const wxValidator &validator, const wxString &name ) :
|
long style, const wxValidator &validator, const wxString &name ) :
|
||||||
wxListCtrl( win, id, pos, size, style, validator, name )
|
wxListCtrl( win, id, pos, size, style, validator, name )
|
||||||
{
|
{
|
||||||
SetItemSpacing( 40 );
|
wxImageList *imageList = new wxImageList( 16, 16 );
|
||||||
wxImageList *imageList = new wxImageList( 30, 30 );
|
|
||||||
imageList->Add( wxBitmap( folder_xpm ) );
|
imageList->Add( wxBitmap( folder_xpm ) );
|
||||||
imageList->Add( wxBitmap( txt_xpm ) );
|
SetImageList( imageList, wxIMAGE_LIST_SMALL );
|
||||||
imageList->Add( wxBitmap( list_xpm ) );
|
|
||||||
imageList->Add( wxBitmap( find_xpm ) );
|
|
||||||
|
|
||||||
SetImageList( imageList, wxIMAGE_LIST_NORMAL );
|
|
||||||
|
|
||||||
m_dirName = dirName;
|
m_dirName = dirName;
|
||||||
|
m_wild = wild;
|
||||||
m_showHidden = FALSE;
|
m_showHidden = FALSE;
|
||||||
Update();
|
Update();
|
||||||
|
|
||||||
// SetDropTarget( new wxFileDropTarget() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileCtrl::ChangeToListMode()
|
void wxFileCtrl::ChangeToListMode()
|
||||||
@@ -277,11 +287,31 @@ int ListCompare( const long data1, const long data2, const long WXUNUSED(data) )
|
|||||||
{
|
{
|
||||||
wxFileData *fd1 = (wxFileData*)data1 ;
|
wxFileData *fd1 = (wxFileData*)data1 ;
|
||||||
wxFileData *fd2 = (wxFileData*)data2 ;
|
wxFileData *fd2 = (wxFileData*)data2 ;
|
||||||
|
if (fd1->GetName() == _T("..")) return -1;
|
||||||
|
if (fd2->GetName() == _T("..")) return 1;
|
||||||
if (fd1->IsDir() && !fd2->IsDir()) return -1;
|
if (fd1->IsDir() && !fd2->IsDir()) return -1;
|
||||||
if (fd2->IsDir() && !fd1->IsDir()) return 1;
|
if (fd2->IsDir() && !fd1->IsDir()) return 1;
|
||||||
return strcmp( fd1->GetName(), fd2->GetName() );
|
return strcmp( fd1->GetName(), fd2->GetName() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long wxFileCtrl::Add( wxFileData *fd, wxListItem &item )
|
||||||
|
{
|
||||||
|
long ret = -1;
|
||||||
|
item.m_mask = wxLIST_MASK_TEXT + wxLIST_MASK_DATA + wxLIST_MASK_IMAGE;
|
||||||
|
fd->MakeItem( item );
|
||||||
|
long my_style = GetWindowStyleFlag();
|
||||||
|
if (my_style & wxLC_REPORT)
|
||||||
|
{
|
||||||
|
ret = InsertItem( item );
|
||||||
|
for (int i = 1; i < 5; i++) SetItem( item.m_itemId, i, fd->GetEntry( i) );
|
||||||
|
}
|
||||||
|
else if (my_style & wxLC_LIST)
|
||||||
|
{
|
||||||
|
ret = InsertItem( item );
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
void wxFileCtrl::Update()
|
void wxFileCtrl::Update()
|
||||||
{
|
{
|
||||||
ClearAll();
|
ClearAll();
|
||||||
@@ -296,35 +326,28 @@ void wxFileCtrl::Update()
|
|||||||
}
|
}
|
||||||
wxFileData *fd = (wxFileData *) NULL;
|
wxFileData *fd = (wxFileData *) NULL;
|
||||||
wxListItem item;
|
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_itemId = 0;
|
||||||
item.m_col = 0;
|
item.m_col = 0;
|
||||||
wxString s;
|
|
||||||
wxString res = m_dirName + _T("/*");
|
if (m_dirName != _T("/"))
|
||||||
|
{
|
||||||
|
wxString p( wxPathOnly(m_dirName) );
|
||||||
|
if (p.IsEmpty()) p = _T("/");
|
||||||
|
fd = new wxFileData( _T(".."), p );
|
||||||
|
Add( fd, item );
|
||||||
|
item.m_itemId++;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxString res = m_dirName + _T("/") + m_wild;
|
||||||
wxString f( wxFindFirstFile( res.GetData(), 0 ) );
|
wxString f( wxFindFirstFile( res.GetData(), 0 ) );
|
||||||
while (!f.IsEmpty())
|
while (!f.IsEmpty())
|
||||||
{
|
{
|
||||||
res = wxFileNameFromPath( f );
|
res = wxFileNameFromPath( f );
|
||||||
fd = new wxFileData( res, f );
|
fd = new wxFileData( res, f );
|
||||||
s = fd->GetName();
|
wxString s = fd->GetName();
|
||||||
if (m_showHidden || (s[0] != '.'))
|
if (m_showHidden || (s[0] != _T('.')))
|
||||||
{
|
{
|
||||||
fd->MakeItem( item );
|
Add( fd, 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++;
|
item.m_itemId++;
|
||||||
}
|
}
|
||||||
f = wxFindNextFile();
|
f = wxFindNextFile();
|
||||||
@@ -332,112 +355,72 @@ void wxFileCtrl::Update()
|
|||||||
SortItems( ListCompare, 0 );
|
SortItems( ListCompare, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxFileCtrl::FillList( wxStringList &list )
|
void wxFileCtrl::SetWild( const wxString &wild )
|
||||||
{
|
|
||||||
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()
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
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()
|
|
||||||
{
|
{
|
||||||
|
m_wild = wild;
|
||||||
|
Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileCtrl::MakeDir()
|
void wxFileCtrl::MakeDir()
|
||||||
{
|
{
|
||||||
/*
|
wxString new_name( _T("NewName") );
|
||||||
wxString s = wxGetTextFromUser( "Enter new directory name:", "Make directory" );
|
wxString path( m_dirName );
|
||||||
if (s.IsNull()) return;
|
path += _T( "/" );
|
||||||
if (s == "") return;
|
path += new_name;
|
||||||
if ((s == ".") || (s == ".."))
|
if (wxFileExists(path))
|
||||||
{
|
{
|
||||||
wxMessageBox( "This was obviously an invalid directory name.", "Go away." );
|
// try NewName0, NewName1 etc.
|
||||||
return;
|
int i = 0;
|
||||||
};
|
do {
|
||||||
wxString dir;
|
new_name = _("NewName");
|
||||||
GetDir( dir );
|
wxString num;
|
||||||
dir += "/";
|
num.Printf( _T("%d"), i );
|
||||||
dir += s;
|
new_name += num;
|
||||||
if (wxFileExists( dir ))
|
|
||||||
{
|
path = m_dirName;
|
||||||
wxMessageBox( "Filename exists already. Cannot create directoy.", "Make directory" );
|
path += _T("/");
|
||||||
return;
|
path += new_name;
|
||||||
};
|
i++;
|
||||||
wxMkdir( dir );
|
} while (wxFileExists(path));
|
||||||
Update();
|
}
|
||||||
*/
|
|
||||||
|
wxLogNull log;
|
||||||
|
if (!wxMkdir(path))
|
||||||
|
{
|
||||||
|
wxMessageDialog dialog(this, _("Operation not permitted."), _("Error"), wxOK | wxICON_ERROR );
|
||||||
|
dialog.ShowModal();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxFileData *fd = new wxFileData( new_name, path );
|
||||||
|
wxListItem item;
|
||||||
|
item.m_itemId = 0;
|
||||||
|
item.m_col = 0;
|
||||||
|
int id = Add( fd, item );
|
||||||
|
|
||||||
|
if (id != -1)
|
||||||
|
{
|
||||||
|
SortItems( ListCompare, 0 );
|
||||||
|
id = FindItem( 0, (long)fd );
|
||||||
|
EnsureVisible( id );
|
||||||
|
EditLabel( id );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileCtrl::GoToParentDir()
|
void wxFileCtrl::GoToParentDir()
|
||||||
{
|
{
|
||||||
wxString s = m_dirName;
|
if (m_dirName != _T("/"))
|
||||||
int pos = s.Last( _T('/') );
|
|
||||||
if ((pos >= 0) && (s != _T("/")))
|
|
||||||
{
|
{
|
||||||
s.Remove( pos, s.Length()-pos );
|
wxString fname( wxFileNameFromPath(m_dirName) );
|
||||||
if (s.Length() == 0) s = _T("/");
|
m_dirName = wxPathOnly( m_dirName );
|
||||||
m_dirName = s;
|
if (m_dirName.IsEmpty()) m_dirName = _T("/");
|
||||||
Update();
|
Update();
|
||||||
|
int id = FindItem( 0, fname );
|
||||||
|
if (id != -1)
|
||||||
|
{
|
||||||
|
SetItemState( id, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
|
||||||
|
EnsureVisible( id );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -459,107 +442,74 @@ void wxFileCtrl::GetDir( wxString &dir )
|
|||||||
dir = m_dirName;
|
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 )
|
void wxFileCtrl::OnListDeleteItem( wxListEvent &event )
|
||||||
{
|
{
|
||||||
wxFileData *fd = (wxFileData*)event.m_item.m_data;
|
wxFileData *fd = (wxFileData*)event.m_item.m_data;
|
||||||
delete fd;
|
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 )
|
void wxFileCtrl::OnListEndLabelEdit( wxListEvent &event )
|
||||||
{
|
{
|
||||||
wxFileData *fd = (wxFileData*)event.m_item.m_data;
|
wxFileData *fd = (wxFileData*)event.m_item.m_data;
|
||||||
wxString newName = event.m_item.m_text;
|
wxASSERT( fd );
|
||||||
if (fd->NewNameIsLegal( newName ))
|
|
||||||
|
if ((event.GetLabel().IsEmpty()) ||
|
||||||
|
(event.GetLabel() == _(".")) ||
|
||||||
|
(event.GetLabel() == _("..")) ||
|
||||||
|
(event.GetLabel().First( _T("/") ) != wxNOT_FOUND))
|
||||||
{
|
{
|
||||||
if (fd->Rename( newName ))
|
wxMessageDialog dialog(this, _("Illegal directory name."), _("Error"), wxOK | wxICON_ERROR );
|
||||||
{
|
dialog.ShowModal();
|
||||||
Update();
|
event.Veto();
|
||||||
}
|
return;
|
||||||
else
|
}
|
||||||
{
|
|
||||||
wxString s = _("Could not rename file to ");
|
wxString new_name( wxPathOnly( fd->GetFullName() ) );
|
||||||
s += newName;
|
new_name += _T("/");
|
||||||
s += ".";
|
new_name += event.GetLabel();
|
||||||
wxMessageBox( s, _("File dialog"), wxOK );
|
|
||||||
}
|
wxLogNull log;
|
||||||
|
|
||||||
|
if (wxFileExists(new_name))
|
||||||
|
{
|
||||||
|
wxMessageDialog dialog(this, _("File name exists already."), _("Error"), wxOK | wxICON_ERROR );
|
||||||
|
dialog.ShowModal();
|
||||||
|
event.Veto();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (wxRenameFile(fd->GetFullName(),new_name))
|
||||||
|
{
|
||||||
|
fd->SetNewName( new_name, event.GetLabel() );
|
||||||
|
SetItemState( event.GetItem(), wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
|
||||||
|
EnsureVisible( event.GetItem() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxString s = "File name ";
|
wxMessageDialog dialog(this, _("Operation not permitted."), _("Error"), wxOK | wxICON_ERROR );
|
||||||
s += newName;
|
dialog.ShowModal();
|
||||||
s += " exists already or is invalid.\n";
|
event.Veto();
|
||||||
s += "Could not rename file.";
|
|
||||||
wxMessageBox( s, _("File dialog"), wxOK );
|
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxFileDialog
|
// wxFileDialog
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
/* **** */
|
|
||||||
|
|
||||||
#define ID_LIST_CTRL 5010
|
#define ID_LIST_CTRL 5010
|
||||||
#define ID_LIST_MODE 5000
|
#define ID_LIST_MODE 5000
|
||||||
#define ID_REPORT_MODE 5001
|
#define ID_REPORT_MODE 5001
|
||||||
#define ID_ICON_MODE 5002
|
|
||||||
#define ID_UP_DIR 5005
|
#define ID_UP_DIR 5005
|
||||||
#define ID_PARENT_DIR 5006
|
#define ID_PARENT_DIR 5006
|
||||||
|
#define ID_NEW_DIR 5007
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxFileDialog,wxDialog)
|
IMPLEMENT_DYNAMIC_CLASS(wxFileDialog,wxDialog)
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxFileDialog,wxDialog)
|
BEGIN_EVENT_TABLE(wxFileDialog,wxDialog)
|
||||||
EVT_BUTTON(ID_LIST_MODE, wxFileDialog::OnList)
|
EVT_BUTTON(ID_LIST_MODE, wxFileDialog::OnList)
|
||||||
EVT_BUTTON(ID_REPORT_MODE, wxFileDialog::OnReport)
|
EVT_BUTTON(ID_REPORT_MODE, wxFileDialog::OnReport)
|
||||||
EVT_BUTTON(ID_ICON_MODE, wxFileDialog::OnIcon)
|
|
||||||
EVT_BUTTON(ID_UP_DIR, wxFileDialog::OnUp)
|
EVT_BUTTON(ID_UP_DIR, wxFileDialog::OnUp)
|
||||||
EVT_BUTTON(ID_PARENT_DIR, wxFileDialog::OnHome)
|
EVT_BUTTON(ID_PARENT_DIR, wxFileDialog::OnHome)
|
||||||
|
EVT_BUTTON(ID_NEW_DIR, wxFileDialog::OnNew)
|
||||||
EVT_BUTTON(wxID_OK, wxFileDialog::OnListOk)
|
EVT_BUTTON(wxID_OK, wxFileDialog::OnListOk)
|
||||||
EVT_LIST_ITEM_SELECTED(ID_LIST_CTRL, wxFileDialog::OnSelected)
|
EVT_LIST_ITEM_SELECTED(ID_LIST_CTRL, wxFileDialog::OnSelected)
|
||||||
EVT_LIST_ITEM_ACTIVATED(ID_LIST_CTRL, wxFileDialog::OnActivated)
|
EVT_LIST_ITEM_ACTIVATED(ID_LIST_CTRL, wxFileDialog::OnActivated)
|
||||||
@@ -591,22 +541,21 @@ wxFileDialog::wxFileDialog(wxWindow *parent,
|
|||||||
|
|
||||||
wxBoxSizer *buttonsizer = new wxBoxSizer( wxHORIZONTAL );
|
wxBoxSizer *buttonsizer = new wxBoxSizer( wxHORIZONTAL );
|
||||||
|
|
||||||
buttonsizer->Add( new wxButton( this, ID_LIST_MODE, "List" ), 0, wxALL, 5 );
|
buttonsizer->Add( new wxBitmapButton( this, ID_LIST_MODE, wxBitmap( listview_xpm ) ), 0, wxALL, 5 );
|
||||||
buttonsizer->Add( new wxButton( this, ID_REPORT_MODE, "Report" ), 0, wxALL, 5 );
|
buttonsizer->Add( new wxBitmapButton( this, ID_REPORT_MODE, wxBitmap( repview_xpm ) ), 0, wxALL, 5 );
|
||||||
buttonsizer->Add( new wxButton( this, ID_ICON_MODE, "Icon" ), 0, wxALL, 5 );
|
buttonsizer->Add( 30, 5, 1 );
|
||||||
buttonsizer->Add( 30, 5 );
|
|
||||||
buttonsizer->Add( new wxButton( this, ID_UP_DIR, "Up" ), 0, wxALL, 5 );
|
buttonsizer->Add( new wxButton( this, ID_UP_DIR, "Up" ), 0, wxALL, 5 );
|
||||||
buttonsizer->Add( new wxButton( this, ID_PARENT_DIR, "Home" ), 0, wxALL, 5 );
|
buttonsizer->Add( new wxBitmapButton( this, ID_PARENT_DIR, wxBitmap(home_xpm) ), 0, wxALL, 5 );
|
||||||
buttonsizer->Add( new wxButton( this, -1, "New..." ), 0, wxALL, 5 );
|
buttonsizer->Add( new wxButton( this, ID_NEW_DIR, "New..." ), 0, wxALL, 5 );
|
||||||
mainsizer->Add( buttonsizer, 0, wxALL | wxALIGN_RIGHT, 5 );
|
mainsizer->Add( buttonsizer, 0, wxALL | wxEXPAND, 5 );
|
||||||
|
|
||||||
m_list = new wxFileCtrl( this, ID_LIST_CTRL, "/", wxDefaultPosition, wxSize(200,180),
|
m_list = new wxFileCtrl( this, ID_LIST_CTRL, m_dir, "*", wxDefaultPosition, wxSize(450,180),
|
||||||
wxLC_LIST | wxSUNKEN_BORDER | wxLC_SINGLE_SEL );
|
wxLC_LIST | wxSUNKEN_BORDER | wxLC_SINGLE_SEL );
|
||||||
mainsizer->Add( m_list, 1, wxEXPAND | wxALL, 10 );
|
mainsizer->Add( m_list, 1, wxEXPAND | wxLEFT|wxRIGHT, 10 );
|
||||||
|
|
||||||
wxBoxSizer *textsizer = new wxBoxSizer( wxHORIZONTAL );
|
wxBoxSizer *textsizer = new wxBoxSizer( wxHORIZONTAL );
|
||||||
m_text = new wxTextCtrl( this, -1, m_fileName );
|
m_text = new wxTextCtrl( this, -1, m_fileName );
|
||||||
textsizer->Add( m_text, 1, wxCENTER|wxALL, 10 );
|
textsizer->Add( m_text, 1, wxCENTER | wxLEFT|wxRIGHT|wxTOP, 10 );
|
||||||
textsizer->Add( new wxButton( this, wxID_OK, _("OK") ), 0, wxCENTER | wxLEFT|wxRIGHT|wxTOP, 10 );
|
textsizer->Add( new wxButton( this, wxID_OK, _("OK") ), 0, wxCENTER | wxLEFT|wxRIGHT|wxTOP, 10 );
|
||||||
mainsizer->Add( textsizer, 0, wxEXPAND );
|
mainsizer->Add( textsizer, 0, wxEXPAND );
|
||||||
|
|
||||||
@@ -625,6 +574,8 @@ wxFileDialog::wxFileDialog(wxWindow *parent,
|
|||||||
|
|
||||||
Centre( wxBOTH );
|
Centre( wxBOTH );
|
||||||
|
|
||||||
|
m_list->SetFocus();
|
||||||
|
|
||||||
wxEndBusyCursor();
|
wxEndBusyCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -647,7 +598,14 @@ void wxFileDialog::OnListOk( wxCommandEvent &event )
|
|||||||
m_list->GetDir( dir );
|
m_list->GetDir( dir );
|
||||||
if (filename.IsEmpty()) return;
|
if (filename.IsEmpty()) return;
|
||||||
|
|
||||||
dir += _T("/");
|
if (filename == _T(".."))
|
||||||
|
{
|
||||||
|
m_list->GoToParentDir();
|
||||||
|
m_list->SetFocus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dir != _T("/")) dir += _T("/");
|
||||||
dir += filename;
|
dir += filename;
|
||||||
filename = dir;
|
filename = dir;
|
||||||
|
|
||||||
@@ -687,26 +645,30 @@ void wxFileDialog::OnListOk( wxCommandEvent &event )
|
|||||||
void wxFileDialog::OnList( wxCommandEvent &WXUNUSED(event) )
|
void wxFileDialog::OnList( wxCommandEvent &WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
m_list->ChangeToListMode();
|
m_list->ChangeToListMode();
|
||||||
|
m_list->SetFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileDialog::OnReport( wxCommandEvent &WXUNUSED(event) )
|
void wxFileDialog::OnReport( wxCommandEvent &WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
m_list->ChangeToReportMode();
|
m_list->ChangeToReportMode();
|
||||||
}
|
m_list->SetFocus();
|
||||||
|
|
||||||
void wxFileDialog::OnIcon( wxCommandEvent &WXUNUSED(event) )
|
|
||||||
{
|
|
||||||
m_list->ChangeToIconMode();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileDialog::OnUp( wxCommandEvent &WXUNUSED(event) )
|
void wxFileDialog::OnUp( wxCommandEvent &WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
m_list->GoToParentDir();
|
m_list->GoToParentDir();
|
||||||
|
m_list->SetFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileDialog::OnHome( wxCommandEvent &WXUNUSED(event) )
|
void wxFileDialog::OnHome( wxCommandEvent &WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
m_list->GoToHomeDir();
|
m_list->GoToHomeDir();
|
||||||
|
m_list->SetFocus();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxFileDialog::OnNew( wxCommandEvent &WXUNUSED(event) )
|
||||||
|
{
|
||||||
|
m_list->MakeDir();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileDialog::SetPath( const wxString& path )
|
void wxFileDialog::SetPath( const wxString& path )
|
||||||
|
@@ -142,6 +142,7 @@ void wxListItemData::GetItem( wxListItem &info )
|
|||||||
info.m_text = m_text;
|
info.m_text = m_text;
|
||||||
info.m_image = m_image;
|
info.m_image = m_image;
|
||||||
info.m_data = m_data;
|
info.m_data = m_data;
|
||||||
|
info.m_colour = m_colour;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxColour *wxListItemData::GetColour()
|
wxColour *wxListItemData::GetColour()
|
||||||
@@ -301,6 +302,14 @@ void wxListLineData::CalculateSize( wxDC *dc, int spacing )
|
|||||||
dc->GetTextExtent( s, &lw, &lh );
|
dc->GetTextExtent( s, &lw, &lh );
|
||||||
m_bound_all.width = lw;
|
m_bound_all.width = lw;
|
||||||
m_bound_all.height = lh;
|
m_bound_all.height = lh;
|
||||||
|
if (item->HasImage())
|
||||||
|
{
|
||||||
|
int w = 0;
|
||||||
|
int h = 0;
|
||||||
|
m_owner->GetImageSize( item->GetImage(), w, h );
|
||||||
|
m_bound_all.width += 4 + w;
|
||||||
|
if (h > m_bound_all.height) m_bound_all.height = h;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -315,10 +324,9 @@ void wxListLineData::CalculateSize( wxDC *dc, int spacing )
|
|||||||
wxString s;
|
wxString s;
|
||||||
item->GetText( s );
|
item->GetText( s );
|
||||||
if (s.IsNull()) s = "H";
|
if (s.IsNull()) s = "H";
|
||||||
long lw,lh;
|
long lh;
|
||||||
dc->GetTextExtent( s, &lw, &lh );
|
dc->GetTextExtent( s, (long*) NULL, &lh );
|
||||||
item->SetSize( item->GetWidth(), lh );
|
item->SetSize( item->GetWidth(), lh );
|
||||||
m_bound_all.width += lw;
|
|
||||||
m_bound_all.height = lh;
|
m_bound_all.height = lh;
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
}
|
}
|
||||||
@@ -329,85 +337,125 @@ void wxListLineData::CalculateSize( wxDC *dc, int spacing )
|
|||||||
|
|
||||||
void wxListLineData::SetPosition( wxDC *dc, int x, int y, int window_width )
|
void wxListLineData::SetPosition( wxDC *dc, int x, int y, int window_width )
|
||||||
{
|
{
|
||||||
m_bound_all.x = x;
|
m_bound_all.x = x;
|
||||||
m_bound_all.y = y;
|
m_bound_all.y = y;
|
||||||
switch (m_mode)
|
switch (m_mode)
|
||||||
{
|
|
||||||
case wxLC_ICON:
|
|
||||||
{
|
{
|
||||||
AssignRect( m_bound_icon, 0, 0, 0, 0 );
|
case wxLC_ICON:
|
||||||
AssignRect( m_bound_label, 0, 0, 0, 0 );
|
|
||||||
AssignRect( m_bound_hilight, m_bound_all );
|
|
||||||
wxNode *node = m_items.First();
|
|
||||||
if (node)
|
|
||||||
{
|
|
||||||
wxListItemData *item = (wxListItemData*)node->Data();
|
|
||||||
if (item->HasImage())
|
|
||||||
{
|
{
|
||||||
wxListItemData *item = (wxListItemData*)node->Data();
|
AssignRect( m_bound_icon, 0, 0, 0, 0 );
|
||||||
int w = 0;
|
AssignRect( m_bound_label, 0, 0, 0, 0 );
|
||||||
int h = 0;
|
AssignRect( m_bound_hilight, m_bound_all );
|
||||||
m_owner->GetImageSize( item->GetImage(), w, h );
|
wxNode *node = m_items.First();
|
||||||
m_bound_icon.x = m_bound_all.x + (m_spacing/2) - (w/2);
|
if (node)
|
||||||
m_bound_icon.y = m_bound_all.y + m_spacing - h - 5;
|
{
|
||||||
m_bound_icon.width = w;
|
wxListItemData *item = (wxListItemData*)node->Data();
|
||||||
m_bound_icon.height = h;
|
if (item->HasImage())
|
||||||
if (!item->HasText())
|
{
|
||||||
{
|
wxListItemData *item = (wxListItemData*)node->Data();
|
||||||
AssignRect( m_bound_hilight, m_bound_icon );
|
int w = 0;
|
||||||
m_bound_hilight.x -= 5;
|
int h = 0;
|
||||||
m_bound_hilight.y -= 5;
|
m_owner->GetImageSize( item->GetImage(), w, h );
|
||||||
m_bound_hilight.width += 9;
|
m_bound_icon.x = m_bound_all.x + (m_spacing/2) - (w/2);
|
||||||
m_bound_hilight.height += 9;
|
m_bound_icon.y = m_bound_all.y + m_spacing - h - 5;
|
||||||
}
|
m_bound_icon.width = w;
|
||||||
|
m_bound_icon.height = h;
|
||||||
|
if (!item->HasText())
|
||||||
|
{
|
||||||
|
AssignRect( m_bound_hilight, m_bound_icon );
|
||||||
|
m_bound_hilight.x -= 5;
|
||||||
|
m_bound_hilight.y -= 5;
|
||||||
|
m_bound_hilight.width += 9;
|
||||||
|
m_bound_hilight.height += 9;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (item->HasText())
|
||||||
|
{
|
||||||
|
wxString s;
|
||||||
|
item->GetText( s );
|
||||||
|
long lw,lh;
|
||||||
|
dc->GetTextExtent( s, &lw, &lh );
|
||||||
|
if (m_bound_all.width > m_spacing)
|
||||||
|
m_bound_label.x = m_bound_all.x;
|
||||||
|
else
|
||||||
|
m_bound_label.x = m_bound_all.x + (m_spacing/2) - lw/2;
|
||||||
|
m_bound_label.y = m_bound_all.y + m_bound_all.height - lh;
|
||||||
|
m_bound_label.width = lw;
|
||||||
|
m_bound_label.height = lh;
|
||||||
|
AssignRect( m_bound_hilight, m_bound_label );
|
||||||
|
m_bound_hilight.x -= 2;
|
||||||
|
m_bound_hilight.y -= 2;
|
||||||
|
m_bound_hilight.width += 4;
|
||||||
|
m_bound_hilight.height += 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (item->HasText())
|
case wxLC_LIST:
|
||||||
{
|
{
|
||||||
wxString s;
|
AssignRect( m_bound_label, m_bound_all );
|
||||||
item->GetText( s );
|
m_bound_all.x -= 2;
|
||||||
long lw,lh;
|
m_bound_all.y -= 2;
|
||||||
dc->GetTextExtent( s, &lw, &lh );
|
m_bound_all.width += 4;
|
||||||
if (m_bound_all.width > m_spacing)
|
m_bound_all.height += 3;
|
||||||
m_bound_label.x = m_bound_all.x;
|
AssignRect( m_bound_hilight, m_bound_all );
|
||||||
else
|
AssignRect( m_bound_icon, 0, 0, 0, 0 );
|
||||||
m_bound_label.x = m_bound_all.x + (m_spacing/2) - lw/2;
|
wxNode *node = m_items.First();
|
||||||
m_bound_label.y = m_bound_all.y + m_bound_all.height - lh;
|
if (node)
|
||||||
m_bound_label.width = lw;
|
{
|
||||||
m_bound_label.height = lh;
|
wxListItemData *item = (wxListItemData*)node->Data();
|
||||||
AssignRect( m_bound_hilight, m_bound_label );
|
if (item->HasImage())
|
||||||
m_bound_hilight.x -= 2;
|
{
|
||||||
m_bound_hilight.y -= 2;
|
m_bound_icon.x = m_bound_all.x + 2;
|
||||||
m_bound_hilight.width += 4;
|
m_bound_icon.y = m_bound_all.y + 2;
|
||||||
m_bound_hilight.height += 4;
|
int w;
|
||||||
|
int h;
|
||||||
|
m_owner->GetImageSize( item->GetImage(), w, h );
|
||||||
|
m_bound_icon.width = w;
|
||||||
|
m_bound_icon.height = h;
|
||||||
|
m_bound_label.x += 4 + w;
|
||||||
|
m_bound_label.width -= 4 + w;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case wxLC_REPORT:
|
||||||
|
{
|
||||||
|
long lw,lh;
|
||||||
|
dc->GetTextExtent( "H", &lw, &lh );
|
||||||
|
m_bound_all.x = 0;
|
||||||
|
m_bound_all.y -= 0;
|
||||||
|
m_bound_all.height = lh+3;
|
||||||
|
m_bound_all.width = window_width;
|
||||||
|
AssignRect( m_bound_hilight, m_bound_all );
|
||||||
|
AssignRect( m_bound_label, m_bound_all );
|
||||||
|
AssignRect( m_bound_icon, 0, 0, 0, 0 );
|
||||||
|
wxNode *node = m_items.First();
|
||||||
|
if (node)
|
||||||
|
{
|
||||||
|
wxListItemData *item = (wxListItemData*)node->Data();
|
||||||
|
wxString s;
|
||||||
|
item->GetText( s );
|
||||||
|
if (s.IsEmpty()) s = _T("H");
|
||||||
|
long lw,lh;
|
||||||
|
dc->GetTextExtent( s, &lw, &lh );
|
||||||
|
m_bound_label.width = lw;
|
||||||
|
m_bound_label.height = lh;
|
||||||
|
if (item->HasImage())
|
||||||
|
{
|
||||||
|
m_bound_icon.x = m_bound_all.x + 2;
|
||||||
|
m_bound_icon.y = m_bound_all.y + 2;
|
||||||
|
int w;
|
||||||
|
int h;
|
||||||
|
m_owner->GetImageSize( item->GetImage(), w, h );
|
||||||
|
m_bound_icon.width = w;
|
||||||
|
m_bound_icon.height = h;
|
||||||
|
m_bound_label.x += 4 + w;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case wxLC_LIST:
|
|
||||||
{
|
|
||||||
AssignRect( m_bound_label, m_bound_all );
|
|
||||||
m_bound_all.x -= 2;
|
|
||||||
m_bound_all.y -= 2;
|
|
||||||
m_bound_all.width += 4;
|
|
||||||
m_bound_all.height += 3;
|
|
||||||
AssignRect( m_bound_hilight, m_bound_all );
|
|
||||||
AssignRect( m_bound_icon, 0, 0, 0, 0 );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case wxLC_REPORT:
|
|
||||||
{
|
|
||||||
long lw,lh;
|
|
||||||
dc->GetTextExtent( "H", &lw, &lh );
|
|
||||||
m_bound_all.x = 0;
|
|
||||||
m_bound_all.y -= 0;
|
|
||||||
m_bound_all.height = lh+3;
|
|
||||||
m_bound_all.width = window_width;
|
|
||||||
AssignRect( m_bound_hilight, m_bound_all );
|
|
||||||
AssignRect( m_bound_label, 0, 0, 0 ,0 );
|
|
||||||
AssignRect( m_bound_icon, 0, 0, 0, 0 );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxListLineData::SetColumnPosition( int index, int x )
|
void wxListLineData::SetColumnPosition( int index, int x )
|
||||||
@@ -1171,7 +1219,7 @@ void wxListMainWindow::EditLabel( long item )
|
|||||||
int w = 0;
|
int w = 0;
|
||||||
int h = 0;
|
int h = 0;
|
||||||
m_currentEdit->GetLabelExtent( x, y, w, h );
|
m_currentEdit->GetLabelExtent( x, y, w, h );
|
||||||
|
|
||||||
wxClientDC dc(this);
|
wxClientDC dc(this);
|
||||||
PrepareDC( dc );
|
PrepareDC( dc );
|
||||||
x = dc.LogicalToDeviceX( x );
|
x = dc.LogicalToDeviceX( x );
|
||||||
@@ -1204,6 +1252,7 @@ void wxListMainWindow::OnRenameAccept()
|
|||||||
info.m_mask = wxLIST_MASK_TEXT;
|
info.m_mask = wxLIST_MASK_TEXT;
|
||||||
info.m_itemId = le.m_itemIndex;
|
info.m_itemId = le.m_itemIndex;
|
||||||
info.m_text = m_renameRes;
|
info.m_text = m_renameRes;
|
||||||
|
info.m_colour = le.m_item.m_colour;
|
||||||
SetItem( info );
|
SetItem( info );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1213,7 +1262,7 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event )
|
|||||||
|
|
||||||
if (!m_current) return;
|
if (!m_current) return;
|
||||||
if (m_dirty) return;
|
if (m_dirty) return;
|
||||||
if ( !(event.Dragging() || event.ButtonDown() || event.LeftUp()) ) return;
|
if ( !(event.Dragging() || event.ButtonDown() || event.LeftUp() || event.ButtonDClick()) ) return;
|
||||||
|
|
||||||
wxClientDC dc(this);
|
wxClientDC dc(this);
|
||||||
PrepareDC(dc);
|
PrepareDC(dc);
|
||||||
@@ -1633,6 +1682,10 @@ void wxListMainWindow::DrawImage( int index, wxDC *dc, int x, int y )
|
|||||||
{
|
{
|
||||||
m_small_image_list->Draw( index, *dc, x, y, wxIMAGELIST_DRAW_TRANSPARENT );
|
m_small_image_list->Draw( index, *dc, x, y, wxIMAGELIST_DRAW_TRANSPARENT );
|
||||||
}
|
}
|
||||||
|
if ((m_mode & wxLC_LIST) && (m_small_image_list))
|
||||||
|
{
|
||||||
|
m_small_image_list->Draw( index, *dc, x, y, wxIMAGELIST_DRAW_TRANSPARENT );
|
||||||
|
}
|
||||||
if ((m_mode & wxLC_REPORT) && (m_small_image_list))
|
if ((m_mode & wxLC_REPORT) && (m_small_image_list))
|
||||||
{
|
{
|
||||||
m_small_image_list->Draw( index, *dc, x, y, wxIMAGELIST_DRAW_TRANSPARENT );
|
m_small_image_list->Draw( index, *dc, x, y, wxIMAGELIST_DRAW_TRANSPARENT );
|
||||||
@@ -1652,6 +1705,11 @@ void wxListMainWindow::GetImageSize( int index, int &width, int &height )
|
|||||||
m_small_image_list->GetSize( index, width, height );
|
m_small_image_list->GetSize( index, width, height );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if ((m_mode & wxLC_LIST) && (m_small_image_list))
|
||||||
|
{
|
||||||
|
m_small_image_list->GetSize( index, width, height );
|
||||||
|
return;
|
||||||
|
}
|
||||||
if ((m_mode & wxLC_REPORT) && (m_small_image_list))
|
if ((m_mode & wxLC_REPORT) && (m_small_image_list))
|
||||||
{
|
{
|
||||||
m_small_image_list->GetSize( index, width, height );
|
m_small_image_list->GetSize( index, width, height );
|
||||||
@@ -2081,9 +2139,12 @@ void wxListMainWindow::CalculatePositions()
|
|||||||
int x = 5; // painting is done at x-2
|
int x = 5; // painting is done at x-2
|
||||||
int y = 5; // painting is done at y-2
|
int y = 5; // painting is done at y-2
|
||||||
int maxWidth = 0;
|
int maxWidth = 0;
|
||||||
|
m_visibleLines = 0;
|
||||||
|
int m_currentVisibleLines = 0;
|
||||||
wxNode *node = m_lines.First();
|
wxNode *node = m_lines.First();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
|
m_currentVisibleLines++;
|
||||||
wxListLineData *line = (wxListLineData*)node->Data();
|
wxListLineData *line = (wxListLineData*)node->Data();
|
||||||
line->CalculateSize( &dc, iconSpacing );
|
line->CalculateSize( &dc, iconSpacing );
|
||||||
line->SetPosition( &dc, x, y, clientWidth );
|
line->SetPosition( &dc, x, y, clientWidth );
|
||||||
@@ -2092,6 +2153,9 @@ void wxListMainWindow::CalculatePositions()
|
|||||||
y += lineSpacing;
|
y += lineSpacing;
|
||||||
if (y+lineSpacing-6 >= clientHeight) // -6 for earlier "line breaking"
|
if (y+lineSpacing-6 >= clientHeight) // -6 for earlier "line breaking"
|
||||||
{
|
{
|
||||||
|
if (m_currentVisibleLines > m_visibleLines)
|
||||||
|
m_visibleLines = m_currentVisibleLines;
|
||||||
|
m_currentVisibleLines = 0;
|
||||||
y = 5;
|
y = 5;
|
||||||
x += maxWidth+6;
|
x += maxWidth+6;
|
||||||
entireWidth += maxWidth+6;
|
entireWidth += maxWidth+6;
|
||||||
@@ -2102,12 +2166,14 @@ void wxListMainWindow::CalculatePositions()
|
|||||||
if ((tries == 0) && (entireWidth > clientWidth))
|
if ((tries == 0) && (entireWidth > clientWidth))
|
||||||
{
|
{
|
||||||
clientHeight -= 15; // scrollbar height
|
clientHeight -= 15; // scrollbar height
|
||||||
|
m_visibleLines = 0;
|
||||||
|
m_currentVisibleLines = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!node) tries = 1; // everything fits, no second try required
|
if (!node) tries = 1; // everything fits, no second try required
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_visibleLines = (clientHeight+6) / (lineSpacing); // +6 for earlier "line breaking"
|
// m_visibleLines = (5+clientHeight+6) / (lineSpacing); // +6 for earlier "line breaking"
|
||||||
|
|
||||||
int scroll_pos = GetScrollPos( wxHORIZONTAL );
|
int scroll_pos = GetScrollPos( wxHORIZONTAL );
|
||||||
SetScrollbars( m_xScroll, m_yScroll, (entireWidth+15) / m_xScroll, 0, scroll_pos, 0, TRUE );
|
SetScrollbars( m_xScroll, m_yScroll, (entireWidth+15) / m_xScroll, 0, scroll_pos, 0, TRUE );
|
||||||
|
Reference in New Issue
Block a user