/**************************************************************************

    This file is part of explorer95, a file manager for fvwm95.
    Copyright (C) 1996, 1997 David Barth, Hector Peraza.

    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 __MAIN_H
#define __MAIN_H

#include <X11/cursorfont.h>

#include <xclass/OXClient.h>
#include <xclass/OXWindow.h>
#include <xclass/OXFrame.h>
#include <xclass/OXWidgets.h>
#include <xclass/OString.h>
#include <xclass/OPicture.h>
#include <xclass/OXListView.h>
#include <xclass/OXFileContainer.h>
#include <xclass/OXFSDDListBox.h>
#include <xclass/utils.h>

#include "OXNewWidgets.h"
#include "OXListTree.h"


//----- Operation modes:

#define EXPLORER_MODE   0
#define FILE_MGR_MODE   1


//----- Menu IDs

#define M_FILE_NEW		101
#define M_FILE_NEWFOLDER	    111
#define M_FILE_NEWSHORTCUT	    112
#define M_FILE_DELETE		102
#define M_FILE_RENAME		103
#define M_FILE_PROPS		104
#define M_FILE_CLOSE		105

#define M_EDIT_UNDO		201
#define M_EDIT_CUT		202
#define M_EDIT_COPY		203
#define M_EDIT_PASTE		204
#define M_EDIT_PASTESHORTCUT	205
#define M_EDIT_SELECTALL	206
#define M_EDIT_INVSELECTION	207

#define M_VIEW_TOOLBAR		301
#define M_VIEW_STATUS		302
#define M_VIEW_LARGEICONS	303
#define M_VIEW_SMALLICONS	304
#define M_VIEW_LIST		305
#define M_VIEW_DETAILS		306
#define M_VIEW_ARRANGE_BYNAME	    311
#define M_VIEW_ARRANGE_BYTYPE	    312
#define M_VIEW_ARRANGE_BYSIZE	    313
#define M_VIEW_ARRANGE_BYDATE	    314
#define M_VIEW_ARRANGE_AUTO	    315
#define M_VIEW_LINEUP           307
#define M_VIEW_REFRESH          308
#define M_VIEW_OPTIONS          309

#define M_HELP_CONTENTS		401
#define M_HELP_SEARCH		402
#define M_HELP_ABOUT		403


//----- Struct and #defines for default icons

// These are just indexes to default_icon[], see main.cc

#define ICON_FOLDER      0
#define ICON_APP         1
#define ICON_DOC         2
#define ICON_LINK        3

#define ICON_BIG         0
#define ICON_SMALL       1

struct _default_icon {
  char  *picname_prefix;
  const OPicture *icon[2];
};


//----- Toolbar stuff...

struct _tb_data {
  char *pixmap;
  char *tip_text;
  int  stay_down;
  int  id;
  OXButton *button;
};


//---------------------------------------------------------------------

class OXExplorerMainFrame : public OXMainFrame {
public:
  OXExplorerMainFrame(const OXWindow *p, int w, int h);
  virtual ~OXExplorerMainFrame();

  virtual int ProcessMessage(long msg, long parm1, long parm2);
  virtual void CloseWindow();

  void ReadIniFile(char *);
  void SaveIniFile();
  void DisplayTotal(int total, int selected);
  void SetViewMode(int new_mode, int force = False);
  void SetSortMode(int new_mode);
  void SetTitle();
  void UpdateListBox();
  void UpdateTree();
  void DoAction(OXFileItem *f);
  void DeleteFiles();

  void ReadDir(char *cdir, OListTreeItem *parent);
  void ReadSubDirs(char *cdir, OListTreeItem *parent);

protected:
  OXHorizontal3dLine *_toolBarSep;
  OXToolBar *_toolBar;
  OXFileSystemDDListBox *_ddlb;
  OXStatusBar *_statusBar;
  OXVerticalFrame *_v1, *_v2;
  OXLabel *_lbl1, *_lbl2;
  OXHorizontalFrame *_hf;
  OXCompositeFrame *_treeHdr, *_listHdr;
  OXListView *_listView;

  OXCanvas *_treeView;
  OXListTree *_lt;

  OLayoutHints *_menuBarLayout, *_menuBarItemLayout;

  OXMenuBar *_menuBar;
  OXPopupMenu *_menuFile, *_menuEdit, *_menuView, *_menuTools,
              *_menuHelp;
  OXPopupMenu *_newMenu, *_sortMenu, *_findMenu;
  OXPopupMenu *objectMenu, *sendToMenu;

  char _rcfilename[PATH_MAX];
  char _currentDir[PATH_MAX];

  Cursor _waitCursor;
};


#endif  // __MAIN_H
