A
download ADLSearchFrame.h
Language: C++
License: GPL
Copyright: (C) 2001-2006 Jacek Sieka, arnetheduck on gmail point com
LOC: 97
Project Info
mcdcplusplus(mcdc)
Server: BerliOS (SVN)
Type: svn
...(SVN)\m\mcdc\trunk\windows\
   AboutDlg.h
   ADLSearchFrame.cpp
   ADLSearchFrame.h
   ADLSProperties.cpp
   ADLSProperties.h
   Advanced3Page.cpp
   Advanced3Page.h
   AdvancedPage.cpp
   AdvancedPage.h
   AGArrayTemplates.cpp
   AGArrayTemplates.h
   AGEmotionSetup.cpp
   AGEmotionSetup.h
   AppearancePage.cpp
   AppearancePage.h
   atlctrlxp.h
   BarShader.cpp
   BarShader.h
   BrowserFrame.cpp
   BrowserFrame.h
   Bumped.cpp
   Bumped.h
   ChatCtrl.cpp
   ChatCtrl.h
   CommandDlg.cpp
   CommandDlg.h
   DebugFrame.cpp
   DebugFrame.h
   DimEdit.h
   DirectoryListingFrm.cpp
   DirectoryListingFrm.h
   DownloadPage.cpp
   DownloadPage.h
   EmoticonsDlg.cpp
   EmoticonsDlg.h
   ExListViewCtrl.cpp
   ExListViewCtrl.h
   ExtendedTrace.cpp
   ExtendedTrace.h
   FavHubProperties.cpp
   FavHubProperties.h
   FavoriteDirsPage.cpp
   FavoriteDirsPage.h
   FavoritesFrm.cpp
   FavoritesFrm.h
   FilterPage.cpp
   FilterPage.h
   FilterPageDlg.h
   FinishedFrame.cpp
   FinishedFrame.h
   FinishedULFrame.cpp
   FinishedULFrame.h
   FlatTabCtrl.h
   FulComboBox.cpp
   FulComboBox.h
   FulTabsPage.cpp
   FulTabsPage.h
   GeneralPage.cpp
   GeneralPage.h
   HashProgressDlg.h
   HelpSystem.cpp
   HelpSystem.h
   HubFrame.cpp
   HubFrame.h
   IgnoreFrame.cpp
   IgnoreFrame.h
   ImageDataObject.cpp
   ImageDataObject.h
   iTunesCOMInterface.h
   iTunesCOMInterface_i.c
   LineDlg.cpp
   LineDlg.h
   ListViewArrows.h
   LogPage.cpp
   LogPage.h
   MagnetDlg.h
   main.cpp
   MainFrm.cpp
   MainFrm.h
   McAdvancedPage.cpp
   McAdvancedPage.h
   McDCPage.cpp
   McDCPage.h
   memdc.h
   NetworkPage.cpp
   NetworkPage.h
   NotepadFrame.cpp
   NotepadFrame.h
   NotepadFrame2.cpp
   NotepadFrame2.h
   OMenu.cpp
   OMenu.h
   OperaColorsPage.cpp
   OperaColorsPage.h
   picturewindow.h
   PopupDlg.h
   PopupManager.cpp
   PopupManager.h
   Popups.cpp
   Popups.h
   PreviewDlg.cpp
   PreviewDlg.h
   PreviewPage.cpp
   PreviewPage.h
   PrivateFrame.cpp
   PrivateFrame.h
   PropertiesDlg.cpp
   PropertiesDlg.h
   PropPage.cpp
   PropPage.h
   PropPageTextStyles.cpp
   PropPageTextStyles.h
   PublicHubsFrm.cpp
   PublicHubsFrm.h
   PublicHubsListDlg.h
   QueueFrame.cpp
   QueueFrame.h
   QueuePage.cpp
   QueuePage.h
   RecentsFrm.cpp
   RecentsFrm.h
   resource.h
   SearchFrm.cpp
   SearchFrm.h
   SecurityPage.cpp
   SecurityPage.h
   SingleInstance.h
   Sntp.cpp
   Sntp.h
   Sounds.cpp
   Sounds.h
   SpyFrame.cpp
   SpyFrame.h
   StaticFrm.h
   StatsFrame.cpp
   StatsFrame.h
   stdafx.cpp
   stdafx.h
   SystemFrame.cpp
   SystemFrame.h
   TextFrame.cpp
   TextFrame.h
   ThemesPage.cpp
   ThemesPage.h
   things.cpp
   things.h
   ToolbarPage.cpp
   ToolbarPage.h
   TransferView.cpp
   TransferView.h
   TreePropertySheet.cpp
   TreePropertySheet.h
   TypedListViewCtrl.h
   UCHandler.h
   UCPage.cpp
   UCPage.h
   UlcPage.cpp
   UlcPage.h
   UploadPage.cpp
   UploadPage.h
   UploadQueueFrame.cpp
   UploadQueueFrame.h
   UPnP.cpp
   UPnP.h
   UserInfo.cpp
   UserInfo.h
   UsersFrame.cpp
   UsersFrame.h
   Winamp.h
   WinampFrame.cpp
   WinampFrame.h
   WindowsPage.cpp
   WindowsPage.h
   WinUtil.cpp
   WinUtil.h

/*
 * Copyright (C) 2001-2006 Jacek Sieka, arnetheduck on gmail point 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.
 */

/*
 * Automatic Directory Listing Search
 * Henrik Engstrm, henrikengstrom on home point se
 */

#if !defined(ADL_SEARCH_FRAME_H)
#define ADL_SEARCH_FRAME_H

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "FlatTabCtrl.h"
#include "ExListViewCtrl.h"
#include "WinUtil.h"

