// Copyright (c) Iuri Apollonio 1998
// Use & modify as you want & need, and leave those 3 lines.
// http://www.codeguru.com
// GfxOutBarCtrl.cpp : implementation file
//
#include "stdafx.h"
#include "resource.h"//"OutWAts1.h"
#include "GfxOutBarCtrl.h"
#include "GfxGroupEdit.h"
#include "GfxPopupMenu.h"
#define _ID_GFX_SMALLICON "小图标方式"
#define _ID_GFX_LARGEICON "大图标方式"
#define _ID_GFX_ADDAGROUP "添加组"
#define _ID_GFX_FONTCOLOR "改变字体颜色"
#define _ID_GFX_BACKCOLOR "改变背景颜色"
#define _ID_GFX_REMOVEITEM "从该组中删除"
#define _ID_GFX_RENAMEITEM "改名"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CGfxOutBarCtrl
IMPLEMENT_DYNCREATE(CGfxOutBarCtrl, CWnd)
CGfxOutBarCtrl::CGfxOutBarCtrl()
{
crBackGroundColor = GetSysColor(COLOR_BACKGROUND);//RGB(0,128,128);//
crBackGroundColor1 = GetSysColor(COLOR_BACKGROUND);
crTextColor = GetSysColor(COLOR_WINDOW);
cr3dFace = GetSysColor(COLOR_3DFACE);
crLightBorder = GetSysColor(COLOR_3DLIGHT);
crHilightBorder = GetSysColor(COLOR_3DHILIGHT);
crShadowBorder = GetSysColor(COLOR_3DSHADOW);
crDkShadowBorder = GetSysColor(COLOR_3DDKSHADOW);
pBlackPen = new CPen(PS_SOLID, 1, RGB(0,0,0));
iFolderHeight = 22;
dwFlags = fDragItems|fEditGroups|fEditItems|fRemoveGroups|fRemoveItems|fAddGroups|fAnimation|fSelHighlight;
iSelFolder = 1;
iLastFolderHighlighted = -1;
iLastSelectedFolder = -1;
pLargeImageList = NULL;
pSmallImageList = NULL;
iFirstItem = 0;
xSmallIconLabelOffset = 4;
yLargeIconLabelOffset = 3;
ySmallIconSpacing = 10;
yLargeIconSpacing = 8;
xLeftMargin = 5;
yTopMargin = 5;
bUpArrow = bDownArrow = false;
hHandCursor = AfxGetApp()->LoadCursor(IDC_HANDCUR);
rcUpArrow = rcDownArrow = CRect(0,0,0,0);
bUpPressed = bDownPressed = false;
bLooping = false;
iLastItemHighlighted = -1;
bPressedHighlight = false;
iLastDragItemDraw = -1;
lAnimationTickCount = 10;
hDragCursor = AfxGetApp()->LoadCursor(IDC_DRAGGING);
hNoDragCursor = AfxGetApp()->LoadCursor(IDC_NODRAGGING);
iLastSel = -1;
iSelAnimCount = 0;
iSelAnimTiming = 0;
}
CGfxOutBarCtrl::~CGfxOutBarCtrl()
{
for (int t = 0; t < arFolder.GetSize(); t++)
{
if (arFolder.GetAt(t)) delete (CBarFolder*) arFolder.GetAt(t);
}
arFolder.RemoveAll();
delete pBlackPen;
}
BEGIN_MESSAGE_MAP(CGfxOutBarCtrl, CWnd)
//{{AFX_MSG_MAP(CGfxOutBarCtrl)
ON_WM_CREATE()
ON_WM_TIMER()
ON_WM_PAINT()
ON_WM_ERASEBKGND()
ON_WM_MOUSEMOVE()
ON_WM_LBUTTONDOWN()
ON_WM_SETCURSOR()
ON_WM_SIZE()
ON_WM_RBUTTONDOWN()
ON_COMMAND(ID_GFX_LARGEICON, OnGfxLargeicon)
ON_UPDATE_COMMAND_UI(ID_GFX_LARGEICON, OnUpdateGfxLargeicon)
ON_COMMAND(ID_GFX_SMALLICON, OnGfxSmallicon)
ON_UPDATE_COMMAND_UI(ID_GFX_SMALLICON, OnUpdateGfxSmallicon)
ON_COMMAND(ID_GFX_REMOVEITEM, OnGfxRemoveitem)
ON_UPDATE_COMMAND_UI(ID_GFX_REMOVEITEM, OnUpdateGfxRemoveitem)
ON_COMMAND(ID_GFX_RENAMEITEM, OnGfxRenameitem)
ON_UPDATE_COMMAND_UI(ID_GFX_RENAMEITEM, OnUpdateGfxRenameitem)
ON_COMMAND(ID_GFX_GROUPICON, OnGfxGroupicon)
ON_COMMAND(ID_GFX_BACKCICON, OnGfxBackcicon)
ON_COMMAND(ID_GFX_FONTCICON, OnGfxFontcicon)
//}}AFX_MSG_MAP
ON_MESSAGE(WM_OUTBAR_NOTIFY, OnEndLabelEdit)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CGfxOutBarCtrl message handlers
long CGfxOutBarCtrl::OnEndLabelEdit(WPARAM wParam, LPARAM lParam)
{
if (wParam == NM_OB_ONGROUPENDEDIT)
{
CGfxGroupEdit * pEdit = (CGfxGroupEdit *) lParam;
OUTBAR_INFO ob;
ob.index = pEdit->iIndex;
ob.cText = pEdit->text;
if (GetOwner()->SendMessage(WM_OUTBAR_NOTIFY, NM_OB_ONGROUPENDEDIT, (LPARAM) &ob))
{
SetFolderText(pEdit->iIndex, pEdit->text);
CRect rc;
GetFolderRect(pEdit->iIndex, rc);
InvalidateRect(rc, false);
}
}
if (wParam == NM_OB_ONLABELENDEDIT)
{
CGfxGroupEdit * pEdit = (CGfxGroupEdit *) lParam;
OUTBAR_INFO ob;
ob.index = pEdit->iIndex;
ob.cText = pEdit->text;
if (GetOwner()->SendMessage(WM_OUTBAR_NOTIFY, NM_OB_ONLABELENDEDIT, (LPARAM) &ob))
{
SetItemText(pEdit->iIndex, pEdit->text);
CRect rc;
GetInsideRect(rc);
InvalidateRect(rc, true);
}
}
return 0;
}
void CGfxOutBarCtrl::SetFolderText(const int index, const char * text)
{
ASSERT(index >= 0 && index < GetFolderCount());
CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(index);
if (pbf->cName)
{
delete [] pbf->cName;
pbf->cName = NULL;
}
pbf->cName = new char [lstrlen(text)+1];
lstrcpy(pbf->cName, text);
}
void CGfxOutBarCtrl::SetItemText(const int index, const char * text)
{
ASSERT(iSelFolder >= 0 && iSelFolder < GetFolderCount());
CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(iSelFolder);
CBarItem * pi = (CBarItem *) pbf->arItems.GetAt(index);
if (pi->cItem)
{
delete [] pi->cItem;
pi->cItem = NULL;
}
pi->cItem = new char [lstrlen(text)+1];
lstrcpy(pi->cItem, text);
}
BOOL CGfxOutBarCtrl::Create(DWORD dwStyle, const RECT & rect, CWnd * pParentWnd, UINT nID, const DWORD dwFlag)
{
dwFlags = dwFlag;
return CWnd::CreateEx(WS_EX_STATICEDGE, NULL, NULL, dwStyle|WS_CHILD, rect, pParentWnd, nID);
//GFXOUTBARCTRL_CLASSNAME
}
bool CGfxOutBarCtrl::IsSmallIconView() const
{
return dwFlags&fSmallIcon;
}
void CGfxOutBarCtrl::SetSmallIconView(const bool bSet)
{
iFirstItem = 0;
if (bSet)
{
if (!IsSmallIconView())
{
dwFlags |= fSmallIcon;
CRect rc;
GetInsideRect(rc);
InvalidateRect(rc, false);
}
}
else
{
if (IsSmallIconView())
{
dwFlags &= ~fSmallIcon;
CRect rc;
GetInsideRect(rc);
InvalidateRect(rc, false);
}
}
}
DWORD CGfxOutBarCtrl::GetFlag() const
{
return dwFlags;
}
void CGfxOutBarCtrl::ModifyFlag(const DWORD & dwRemove, const DWORD & dwAdd, const UINT redraw)
{
if (dwRemove) dwFlags &= ~(dwRemove);
if (dwAdd) dwFlags |= dwAdd;
if (GetSafeHwnd())
{
if (redraw != 0) SetWindowPos(0,0,0,0,0,SWP_NOZORDER|SWP_NOSIZE|SWP_NOMOVE|redraw);
else Invalidate();
}
}
int CGfxOutBarCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CWnd::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
return 0;
}
void CGfxOutBarCtrl::OnTimer(UINT nIDEvent)
{
if (nIDEvent == 1)
{
CPoint pt(GetMessagePos());
ScreenToClient(&pt);
CRect rc;
GetClientRect(&rc);
if (!(rc.PtInRect(pt)))
{
HighlightFolder(-1);
HighlightItem(-1);
KillTimer(1);
}
}
else if (nIDEvent == 3 && iLastSel >= 0)
{
iSelAnimCount ++;
if (iSelAnimCount > 10) iSelAnimCount = -1;
if (iSelAnimCount == 0)
DrawAnimItem(-1, 1, iLastSel);
if (iSelAnimCount == 1)
DrawAnimItem(0, 0, iLastSel);
if (iSelAnimCount == 2)
DrawAnimItem(1, 1, iLastSel);
if (iSelAnimCount == 3)
DrawAnimItem(0, 0, iLastSel);
}
else if(nIDEvent==4)
{
GetOwner()->SendMessage(WM_OUTBAR_NOTIFY, NM_OB_ITEMCLICK, iLastSel);
KillTimer(4);
}
CWnd::OnTimer(nIDEvent);
}
void CGfxOutBarCtrl::DrawAnimItem(const int xoffset, const int yoffset, const int index)
{
CImageList * ima = GetFolderImageList(iSelFolder, IsSmallIconView());
CRect rc, irc;
GetInsideRect(irc);
GetItemRect(iSelFolder, iLastSel, rc);
if (iLastSel >= iFirstItem && irc.bottom > rc.bottom && irc.top < rc.top)
{
ASSERT(iSelFolder >= 0 && iSelFolder < GetFolderCount());
CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(iSelFolder);
ASSERT(index >= 0 && index < pbf->GetItemCount());
CBarItem * pi = (CBarItem *) pbf->arItems.GetAt(index);
ASSERT(pi && ima);
CClientDC dc(this);
if (IsSmallIconView())
{
if (ima)
{
IMAGEINFO ii;
ima->GetImageInfo(pi->iImageIndex, &ii);
没有合适的资源?快使用搜索试试~ 我知道了~
带客户端和服务器端的即时通信
共160个文件
h:42个
cpp:42个
ico:41个
需积分: 10 20 下载量 192 浏览量
2010-12-09
08:34:10
上传
评论
收藏 178KB RAR 举报
温馨提示
即时通信功能、带客户端和服务器端。在局域网上不使用服务器的通讯软件,这种软件小巧且方便,也能解决一部分问题。但是有服务器的通讯软件,有着不可比拟的优势:可以发送离线消息,不管用户当时是否在线,下次上线时,就可以看到这条消息了。
资源推荐
资源详情
资源评论
收起资源包目录
带客户端和服务器端的即时通信 (160个子文件)
LargeIcon.bmp 8KB
SmallIcon.bmp 3KB
Toolbar.bmp 1KB
find1.bmp 1KB
find2.bmp 1KB
bmp382.bmp 1KB
quit.bmp 1KB
bmp573.bmp 1KB
mess_man.bmp 1KB
Toolbar.bmp 1KB
toolbar1.bmp 1KB
toolbar3.bmp 886B
bmp476.bmp 540B
help.bmp 540B
sys_setu.bmp 512B
toolbar2.bmp 502B
find.bmp 246B
person_s.bmp 224B
message.bmp 224B
bmp682.bmp 198B
bmp684.bmp 198B
bmp683.bmp 198B
Client.clw 17KB
Server.clw 4KB
GfxOutBarCtrl.cpp 59KB
RecvData.cpp 34KB
MainFrm.cpp 26KB
Msg.cpp 20KB
Msg.cpp 20KB
GfxPopupMenu.cpp 14KB
Client.cpp 11KB
Server.cpp 10KB
ModifyPIDlg.cpp 8KB
RegisterDlg.cpp 8KB
SearchDlg.cpp 7KB
ShowOnlineDlg.cpp 7KB
FriendDetail.cpp 6KB
ShowBroadcastDlg.cpp 6KB
Socket.cpp 6KB
TalkDlg.cpp 6KB
LookDlg.cpp 6KB
MultiSendDlg.cpp 5KB
LoginDlg.cpp 5KB
SetupDlg.cpp 4KB
AddFriendDlg.cpp 4KB
ClientSocket.cpp 4KB
BmpComBox.cpp 4KB
MainFrm.cpp 3KB
SendBroadcastDlg.cpp 3KB
GfxGroupEdit.cpp 3KB
SendToAllDlg.cpp 3KB
TrayIcon.cpp 3KB
ServerView.cpp 3KB
TrayIcon.cpp 2KB
ChangePwd.cpp 2KB
CheckOnline.cpp 2KB
BmpButton.cpp 2KB
ServerDoc.cpp 2KB
SetupServerDlg.cpp 1KB
Data.cpp 1KB
Data.cpp 1KB
ShowAddMsgDlg.cpp 1KB
RequestFriendDetail.cpp 595B
common.cpp 543B
StdAfx.cpp 208B
StdAfx.cpp 208B
cur1320.cur 326B
icr_hand.cur 326B
cur268.cur 326B
Client.dsp 11KB
Server.dsp 6KB
Server.dsw 537B
Client.dsw 535B
resource.h 9KB
GfxOutBarCtrl.h 8KB
Common.h 5KB
Common.h 4KB
MainFrm.h 4KB
Msg.h 3KB
Msg.h 3KB
Socket.h 3KB
Client.h 2KB
Server.h 2KB
Data.h 2KB
RegisterDlg.h 2KB
ShowOnlineDlg.h 2KB
FriendDetail.h 2KB
ModifyPIDlg.h 2KB
ShowBroadcastDlg.h 2KB
MainFrm.h 2KB
SearchDlg.h 2KB
TalkDlg.h 2KB
LookDlg.h 2KB
GfxPopupMenu.h 2KB
Resource.h 2KB
GfxGroupEdit.h 2KB
ServerView.h 2KB
ClientSocket.h 2KB
AddFriendDlg.h 2KB
LoginDlg.h 2KB
共 160 条
- 1
- 2
资源评论
txj66
- 粉丝: 0
- 资源: 10
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功