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

#ifndef SFXDialogsH
#define SFXDialogsH
//---------------------------------------------------------------------------
#include <shlobj.h>
#include <commctrl.h>
#include "sfxrc.h"
#include "SFXStructs.h"



const WORD ID_CB_NOASK = 0x12d;
  // max password length
const int MAX_PASSWORD = 80;


  // controls to show on "show files" button press
int SHOW_CTRLS[2] = {ID_ST_FILES, ID_LV_FILES};
 // controls to reposition on hiding overwrite/run controls
int POS_CTRLS_HIDE[6]= {ID_BTN_SHOWFILES, ID_CB_RUN, ID_BTN_ABOUT,
                              ID_BTN_YES, ID_BTN_NO, ID_EDGE_BOTTOM};
  // controls to reposition on pressing "Show files" button
int POS_CTRLS[10] = {ID_ST_OVWGROUP, ID_RB_OVERWRITE,
    ID_RB_SKIP, ID_RB_CONFIRM, ID_BTN_SHOWFILES, ID_CB_RUN, ID_BTN_ABOUT,
    ID_BTN_YES, ID_BTN_NO, ID_EDGE_BOTTOM};

  // controls to show/hide on progress bar display/hiding
int SWAP_CTRLS[4] = {ID_PRG_EXTRACT, ID_ST_EXTRACTTO, ID_EDITBOX,
                           ID_BTN_BROWSE};


extern char* LVC_Filename;
extern char* LVC_Filesize;
extern char* Cap_About;
extern char* Cap_Finished;
extern char* Cap_Browse;
extern char* Cap_Password;
extern char* Msg_About;
extern char* Msg_SomeNotExtracted;
extern char* Msg_SelNotExtracted;
extern char* Msg_AllExtracted;
extern char* Msg_QueryCancel;
extern char* Msg_FileExists;


extern HINSTANCE MInstance;
extern TSFXFileHeader VRec_SFXHeader;
extern char PathBuf[MAXPATH];
extern char TempBuf[MAXPATH];
extern char* VStr_ExtractPath;
extern char* VStr_SFX_Caption;
extern char* VStr_SFX_CmdLine;
extern char* VStr_CurrentFile;
extern char* VStr_Password;
HWND VH_MainWnd;
unsigned VH_ShellImageList;
bool VBool_Cancelled;

// for MainDialogProc
bool InExtraction;
// for Brows dialog
char DisplayName[MAX_PATH];



bool CALLBACK MainDialogProc(HWND DlgWin, UINT DlgMessage, WPARAM DlgWParam, LPARAM DlgLParam);
bool BrowseDirectory(HWND Parent, char* Path);
int CALLBACK BrowseCBProc(HWND HWindow, int Msg, LPARAM lParameter, LPARAM lpBrowseFolder);
bool CALLBACK FileExistsDialogProc(HWND DlgWin, UINT DlgMessage, WPARAM DlgWParam,
                                   LPARAM DlgLParam);
bool CALLBACK PasswordQueryDialogProc(HWND DlgWin, UINT DlgMessage, WPARAM DlgWParam,
                                      LPARAM DlgLParam);
// functions in SFXProcs
extern int MsgBox(const HWND wndPar, const char* sMsg,const char* sTitle,
           const unsigned uType);
extern void ErrorMsgBox(const HWND wndPar,const char* sMsg);
extern void AddFilesListViewCol(const HWND wndDlg, const int Index, const char* Caption,
                         const int Direction, int Width);
extern void GetRunCheckBoxText(char* Dest);
extern void ResizeControl(const HWND wnd, const bool Reposition, int yDiff);
extern void FillListView(HWND wndOwner);
extern char* StrGetEditText(HWND wndPar);
extern void SelectAllInFilesListView(const HWND wndDlg);
extern char* RemoveDirSeparator(char* Dir);
extern char* GetCurDir(void);
extern void EnableChildren(const HWND wnd, const bool Enable);
extern bool Extract(HWND wndOwner);
extern UINT ExecuteCMD(void);
extern void GetRunErrorMessage(char* Dest);
extern char* FormatStr(const char* Format,const char* args, char* Dest);
extern bool DirectoryExists(const char* Dir);
extern void ExtractFileName(char* FileName, char* Dest);
extern void SfxExit(bool success, bool doexit);
// added for spanned archives
#ifndef NO_SPAN
extern bool CheckIfSpanned(void);
extern void FillListViewSpan(HWND wndOwner);
#endif

#endif