#include "../client/ADLSearch.h"

#define ADLLIST_MESSAGE_MAP 6

///////////////////////////////////////////////////////////////////////////////
//
//	Class that represent an ADL search manager interface
//
///////////////////////////////////////////////////////////////////////////////
class ADLSearchFrame : public MDITabChildWindowImpl<ADLSearchFrame>, public StaticFrame<ADLSearchFrame, ResourceManager::ADL_SEARCH, IDC_FILE_ADL_SEARCH>, 
	private SettingsManagerListener
{
public:

	// Base class typedef
	typedef MDITabChildWindowImpl<ADLSearchFrame> baseClass;

	// Constructor/destructor
	ADLSearchFrame() : closed(false), listContainer(WC_LISTBOX, this, ADLLIST_MESSAGE_MAP) { }
	virtual ~ADLSearchFrame() { }

	// Frame window declaration
	DECLARE_FRAME_WND_CLASS_EX(_T("ADLSearchFrame"), IDR_ADLSEARCH, 0, COLOR_3DFACE);

	// Inline message map
	BEGIN_MSG_MAP(ADLSearchFrame)
		MESSAGE_HANDLER(WM_CREATE, onCreate)
		MESSAGE_HANDLER(WM_CLOSE, onClose)
		MESSAGE_HANDLER(WM_CTLCOLOREDIT, onCtlColor)
		MESSAGE_HANDLER(WM_CTLCOLORSTATIC, onCtlColor)
		MESSAGE_HANDLER(WM_CONTEXTMENU, onContextMenu)
		MESSAGE_HANDLER(WM_HELP, onHelpKey)
		COMMAND_ID_HANDLER(IDC_ADD, onAdd)
		COMMAND_ID_HANDLER(IDC_EDIT, onEdit)
		COMMAND_ID_HANDLER(IDC_REMOVE, onRemove)
		COMMAND_ID_HANDLER(IDC_HELP_FAQ, onHelpButton)
		COMMAND_ID_HANDLER(IDC_MOVE_UP, onMoveUp)
		COMMAND_ID_HANDLER(IDC_MOVE_DOWN, onMoveDown)
		COMMAND_ID_HANDLER(IDC_FIND, onFind)
		NOTIFY_HANDLER(IDC_ADLLIST, NM_DBLCLK, onDoubleClickList)
		NOTIFY_HANDLER(IDC_ADLLIST, LVN_ITEMCHANGED, onItemChanged)
		NOTIFY_HANDLER(IDC_ADLLIST, NM_CUSTOMDRAW, onCustomDraw)
		NOTIFY_HANDLER(IDC_ADLLIST, LVN_GETINFOTIP, ctrlList.onInfoTip)
		CHAIN_MSG_MAP(baseClass)
	ALT_MSG_MAP(ADLLIST_MESSAGE_MAP)
		MESSAGE_HANDLER(WM_KEYDOWN, onChar)
	END_MSG_MAP()

	// Message handlers
	LRESULT onCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
	LRESULT onClose(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled);
	LRESULT onAdd(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
	LRESULT onEdit(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
	LRESULT onRemove(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
	LRESULT onHelpButton(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
	LRESULT onHelpKey(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
	LRESULT onMoveUp(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
	LRESULT onMoveDown(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
	LRESULT onDoubleClickList(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
	LRESULT onItemChanged(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/);
	LRESULT onContextMenu(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled);
	LRESULT onChar(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled);
	LRESULT onCustomDraw(int /*idCtrl*/, LPNMHDR pnmh, BOOL& bHandled);
	LRESULT onFind(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
	
	// Update colors
	LRESULT onCtlColor(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) {
		HWND hWnd = (HWND)lParam;
		HDC hDC   = (HDC)wParam;
		if(hWnd == ctrlList.m_hWnd) {
			::SetBkColor(hDC, WinUtil::bgColor);
			::SetTextColor(hDC, WinUtil::textColor);
			return (LRESULT)WinUtil::bgBrush;
		}
		bHandled = FALSE;
		return FALSE;
	}

	// Update control layouts
	void UpdateLayout(BOOL bResizeBars = TRUE);
	
private:

	// Communication with manager
	void LoadAll();
	void UpdateSearch(int index, BOOL doDelete = TRUE);

	// Contained controls
	CStatusBarCtrl ctrlStatus;
	ExListViewCtrl ctrlList;
	CButton ctrlAdd;
	CButton ctrlEdit;
	CButton ctrlRemove;
	CButton ctrlMoveUp;
	CButton ctrlMoveDown;
	CButton ctrlHelp;
	CButton ctrlFind; // iDC++
	OMenu contextMenu;
	CContainedWindow listContainer;

	bool closed;

	// Column order
	enum 
	{
		COLUMN_FIRST = 0,
		COLUMN_ACTIVE_SEARCH_STRING = COLUMN_FIRST,
		COLUMN_SOURCE_TYPE,
		COLUMN_DEST_DIR,
		COLUMN_MIN_FILE_SIZE,
		COLUMN_MAX_FILE_SIZE,
		COLUMN_LAST
	};

	// Column parameters
	static int columnIndexes[];
	static int columnSizes[];
	virtual void on(SettingsManagerListener::Save, SimpleXML* /*xml*/) throw();
};

#endif // !defined(ADL_SEARCH_FRAME_H)

/**
 * @file
 * $Id: ADLSearchFrame.h 109 2006-10-31 03:21:46Z crakter $
 */

About Koders | Resources | Downloads | Support | Black Duck | Terms of Service | DMCA | Privacy Policy | Contact Us