/*
* 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(FILTERPAGE_DLG_H)
#define FILTERPAGE_DLG_H
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "WinUtil.h"
class FilterPageDlg : public CDialogImpl<FilterPageDlg>
{
CEdit ctrlFstring;
public:
tstring fstring;
enum { IDD = IDD_ADD_FILTER_PAGE };
BEGIN_MSG_MAP(FilterPageDlg)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
MESSAGE_HANDLER(WM_CTLCOLORDLG, OnCtlColor)
MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnCtlColor)
MESSAGE_HANDLER(WM_SETFOCUS, onFocus)
COMMAND_ID_HANDLER(IDOK, OnCloseCmd)
COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd)
END_MSG_MAP()
FilterPageDlg() { };
LRESULT onFocus(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) {
ctrlFstring.SetFocus();
return FALSE;
}
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
#define ATTACH(id, var, txt) \
var.Attach(GetDlgItem(id)); \
var.SetWindowText(txt.c_str());
ATTACH(IDC_FSTRING, ctrlFstring, fstring);
#undef ATTACH
#define ATTACH(id, var) var.Attach(GetDlgItem(id))
#undef ATTACH
ctrlFstring.SetFocus();
CenterWindow(GetParent());
return FALSE;
}
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 OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
if(wID == IDOK) {
#define GET_TEXT(id, var) \
GetDlgItemText(id, buf, 512); \
var = buf;
TCHAR buf[512];
//string temp;
if ( ctrlFstring.GetWindowTextLength() == 0 ) {
MessageBox(CTSTRING(LINE_EMPTY));
return 0;
}
GET_TEXT(IDC_FSTRING, fstring);
}
EndDialog(wID);
return 0;
}
};
#endif // !defined(FILTERPAGE_DLG_H)
/**
* @file
* $Id: FilterPageDlg.h 111 2006-11-17 12:42:35Z mccm $
*/