/*
* Copyright (C) 2003 Twink, spm7@waikato.ac.nz
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef PREVIEWPAGE_H
#define PREVIEWPAGE_H
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <atlcrack.h>
#include "PropPage.h"
#include "ExListViewCtrl.h"
#include "resource.h"
#include "WinUtil.h"
class PreviewApplication;
class PreviewPage : public CPropertyPage<IDD_PREVIEWPAGE>, public PropPage {
public:
PreviewPage(SettingsManager *s) : PropPage(s) {
SetTitle(CTSTRING(SETTINGS_MEDIA));
};
virtual ~PreviewPage() {
ctrlCommands.Detach();
};
BEGIN_MSG_MAP_EX(PreviewPage)
MESSAGE_HANDLER(WM_INITDIALOG, onInitDialog)
MESSAGE_HANDLER(WM_CTLCOLORDLG, OnCtlColor)
MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnCtlColor)
COMMAND_ID_HANDLER(IDC_ADD_MENU, onAddMenu)
COMMAND_ID_HANDLER(IDC_REMOVE_MENU, onRemoveMenu)
COMMAND_ID_HANDLER(IDC_CHANGE_MENU, onChangeMenu)
COMMAND_ID_HANDLER(IDC_WINAMP_FOLDER, onOpenWinampFolder)
COMMAND_HANDLER(IDC_WINAMP_BROWSE, BN_CLICKED, onBrowseWinamp)
COMMAND_HANDLER(IDC_WINAMP_HELP, BN_CLICKED, onClickedWinampHelp)
NOTIFY_HANDLER(IDC_MENU_ITEMS, BN_DOUBLECLICKED, onDblClick)
NOTIFY_HANDLER(IDC_MENU_ITEMS, LVN_KEYDOWN, onKeyDown)
END_MSG_MAP()
LRESULT onInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
LRESULT onBrowseWinamp(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT onAddMenu(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT onChangeMenu(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT onRemoveMenu(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT onClickedWinampHelp(WORD /* wNotifyCode */, WORD wID, HWND /* hWndCtl */, BOOL& /* bHandled */);
LRESULT onKeyDown(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/);
LRESULT onDblClick(int /*idCtrl*/, LPNMHDR /* pnmh */, BOOL& bHandled) {
return onChangeMenu(0, 0, 0, bHandled);
}
LRESULT OnCtlColor(UINT, WPARAM wParam, LPARAM, BOOL&) {
SetBkMode((HDC)wParam, SETTING(BK_SETTING));
SetTextColor((HDC)wParam, SETTING(BK_SETTING_TEXT));
return (LRESULT)WinUtil::bkBrush;
}
LRESULT onOpenWinampFolder(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) {
WinUtil::openFile(Text::toT(SETTING(WINAMP_LOCATION)));
return 0;
}
// Common PropPage interface
PROPSHEETPAGE *getPSP() { return (PROPSHEETPAGE *)*this; }
virtual void write();
protected:
ExListViewCtrl ctrlCommands;
static Item items[];
static TextItem texts[];
void Remove();
void addEntry(PreviewApplication* pa, int pos);
};
#endif
/**
* @file
* $Id: PreviewPage.h 73 2006-01-20 17:35:16Z crakter $
*/