/*
* Copyright (C) 2003-2005 Pr Bjrklund, per.bjorklund@gmail.com
*
* 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.
*/
#if !defined(FULTABSPAGE_H)
#define FULTABSPAGE_H
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <atlcrack.h>
#include "PropPage.h"
#include "WinUtil.h"
class FulTabsPage: public CPropertyPage<IDD_FULTABSPAGE>, public PropPage
{
public:
FulTabsPage(SettingsManager *s) : PropPage(s) {
SetTitle( CTSTRING(SETTINGS_FUL_TABS) );
m_psp.dwFlags |= PSP_HASHELP | PSP_RTLREADING;
};
~FulTabsPage() { };
BEGIN_MSG_MAP(FulTabsPage)
MESSAGE_HANDLER(WM_INITDIALOG, onInitDialog)
MESSAGE_HANDLER(WM_HELP, onHelp)
MESSAGE_HANDLER(WM_CTLCOLORDLG, OnCtlColor)
MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnCtlColor)
COMMAND_ID_HANDLER(IDC_BTN_COLOR, onColorButton)
COMMAND_ID_HANDLER(IDC_CH_BLEND, onClickedBox)
COMMAND_HANDLER(IDC_COLOR_COMBO, LBN_SELCHANGE, onColorListChange)
NOTIFY_CODE_HANDLER_EX(PSN_HELP, onHelpInfo)
END_MSG_MAP()
LRESULT onInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
LRESULT onColorButton(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT onClickedBox(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT onHelp(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
LRESULT onHelpInfo(LPNMHDR /*pnmh*/);
LRESULT onColorListChange(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnCtlColor(UINT, WPARAM wParam, LPARAM lParam, BOOL&) {
HWND hWnd = (HWND)lParam;
if(hWnd == ctrlTabPreview.m_hWnd) {
::SetBkMode((HDC)wParam, TRANSPARENT);
HANDLE h = GetProp(hWnd, _T("fillcolor"));
if (h != NULL) {
return (LRESULT)h;
}
return TRUE;
} else {
SetBkMode((HDC)wParam, SETTING(BK_SETTING));
SetTextColor((HDC)wParam, SETTING(BK_SETTING_TEXT));
return (LRESULT)WinUtil::bkBrush;
}
}
void setForeColor(CEdit& cs, const COLORREF& cr) {
HBRUSH hBr = CreateSolidBrush(cr);
SetProp(cs.m_hWnd, _T("fillcolor"), hBr);
cs.Invalidate();
cs.RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_ERASENOW | RDW_UPDATENOW | RDW_FRAME);
}
// Common PropPage interface
PROPSHEETPAGE *getPSP() { return (PROPSHEETPAGE *)*this; }
virtual void write();
protected:
struct clrs {
ResourceManager::Strings name;
int setting;
COLORREF value;
};
static clrs colors[];
static Item items[];
static ListItem listItems[];
static TextItem texts[];
CComboBox colorList;
CEdit ctrlTabPreview;
};
#endif // !defined(FULTABSPAGE_H)
/**
* @file
* $Id: FulTabsPage.h 73 2006-01-20 17:35:16Z crakter $
*/