include/df/gui.hpp

00001 //These are GUI objects derived from the Window class
00002 
00003 #define TEXTBOX_MAXLINELENGTH (32*1024)  //32X better than MS-EDIT
00004 
00005 /*
00006 Rules:
00007 - everyobject must have only a default CTOR (no args)
00008 - use Init() if you need one (some don't)
00009 - use a DTOR if you need one (some don't)
00010 */
00011 
00012 //define some standard GUI flags
00013 
00014 #define GUI_SHOWBORDER  0x0001
00015 #define GUI_SHOWLINES   0x0002
00016 #define GUI_SHOWDETAILS 0x0004
00017 #define GUI_EXPANDING   0x0008
00018 #define GUI_FOLDERSONLY 0x0010
00019 
00020 //a special transparent element
00021 class Transparent : public Element {
00022   public:
00023     Transparent() {inited = TRUE;}
00024     void Draw() {};
00025 };
00026 
00027 class Label : public Element {
00028     friend class Radio;
00029   _PROTECTED_:
00030     int lox;  //label off x (used in Radio & CheckBox controls)
00031     int justify;
00032     BOOL transparent;
00033     // uint32 clr;  //already defined in Element class
00034     BOOL b_underline;  //DF/1.6.2 - default = TRUE (disable for filenames)
00035   public:
00036     Label() {}  //CTOR
00037     void Init(char *_txt, Font *_fnt, uint32 _clr = 0x000000, int _justify = LEFT);
00038     void Draw();
00039     Font *fnt;
00040     //public members
00041     String Text;
00042     void SetLabel(char *);
00043     char *GetLabel();
00044     void SetFont(Font *_fnt);
00045     Font *GetFont() { return fnt;}
00046     void SetUnderline(BOOL state) {b_underline = state;}
00047     void SetJustify(int _justify) {
00048       justify = _justify;
00049       FlagDraw();
00050     }
00051     int GetJustify() { return justify;}
00052     void SetTransparent(BOOL x) {transparent = x;FlagDraw();}
00053 };
00054 
00055 class Button : public Label {
00056     friend class CheckBox;
00057     friend class Radio;
00058   _PROTECTED_:
00059     Bitmap Image;
00060     BOOL useImage;
00061   public:
00062     Button();
00063     void Init(Bitmap *_img);
00064     void Init(char *_label, Font *_fnt);
00065 
00066     void SetSize(uint32, uint32);
00067     void SetPos(int, int);
00068     void Show();
00069     void Hide();
00070     void Draw();
00071     void KeyDown(int keycode);
00072     void KeyUp(int keycode);
00073     BOOL Create(int _xpos, int _ypos, int _x, int _y, int _Style, Element *_Parent);
00074     void Enable();
00075     void Disable();
00076     //public members
00077     //img functions
00078     void SetBitmap(Bitmap *_img);
00079 };
00080 
00081 //cursor types
00082 #define CT_LINE 0x00
00083 #define CT_BOX  0x01
00084 #define CT_L    0x02
00085 
00086 class Cursor : public Element, public TimerCallback {
00087   _PROTECTED_:
00088     //xpos / ypos = position
00089     Timer timer;
00090     BOOL shown;
00091     int ct;
00092     int width;  //width of CT_LINE & CT_L types
00093     void Draw();
00094     BOOL skip;  //skip one blink after cursor pos is moved
00095   public:
00096     void TimerEvent(Timer *);
00097     void Init(int _ct, int _width = 2);
00098     void Show();
00099     void Hide();
00100     void SetPos(int x, int y);
00101     void SetPos(int x);
00102     void PutPixel(int, int, uint32);
00103     void SetType(int new_type,int new_width = 2);
00104 };
00105 
00106 class Radio : public Button {
00107   _PROTECTED_:
00108     void CalcOffset();
00109   public:
00110     Radio() : State(FALSE) {}  //CTOR
00111     int __x, __y;  //offset x/y (precalc)
00112     void Init(Bitmap *_img);
00113     void Init(char *_label, Font *_fnt);
00114     void Draw();
00115     void Click(int, int, int);
00116     void DblClick(int, int, int);
00117     BOOL Create(int _xpos, int _ypos, int _x, int _y, int _Style, Element *_Parent);
00118     void SetSize(uint32, uint32);
00119     void SetPos(uint32, uint32);
00120     //public data
00121     BOOL State;
00122     //public members
00123     void SetState(BOOL newstate) {
00124       State = (newstate) ? TRUE : FALSE;  //ensure 0 or 1 only!
00125       FlagDraw();
00126     };
00127     BOOL GetState() { return State;}
00128 };
00129 
00130 class CheckBox : public Radio {
00131   _PROTECTED_:
00132     void CalcOffset();
00133   public:
00134     CheckBox() {}  //CTOR
00135     void Init(Bitmap *_img);
00136     void Init(char *_label, Font *_fnt);
00137     void Draw();
00138     void Click(int, int, int);
00139     void DblClick(int, int, int);
00140     BOOL Create(int _xpos, int _ypos, int _x, int _y, int _Style, Element *_Parent);
00141     void SetSize(uint32, uint32);
00142     void SetPos(uint32, uint32);
00143 };
00144 
00145 class ScrollArrow : public Element {
00146   _PROTECTED_:
00147     int dir;  //direction flag
00148   public:
00149     ScrollArrow();
00150     void SetDirection(int newdir);
00151     int GetDirection() { return dir;}
00152     void Init(int _dir) {
00153       nofocus = TRUE;
00154       SetDirection(_dir);
00155     }
00156     void Draw();
00157     BOOL Create(int _xpos, int _ypos, int _x, int _y, int _Style, Element *_Parent) {
00158       return Element::Create(_xpos, _ypos, 16, 16, _Style, _Parent);
00159     }
00160     void KeyDown(int keycode);
00161 };
00162 
00163 class ScrollBar : public Element {
00164     friend class ScrollBarCombo;
00165   _PROTECTED_:
00166     //public bar info (user info)
00167     int idx;        //index
00168     int viewsize;   //currently size show (# of lines user can see)
00169     int totalsize;  //total size (total # of lines of whole page)
00170     //private bar info (pixel info)
00171     int type;       //VERTICAL or HORIZONTAL
00172     int pidx;       //pixel index (not given to user)
00173     int barsize;    //bar size in pixels
00174     float ratio;    //ratio of totalsize to (x | y)
00175     //move info
00176     int start;      //starting location (MouseDown() event)
00177     BOOL movebar;   //is user moving bar
00178     //private members
00179     void Recalc();  //recalc all data
00180     void RecalcIdx() {  //recalc public bar offset
00181       idx = int(float(pidx) * ratio);
00182       if (idx > (totalsize + viewsize)) idx = totalsize + viewsize;  //EOF
00183     }
00184   void PageUp() {SetPos(idx - viewsize);}
00185     void PageDown() {SetPos(idx + viewsize);}
00186   public:
00187     ScrollBar();
00188     void SetSize(uint32, uint32);
00189     int GetPos() { return idx;}
00190     int SetPos(int newidx);      //Moves Scroll thingy
00191     void SetPos(int _x, int _y) {Element::SetPos(_x, _y);}
00192     void SetTotalSize(int newsize);
00193     void SetViewSize(int newsize);
00194     void Init(int _type);
00195     void Draw();
00196     BOOL Create(int _xpos, int _ypos, int _x, int _y, int _Style, Element *_Parent);
00197     void MouseDown(int, int, int);
00198     void MouseUp(int, int, int);
00199     void MouseOver(int, int, int);
00200 };
00201 
00202 class ScrollBarCombo : public ScrollBar {
00203   _PROTECTED_:
00204     ScrollArrow *sa1, *sa2;  //up/down or left/right
00205   public:
00206     ScrollBarCombo();
00207     void Init(int _type) {
00208       ScrollBar::Init(_type);
00209     }
00210     void Destroy();
00211     BOOL Create(int _xpos, int _ypos, int _x, int _y, int _Style, Element *_Parent);
00212     BOOL DispatchEvent(Element *id, int, int, int, int);
00213     void SetSize(uint32, uint32);
00214     void SetPos(int, int);
00215     int SetPos(int newidx) { return ScrollBar::SetPos(newidx);}
00216 };
00217 
00218 struct TabElement {
00219   BOOL useimg;
00220   Element *img; //what to draw on tab
00221   String label; //else use this
00222   Font *fnt;
00223   Element *id;  //to show/hide elements
00224   int width;   //in pixels
00225 };
00226 
00227 //organizes TabElement(s)
00228 class Tabs : public Element {
00229   _PROTECTED_:
00230     ScrollArrow sal, sar;  //left & right
00231     Array<TabElement*> list;
00232     int32 xpos;
00233     BOOL arrows;
00234   public:
00235     uint32 Count;  //DF/1.2.2
00236     int Index;  //element that is active (init=0)
00237     Tabs();
00238     ~Tabs();
00239     BOOL Create(int _xpos, int _ypos, int _x, int _y, int _Style, Element *_Parent);
00240     BOOL DispatchEvent(Element *id, int, int, int, int);
00241     void AddTab(Element *id, Element *_img, int width);
00242     void AddTab(Element *id, char *_label, Font *_fnt, int width);
00243     void DeleteTab(uint32 idx);  //DF/1.0.1
00244     void Show();
00245     void Hide();
00246     void Draw();
00247     void MouseDown(int, int, int);
00248     void SetLabel(uint32 idx, char *_newlabel);  //DF/1.0.1
00249     void Switch(uint32 idx);  //DF/1.0.1
00250     void SetWidth(uint32 idx, uint32 width);  //DF/1.0.1
00251     void ScrollLeft();  //DF/1.0.1
00252     void ScrollRight(); //DF/1.0.1
00253 };
00254 
00255 class BoxFill : public Element {
00256   public:
00257     void Draw();
00258 };
00259 
00260 class Box : public Element {
00261   _PROTECTED_:
00262     BOOL _double;
00263     BOOL _outy;
00264   public:
00265     Box() {};
00266     void Init(BOOL __double, BOOL __outy);  //outy=means it creates a box that looks like a button (moutain), else it's a valley
00267     void Draw();
00268     void SetStyle(BOOL __double, BOOL __outy) {
00269       _double = __double;
00270       _outy = __outy;
00271       FlagDraw();
00272     }
00273 };
00274 
00275 class HLine : public Element {
00276   public:
00277     HLine();
00278     BOOL Create(int _xpos, int _ypos, int _x, int _y, int _Style, Element *_Parent);
00279     void Draw();
00280 };
00281 
00282 class VLine : public Element {
00283   public:
00284     VLine();
00285     BOOL Create(int _xpos, int _ypos, int _x, int _y, int _Style, Element *_Parent);
00286     void Draw();
00287 };
00288 
00289 class TextBox : public Element {
00290     friend class TextBoxCombo;
00291     friend class TextLine;
00292     friend class PasswordTextLine;
00293   _PROTECTED_:
00294     Font *fnt;
00295     uint8 ct;  //cursor type
00296     void Draw();
00297     int32 dx, dy;  //display x/y (0,0=home) (x=char pos,y=line pos)
00298     int32 cx, cy;  //cursor x/y position (relative to dx/dy)
00299     //current line = text[dy+cy];
00300     int seldir;      //DOWN/UP/0=started(no length)/-1=none
00301     int32 selline1;  //1st selection line (-1 = no selection)
00302     int32 seloff1;   //1st selection line offset (0=start)
00303     int32 selline2;  //last selection line
00304     int32 seloff2;   //# chars selected in last line
00305     uint32 numcharx, numchary; //max # of chars displayable within window
00306     uint32 pnumcharx, pnumchary; //max # of chars displayable within window (plus any partial that can be displayed)
00307     Cursor cursor;
00308     BOOL ProcessKey(int);  //KEY_...
00309     void FindCursor(BOOL);
00310     void BreakUpLine(int);
00311     void AdjustSelection();
00312     void StartSelection();
00313     virtual void UpdateCount();
00314     void UpdateNumChars();
00315     void _SetSize(uint32, uint32);  //internal setsize  //DF/1.0.1
00316     int strlentab(char *, int max);  //string length with expanding tabspaces
00317     BOOL singleline;
00318     BOOL showborder;  //DF/1.6.2
00319     BOOL dirty;
00320   public:
00321     //ctor/dtor
00322     TextBox();
00323     void Init(Font *_fnt, uint8 cursor_type = CT_LINE, int guiflgs = GUI_SHOWBORDER);
00324     ~TextBox();
00325     //GUI members
00326     void KeyDown(int);  //key trapping
00327     void GetKey(char);  //add a key
00328     void MouseDown(int, int, int);
00329     void MouseUp(int, int, int);
00330     void MouseOver(int, int, int);
00331 
00332     //Element members
00333     Array<String*> text;  //list of String's
00334     void SetSize(uint32, uint32);
00335     void Show();
00336     void GetFocus();
00337     void LostFocus();
00338     void SetPos(int, int);
00339     BOOL Create(int _xpos, int _ypos, int _x, int _y, int _Style, Element *_Parent);
00340     //public data
00341     BOOL Editable;     //may user edit (read only)
00342     BOOL InsertMode;   //currently in insert mode (read only)
00343     int Count;         //# of lines in textbox (read only)
00344     int MaxLineLength; //Longest line length (read only)
00345     //public members
00346     BOOL LoadText(File &);  //from open file (from current pos to EOF)
00347     BOOL LoadText(char *);  //from file
00348     BOOL SaveText(File &, BOOL _unix = FALSE, BOOL removetrailingspaces = FALSE);
00349     BOOL SaveText(char *, BOOL _unix = FALSE, BOOL removetrailingspaces = FALSE);
00350     void SetText(char *);   //from a cString
00351     //Note:these lines are dynamic and could change during ProcessQueue()
00352     char *GetLine(uint32 line);  //return a line
00353     String &GetString(uint32 line);  //return a line
00354     BOOL SetLine(uint32 line, char *str);  //change a line
00355     void DelLine(uint32 line);    //delete a line
00356     void AddText(char *txt);
00357     void SetFont(Font *);
00358     Font *GetFont() {return fnt;}
00359     void SetEditable(BOOL state);
00360     void SetInsertMode(BOOL state);
00361     void SetCursorPos(int x , int y);
00362     void GetCursorPos(int *x, int *y);
00363     void SelectAll();
00364     void SelectNone();
00365     void SelectText(int line1, int off1, int line2, int off2, int dir = DOWN);  //use -1 for end //dir=DOWN | UP
00366 //DF/2.1.5 - NEW - find/replace (down from cursor)
00367     BOOL Find(char *fndstr, int flgs);  //selects text if found
00368     BOOL SelectReplace(char *repstr);
00369     BOOL IsDirty();
00370     void ClearDirty();
00371 //DF/3.0 - NEW
00372     void TrimRight(char *);  //trim right from all lines (use " " to remove all trailing spaces)
00373     void TrimLeft(char *);  //doesn't seem useful but if you need it, it's there
00374     BOOL IsSelect();
00375     void GetSelect(String &s);
00376 };
00377 
00378 class TextBoxCombo : public TextBox {
00379   _PROTECTED_:
00380     ScrollBarCombo *sv, *sh;  //scrollBars vertical/horizontal
00381     BOOL svp, shp;            //present (visible) flags
00382     void UpdateCount();
00383   public:
00384     BOOL Create(int _xpos, int _ypos, int _x, int _y, int _Style, Element *_Parent);
00385     void Destroy();
00386     void SetSize(uint32, uint32);
00387     TextBoxCombo();
00388     void Init(Font *_fnt, uint8 cursor_type = CT_LINE, int guiflgs = GUI_SHOWBORDER) {
00389       TextBox::Init(_fnt, cursor_type, guiflgs);
00390     }
00391     BOOL DispatchEvent(Element *id, int, int, int, int);
00392     void Hide();
00393     void Show();
00394 };
00395 
00396 class TextLine : public TextBox {
00397   public:
00398     TextLine() {};  //CTOR
00399     void Init(Font *_fnt, uint8 cursor_type = CT_LINE);
00400     char *GetText() { return GetLine(0);}
00401     String &GetString() { return TextBox::GetString(0);}
00402     void SetCursorPos(int x) {TextBox::SetCursorPos(x, 0);}
00403     void GetCursorPos(int *x) {TextBox::GetCursorPos(x, (int*)NULL);}
00404 };
00405 
00406 class PasswordTextLine : public TextLine {
00407   public:
00408     void Draw();
00409     PasswordTextLine();
00410     void Init(Font *_fnt, uint8 cursor_type = CT_LINE);
00411 };
00412 
00413 class ProgressBar : public Element {
00414   _PROTECTED_:
00415     uint32 value;  //0-100%
00416     void Draw();
00417   public:
00418     ProgressBar();
00419     //User-members
00420     BOOL Create(int _xpos, int _ypos, int _x, int _y, int _Style, Element *_Parent);
00421     void SetValue(uint32 newvalue) {
00422       if (newvalue > 100) newvalue = 100;
00423       value = newvalue;
00424       FlagDraw();
00425     }
00426   uint32 GetValue() { return value;}
00427     void SetClr(uint32 newclr) {clr = newclr; FlagDraw();}
00428     uint32 GetClr() { return clr;}
00429 };
00430 
00431 struct SpreadSheetCell {
00432   friend class SpreadSheet;
00433 _PROTECTED_:
00434   BOOL deleteImage;  //true means Image=Label which must be delete'd
00435   Element *Image;
00436 
00437   int vo;   //vertical-orientation (CENTER,TOP or BOTTOM) def=TOP
00438   int ho;   //horizontal-orientation (CENTER,LEFT or RIGHT) def=LEFT
00439 };
00440 
00441 class SpreadSheet : public Element {
00442     friend class SpreadSheetCombo;
00443   _PROTECTED_:
00444     SpreadSheetCell *list;   //list of cell data
00445     //    int _xc,_yc; //# columns,# rows
00446     //    int _xs,_ys; //cel sizes (static!)
00447     int posx, posy;  //sheet pos
00448     //    int _xp,_yp; //cursor position
00449     Array<int> Xs;  //X sizes (_xc = Xs.Count)
00450     Array<int> Ys;  //Y sizes (_yc = Ys.Count)
00451     BOOL showlines;
00452     BOOL showborder;
00453     BOOL _double;
00454     BOOL _outy;
00455     void HideAll();
00456     void DeleteList();
00457     uint32 GetTotalXSize();
00458     uint32 GetTotalYSize();
00459   public:
00460     SpreadSheet();
00461     ~SpreadSheet();
00462     void Draw();
00463     void Show();
00464     void Hide();
00465     BOOL Create(int _xpos, int _ypos, int _x, int _y, int _Style, Element *_Parent);
00466     //user functions
00467     void CreateSheet(int xc, int yc, int xs, int ys, int guiflgs);
00468     //xc/yx = x/y count (# cells), xs/ys = size of cells (in pixels)
00469     void SetBorderStyle(BOOL __double, BOOL __outy);
00470     void SetCell(int x, int y, char *_text, Font *_fnt, int _clr);
00471     void SetCell(int x, int y, Element *_img);
00472     void SetCellJustify(int x, int y, int horizontal, int vertial);  //default = LEFT,TOP
00473     void DeleteCell(int x, int y);  //hides cell contents, Element is not deleted!
00474     void DeleteSheet();
00475     void SetSheetPos(int x, int y); //in pixels!
00476     void GetSheetPos(int *x, int *y); //in pixels!
00477     void SetXSize(uint32 x, uint32 size);
00478     void SetYSize(uint32 y, uint32 size);
00479 };
00480 
00481 class SpreadSheetCombo : public SpreadSheet {
00482   _PROTECTED_:
00483     ScrollBarCombo *sv, *sh;  //scrollBars vertical/horizontal
00484     void SetTotalSizes();
00485     void DestroyChildren();
00486   public:
00487     SpreadSheetCombo();
00488     BOOL DispatchEvent(Element *id, int, int, int, int);
00489     void KeyDown(int key);
00490     BOOL Create(int _xpos, int _ypos, int _x, int _y, int _Style, Element *_Parent);
00491     void CreateSheet(int xc, int yc, int xs, int ys, int guiflgs);
00492     void DeleteSheet();
00493     void SetBorderStyle(BOOL __double, BOOL __outy);
00494     void Destroy() {
00495       DestroyChildren();
00496       SpreadSheet::Destroy();
00497     }
00498     void Show();
00499     void Hide();
00500     void SetXSize(uint32 x, uint32 size);
00501     void SetYSize(uint32 y, uint32 size);
00502     void SetSheetPos(int x, int y); //in pixels!
00503 };
00504 
00505 class SelectionList;
00506 
00507 class Selection : public Element {
00508     friend class SelectionList;
00509   _PROTECTED_:
00510     SelectionList *Owner;
00511     BOOL highlight;
00512   public:
00513     //ctor
00514     Selection();
00515     ~Selection();
00516     //public members
00517     BOOL State;
00518     void Click(int, int, int);
00519     void Draw();
00520     void SetState(BOOL);
00521     void MouseOver(int,int,int);
00522     //user members
00523     void SetHighlight(BOOL state) {highlight = state;}
00524 };
00525 
00526 class SelectionList {
00527     friend class Selection;
00528   _PROTECTED_:
00529     List<Selection*> list;
00530     void Click(Selection *, int flgs);
00531   public:
00532     void Add(Selection *);  //Insert()
00533     void Delete(Selection *);  //Find()/Delete()
00534     void DeleteAll();  //empty list
00535 
00536     void SelectAll();
00537     void UnselectAll();
00538 };
00539 
00540 /*
00541 class BitmapLabel : public Bitmap {
00542   //a Bitmap with a Label to the side (good for MenuItem's)
00543   public:
00544     Label *Text;
00545     BOOL Create(int _xpos,int _ypos,int _x,int _y,int _Style,Element *_Parent);
00546 };
00547 */
00548 
00549 //a list of text to select
00550 class ListBox : public Element {
00551     friend class ComboBox;
00552   _PROTECTED_:
00553     Font *fnt;
00554     SpreadSheetCombo *ss;
00555     Array<String*> strlist;  //the strings
00556     Array<Label*> llist;
00557     Array<Selection*> slist;
00558     BOOL highlight;
00559   public:
00560     ListBox();
00561     ~ListBox();
00562     int32 Index;
00563     uint32 Count;  //DF/0.5.2 - new member
00564     void Init(Font *_fnt);
00565     BOOL Create(int _xpos, int _ypos, int _x, int _y, int _Style, Element *_Parent);
00566     void Destroy();
00567     void Show();
00568     void Hide();
00569     BOOL DispatchEvent(Element *id, int, int, int, int);
00570     //user functions
00571     BOOL Add(char *, int32 pos = -1);  //add an entry to list
00572     //pos=-1 to add @ end of list
00573     BOOL Delete(int32 idx);  //remove an entry from list (-1=last)
00574     void SetHighlight(BOOL state) {highlight = state;}
00575     BOOL GetState(int idx);  //get state of entry
00576     int GetState();     //get state of single selected entry (-1 = none or more than one)
00577     void SetState(int idx, BOOL state);  //set state of entry
00578     char *Get();   //get current selected item (NULL = none or more than one)
00579     char *Get(int idx);  //get @ idx
00580     void ClrAll();  //clear all states
00581     void SetTopZOrder();
00582 };
00583 
00584 //a TextLine with a DropDown Arrow
00585 class ComboBox : public Element {
00586   _PROTECTED_:
00587     Font *fnt;
00588     ListBox *lbox;
00589     TextLine *tline;
00590     BOOL lboxvisible;
00591     //    BOOL EventHandler(Element *id,int &msg,int &x,int &y,int &flgs);
00592     void HideList();
00593     void ShowList();
00594   public:
00595     ComboBox() : Index( -1) {}
00596     ~ComboBox();
00597     int32 Index;
00598     void Init(Font *_fnt);
00599     BOOL Create(int _xpos, int _ypos, int _x, int _y, int _Style, Element *_Parent);
00600     void Destroy();
00601     void MouseDown(int, int, int);
00602     void MouseUp(int, int, int);
00603     void Draw();  //override Button drawing
00604     //user funcs
00605     void SetEditable(BOOL state) {tline->SetEditable(state);}
00606     BOOL Add(char *x, int32 pos = -1) { return lbox->Add(x, pos);}
00607     BOOL Delete(int32 idx) { return lbox->Delete(idx);}
00608     void Clear() {
00609       tline->SetText("");
00610       Index = -1;
00611     }
00612     int GetIndex() { return Index;}
00613     char *Get();  //get contents @ current index (NULL if index==-1)
00614     char *Get(int idx);  //get contents @ index (NULL if out of bounds)
00615     void SetIndex(int idx);  //set state of one (clear all others) (-1 = clear all)
00616     void SetTopZOrder();
00617     BOOL DispatchEvent(Element *id, int, int, int, int);
00618 };
00619 
00620 struct ExplorerResource {
00621   String name;
00622   String fullpath;
00623   uint32 type;  //see explorer.cpp
00624   Label lbl_1;
00625   Label lbl_2;
00626   //  Selection sel_1;
00627   Selection sel_2;
00628   Bitmap icon;  //this is a special Bitmap! (16x16)
00629   Bitmap expandicon;  //expand/colapse icon [plus or minus] (same type as icon)
00630   int indent;   //indent level (0=root)
00631   BOOL bExpanded;
00632 };
00633 
00634 class Explorer : public SpreadSheetCombo {
00635   private:
00636     Font *fnt;
00637     Array<ExplorerResource*> reslist;
00638     BOOL bAutoStart, bIcons;
00639     void EnumFiles();
00640     BOOL EventExpand;
00641     int EventIndex;
00642     void SetCells();
00643     uint32 col1size, col2size, col3size;
00644     void FreeList();
00645     void Start(ExplorerResource *p);
00646     Bitmap *bmFolder, *bmFile, *bmDrive, *bmPlus, *bmMinus;
00647     String mask;  //DF/1.6.2
00648     Enumerator *ff;
00649     char *BuildAttrString(String &s);
00650     int guiflgs;
00651     void Insert(char *, int);
00652     void Sort(int);
00653     void qsort(int,int);
00654     int CalcXC();
00655     void Verify();  //verify enum expanding mode
00656   public:
00657     String Path;
00658     String Filename;
00659     //GUI members
00660     Explorer();
00661     ~Explorer();
00662     void Init(Font *_fnt, Enumerator *Enum, int guiflgs);
00663     BOOL DispatchEvent(Element *id, int, int, int, int);
00664     void Show();
00665     void Hide();
00666     //public members
00667     void Update();  //reEnum()erate elements
00668     //    void SetURL(char *);  //ftp://...
00669     void SetPath(char *path);   //sets Root Path of view (""=all drives/root folder)
00670     void SetAutoStart(BOOL state);  //run file on click (default=FALSE)
00671     void ShowDetails(BOOL state);
00672     void SetIcons(Bitmap *folder, Bitmap *file, Bitmap *drive, Bitmap *plus, Bitmap *minus);
00673     void GotoParentPath();
00674     void ViewOnlyPaths(BOOL state);
00675     void SetMask(char *msk) {mask = msk;}
00676     //tree mode control
00677     void Expand(int idx);
00678     void Colapse(int idx);
00679     //more tree mode control DF/3.0.3
00680     BOOL ExpandToPath(char *path);  //expands to path (clears Filename)
00681 };
00682 

Generated on Mon Mar 5 09:49:14 2007 for DigiForce by  doxygen 1.4.7