A
download ChatCtrl.h
Language: C++
License: GPL
Copyright: (C) 2002-2005 Petr Kozelka, PPK at seznam dot cz
LOC: 48
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) 2002-2005 Petr Kozelka, PPK at seznam dot cz
 *
 * 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 CHAT_CTRL_H
#define CHAT_CTRL_H

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

#include "atlstr.h"
#include "TypedListViewCtrl.h"
#include "ImageDataObject.h"
#include "../client/Client.h"
#include "UserInfo.h"

#ifndef _RICHEDIT_VER
#define _RICHEDIT_VER 0x0300
#endif

#include <AtlCrack.h>

class UserInfo;

class ChatCtrl: public CRichEditCtrl {
protected:
	LRESULT OnSize(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);

	IRichEditOle* GetIRichEditOle() const;

	TypedListViewCtrl<UserInfo, IDC_USERS> *m_pUsers;
	bool m_boAutoScroll, myMess;
	TCHAR *g_BufTemp, *beforeAppendText, *afterAppendText;
	int g_BufTemplen, AppendTextlen;
public:
	ChatCtrl();
	virtual ~ChatCtrl();

	LRESULT OnRButtonDown(POINT pt);

	bool HitNick(POINT p, CAtlString *sNick, int *piBegin = NULL, int *piEnd = NULL);
	bool HitIP(POINT p, CAtlString *sIP, int *piBegin = NULL, int *piEnd = NULL);
	bool HitURL();
	bool GetAutoScroll();

	string LineFromPos(POINT p);

	void AdjustTextSize(LPCTSTR lpstrTextToAdd = _T(""));
	void AppendText(LPCTSTR sMyNick, LPCTSTR sTime, LPCTSTR sMsg, CHARFORMAT2& cf, LPCTSTR sAuthor = _T(""), int iAuthorLen = 0, bool isMe = false, bool bUseEmo = true);
	void AppendTextOnly(LPCTSTR sMyNick, LPCTSTR sTime, LPCTSTR sMsg, CHARFORMAT2& cf, LPCTSTR sAuthor = _T(""));
	void EndRedrawAppendTextOnly();

	void GoToEnd();
	void SetAutoScroll(bool boAutoScroll);
	void SetUsers(TypedListViewCtrl<UserInfo, IDC_USERS> *pUsers = NULL);
	void SetTextStyleMyNick(CHARFORMAT2 ts) { WinUtil::m_TextStyleMyNick = ts; };
	static tstring sSelectedLine;
	static tstring sSelectedIP;
	static tstring sTempSelectedUser;

#ifdef DEBUG
	//used to dump the chatbuffer to a file
	void	Dump();
#endif // DEBUG
};


#endif // CHAT_CTRL_H

/**
 * @file
 * $Id: ChatCtrl.h 93 2006-03-06 23:48:13Z crakter $
 */

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