亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? cbmpmenu.cpp

?? 桌面臺球3D 開發環境VC 庫DIRECTX8.1以上
?? CPP
?? 第 1 頁 / 共 3 頁
字號:
//********************************************************
//                                                            
//	FILENAME	: CBmpMenu.cpp
//	CONTENTS	: Defines the class behaviors for the CBmpMenu class.
//
//  Copyright (c), 1999-2000.					  
//	All rights reserved									  
//                                                        
//  Author(s):  Dipti Deogade
//                                                        
//*********************************************************

//** REVISION LIST ****************************************
//				 										  
// Number	Date		Author		Description
//
//
//*********************************************************

#include "stdafx.h"
#include "CBmpMenu.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CBmpMenu
// constructor

CBmpMenu::CBmpMenu(int nBitmapW, BOOL bShowBmp4SubMenu, HBITMAP hBitmap, BOOL bStretchBmp)
{
	//check if hbitmap is a valid handle
	BITMAP bitmap;
	if(GetObject(hBitmap, sizeof(bitmap), &bitmap))
	{
		m_hBitmap   = hBitmap;
	}
	else
	{
		m_hBitmap	= NULL;
	}

	//initialize internal data
	m_bShowBmpAll	= bShowBmp4SubMenu;
	m_pOwnerWnd		= m_pToolbar = 0;
	m_bSubMenu		= FALSE;
	m_pSubMenuWnd	= 0;
	m_bStretchBmp	= bStretchBmp;
	m_nTBOffSet		= nBitmapW;
}

CBmpMenu::~CBmpMenu()
{
}

IMPLEMENT_DYNAMIC( CBmpMenu, CWnd )

BEGIN_MESSAGE_MAP(CBmpMenu, CWnd)
	//{{AFX_MSG_MAP(CBmpMenu)
	ON_WM_PAINT()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()


/////////////////////////////////////////////////////////////////////////////
// CBmpMenu message handlers

BOOL
CBmpMenu :: Attach( HMENU hMenu )
{
	return CMenu::Attach(hMenu);
}

HMENU
CBmpMenu :: Detach()
{
	return CMenu::Detach();
}


BOOL CBmpMenu::DestroyWindow() 
{
	//Send WM_EXITMENULOOP to the owner window
	m_pOwnerWnd->SendMessage(WM_EXITMENULOOP, FALSE);

	//destroy the current window and set focus to parent if parent is of the same class
	if(::IsWindow(GetParent()->GetSafeHwnd()) && 
		GetParent()->IsKindOf(RUNTIME_CLASS(CBmpMenu)))
	{
		GetParent()->SetFocus();
	}

	return CWnd::DestroyWindow();
}

BOOL
CBmpMenu :: TrackPopupMenu( UINT nFlags, int x, int y, CWnd* pParentWnd, CRect* pItemRect)
{
	//if this is a main menu, then parent window is same as owner window
	if(!m_bSubMenu)
	{
		m_pOwnerWnd = pParentWnd;
	}

	//Send menu messages to owner window
	if(m_pOwnerWnd && IsWindow(m_pOwnerWnd->m_hWnd))
		m_pOwnerWnd->SendMessage(m_bSubMenu?WM_INITMENUPOPUP:WM_INITMENU, (WPARAM)m_hMenu, 0);
	else
		return FALSE;

	//create the main window...child of this will be a toolbar which acts as a kind of menu
	if(!CreateEx(WS_EX_DLGMODALFRAME|WS_EX_PALETTEWINDOW|WS_EX_CONTROLPARENT
					, 0, 0, WS_POPUP|WS_CLIPSIBLINGS|WS_CLIPCHILDREN|WS_BORDER|WS_CHILD, 
					CRect(0,0,0,0), pParentWnd, 0))
		return FALSE;

	//set the data of parent popup menu
	if(m_bSubMenu)
	{
		((CBmpMenu*)GetParent())->m_pSubMenuWnd = this;
	}

	//create toolbar
	m_pToolbar = new MenuToolBar;

	//We add a custom draw toolbar which will act as a menu
	m_pToolbar->CreateEx(this, TBSTYLE_FLAT|TBSTYLE_LIST|TBSTYLE_CUSTOMERASE|TBSTYLE_WRAPABLE,
							WS_CLIPCHILDREN|CCS_NODIVIDER|CCS_NORESIZE|CCS_NOPARENTALIGN|CBRS_TOOLTIPS);

	//Initialize toolbar data and place the menu window on screen
	InitToolBarData(m_pToolbar, CPoint(x,y), pItemRect);

	//show the menu window without activating it....before that make the owner window as foreground window
	if(!m_bSubMenu)
	{
		m_pOwnerWnd->SetForegroundWindow();
	}
	
	ShowWindow(SW_SHOWNA);	

	//capture keyboard input
	SetFocus();

	//if this is a submenu and user had opened it by pressing right arrow key
	if(m_bSubMenu & MENU_SELECTFIRSTITEM)
	{
		m_pToolbar->SendMessage(TB_SETHOTITEM, 0, 0);
	}

	m_bSubMenu &= ~MENU_SELECTFIRSTITEM;

	//send a notification message to owner
	if(m_pOwnerWnd && IsWindow(m_pOwnerWnd->m_hWnd))
		m_pOwnerWnd->SendMessage(WM_ENTERMENULOOP, (WPARAM)m_hMenu, (LPARAM)m_hWnd);

	//run the modal loop so that the menu window acts as a kind of dialog
	RunModalLoop();

	//delete allocated memory and cleanup other stuff
	Cleanup();

	return TRUE;
}
//wp gives a point on which left mouse button was clicked for the parent menu
void CBmpMenu::PopupSubMenu(WPARAM wp, BOOL bSelectFirstItem)
{
	CPoint point(LOWORD(wp), HIWORD(wp));

	//Get the button on which left mouse button was clicked
	int nBtnIndex = (m_pToolbar->GetToolBarCtrl()).HitTest(&point);
	TBBUTTON tbb;
	(m_pToolbar->GetToolBarCtrl()).GetButton(nBtnIndex, &tbb);

	//Get window rectangle of this button
	CRect rect;
	(m_pToolbar->GetToolBarCtrl()).GetItemRect(nBtnIndex, &rect);
	(m_pToolbar->GetToolBarCtrl()).ClientToScreen(&rect);

	//Construct popup menu
	CBmpMenu oSubMenu(m_bShowBmpAll?m_nTBOffSet:0, m_bShowBmpAll, m_bShowBmpAll?m_hBitmap:0, m_bStretchBmp);
	
	//intialize data of popup menu
	oSubMenu.m_pOwnerWnd = m_pOwnerWnd;

	//When user created an instance of CBmpMenu, automatically a handle was associated with root menu
	//when he called loadMenu or CreatePopupMenu. But we are not doing any of it for submenus..so just attach
	//the menu handle of the submenu to this submenu window

	oSubMenu.Attach(((MENUITEMINFO*)(tbb.dwData))->hSubMenu);

	//Set data to indicate whther first item should be set as a hot item
	oSubMenu.m_bSubMenu = TRUE | bSelectFirstItem;

	//Add the blank space with to get bounds rect of this button in root menu
	rect.left -= m_nTBOffSet;

	//Show the submenu window
	oSubMenu.TrackPopupMenu(0, 0, 0, this, &rect);

	//detach the menu handle
	oSubMenu.Detach();
}

void CBmpMenu::InitToolBarData(CToolBar *pToolBar, CPoint pt, CRect* pItemRect)
{
	//enable tooltips
	pToolBar->EnableToolTips(TRUE);

	//set toolbar buutons bitmap size first. This should be equal to checkmark dimensions
	//button size will be automatically calculated by toolbar
	pToolBar->SendMessage(TB_SETBITMAPSIZE, 0, MAKELPARAM(GetSystemMetrics(SM_CXMENUCHECK), GetSystemMetrics(SM_CYMENUCHECK)));

	//for each menu item...add corrsponding buttons to the toolbar
	for(int i=0; i<(int)GetMenuItemCount(); i++)
	{
		MENUITEMINFO	menuInfo, *pMenuInfo;
		TBBUTTON		buttonInfo;
		char			*pszBuffer;

		//initialize
		menuInfo.cbSize = sizeof(menuInfo);
		menuInfo.fMask = MIIM_CHECKMARKS|MIIM_DATA|MIIM_ID|MIIM_STATE|MIIM_SUBMENU|MIIM_TYPE;
		pszBuffer = new char[MAX_PATH];		//buffer for button text
		menuInfo.cch = MAX_PATH;
		menuInfo.dwTypeData = pszBuffer;
		ZeroMemory(&buttonInfo, sizeof(buttonInfo));

		GetMenuItemInfo(i, &menuInfo, TRUE);
		
		if(menuInfo.dwTypeData == 0)
			delete pszBuffer;

		//store the app defined data pointer
		pMenuInfo = new MENUITEMINFO;
		*pMenuInfo = menuInfo;
		buttonInfo.dwData = (ULONG)pMenuInfo;

		//set button info from menuInfo...default state is enabled
		buttonInfo.fsState = TBSTATE_ENABLED|TBSTATE_WRAP;

		//check if its a separator
		if(menuInfo.fType & MFT_SEPARATOR)
		{
			buttonInfo.fsStyle = TBSTYLE_SEP;
		}

		//check if the menu item is disabled or grayed
		if((menuInfo.fState & MF_GRAYED) || (MF_DISABLED & menuInfo.fState))
			buttonInfo.fsState = 0;

		//set button command id
		buttonInfo.idCommand = menuInfo.wID;

		//add the button
		(pToolBar->GetToolBarCtrl()).AddButtons(1, &buttonInfo);

		//Set button text
		if(menuInfo.dwTypeData)
		{
			pToolBar->SetButtonText(i, pszBuffer);
		}
	}

	//Get the button width and add width of arrow mark to be drawn for popup menus
	int nWidth = LOWORD(pToolBar->GetToolBarCtrl().GetButtonSize());
	nWidth += GetSystemMetrics(SM_CXMENUCHECK);
	//add width for showing arrows for submenus
	pToolBar->GetToolBarCtrl().SetButtonWidth(nWidth, nWidth);

	//set the toolbar button size
	CRect rect1, rect2;

	(pToolBar->GetToolBarCtrl()).GetItemRect(0, &rect1);
	//if all the buttons have dropdown arrow...the toolbar returns extra height equal to one row
	(pToolBar->GetToolBarCtrl()).GetItemRect(GetMenuItemCount()-1, &rect2);

	//set the total toolbar size
	//offset of 3 pixels to either side of the toolbar
	//If another control(bitmap or slider) is to be placed by the side of toolbar then we have to take 
	//into account the width of that control=m_nTBOffSet
	//Also we need to check that this window rect lies in the screen rect
	PositionMenuWindow(pt, pItemRect, CRect(0, 0, rect1.Width()+6+m_nTBOffSet, rect2.bottom-rect1.top+6));

	//place the toolbar window in the menu window
	pToolBar->MoveWindow(m_nTBOffSet, 0, rect1.Width()+6, rect2.bottom-rect1.top+6);

	//Show the toolbar window without activating it
	pToolBar->ShowWindow(SW_SHOWNOACTIVATE);
}


LRESULT CBmpMenu::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam) 
{
	// TODO: Add your specialized code here and/or call the base class
	CWnd*	pWnd = 0;
	BOOL	bFlag = FALSE;

	switch(message)
	{
	case WM_ACTIVATE:
		{
			//Close all menu windows, if another window is being activated because of a mouse click outside menu window
			CWnd oWnd;
			if(lParam && IsWindow(HWND(lParam)) && (LOWORD(wParam) == WA_INACTIVE))
				if(!oWnd.FromHandle(HWND(lParam))->IsKindOf(RUNTIME_CLASS(CBmpMenu)))
					DestroyRootMenu();

			if(!lParam)
				DestroyRootMenu();

			return 0L;
		}
		break;

	case WM_SYSKEYDOWN:
		//destroy root menu when alt or any syskey is pressed
		DestroyRootMenu();
		break;

	case WM_KEYDOWN:
		//pass the keydown event to toolbar
		//If a submenu is being shown for this menu, then key down should be handled by submenu window
		//else pass it to toolbar
		if(m_pSubMenuWnd)
			m_pSubMenuWnd->SendMessage(WM_KEYDOWN, wParam, lParam);
		else
			m_pToolbar->SendMessage(WM_KEYDOWN, wParam, lParam);
		return 0L;

	case WM_RESETDATA:
		//User defined message to be sent to toolbar to reinitialize internal data
		m_pToolbar->SendMessage(WM_RESETDATA, 0, 0);
		return 0L;

	case WM_COMMAND:
		//pass on control specific messages(if any) to owner window
		m_pOwnerWnd->PostMessage(WM_COMMAND, wParam, lParam);
		return 0L;

	case WM_POPUPSUBMENU:
		//popup the submenu
		PopupSubMenu(wParam, lParam);
		return 0L;
	}

	return CWnd::DefWindowProc(message, wParam, lParam);
}

//destroys all menu window
void CBmpMenu::DestroyRootMenu()
{
	if(m_hWnd && IsWindow(m_hWnd))
	{
		CWnd *pParent = GetParent();

		if(pParent && IsWindow(pParent->m_hWnd))
		{
			if(pParent->IsKindOf(RUNTIME_CLASS(CBmpMenu)))
				((CBmpMenu*)pParent)->DestroyRootMenu();	
		}

		if(m_hWnd && IsWindow(m_hWnd))
		{
			DestroySubMenus();

			//end the modal loop started using RunModalLoop in TrackPopupMenu function
			EndModalLoop(0);

			m_pSubMenuWnd = 0;
		}
	}
}

//destroy all the submenu window associated with this menu
void CBmpMenu::DestroySubMenus()
{
	if(m_pSubMenuWnd)
	{
		m_pSubMenuWnd->DestroySubMenus();

		//end the modal loop started using RunModalLoop in TrackPopupMenu function
		m_pSubMenuWnd->EndModalLoop(0);

		m_pSubMenuWnd = 0;
	}
}

void CBmpMenu::Cleanup()
{
	//remove all allocated memory
	if(m_pToolbar && IsWindow(m_pToolbar->m_hWnd))
	{
		for(int i = 0; i<(m_pToolbar->GetToolBarCtrl()).GetButtonCount(); i++)
		{
			TBBUTTON tbb;
			(m_pToolbar->GetToolBarCtrl()).GetButton(i, &tbb);
			if(tbb.dwData)
			{
				if(((MENUITEMINFO*)(tbb.dwData))->dwTypeData)
					delete (char*)(((MENUITEMINFO*)(tbb.dwData))->dwTypeData);
				delete (MENUITEMINFO*)(tbb.dwData);
				tbb.dwData = 0;
			}
		}

		//destroy our windows
		m_pToolbar->DestroyWindow();
		delete m_pToolbar;
		m_pToolbar = 0;
	}

	if(IsWindow(m_hWnd))
		DestroyWindow();
}

BOOL CBmpMenu::PreCreateWindow(CREATESTRUCT& cs) 
{
	// TODO: Add your specialized code here and/or call the base class

	BOOL bRet = CWnd::PreCreateWindow(cs);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91一区一区三区| 91丨九色丨尤物| 久久欧美一区二区| av电影在线观看完整版一区二区| 亚洲精品你懂的| 日韩欧美一二三四区| 久久不见久久见中文字幕免费| 国产免费久久精品| 国产精品一区二区x88av| 18成人在线视频| 欧美r级在线观看| 国产成人在线色| 亚洲成av人片在线观看| 亚洲精品一区二区三区精华液 | 99久久综合狠狠综合久久| 亚洲午夜精品在线| 欧美一级一区二区| 99热精品国产| 国产一区美女在线| 亚洲一区二区三区美女| 日韩精品一区在线观看| 91九色02白丝porn| 粉嫩aⅴ一区二区三区四区 | 国产精品日日摸夜夜摸av| 色乱码一区二区三区88| 国产精品一区二区久激情瑜伽| 亚洲福利视频一区二区| 中文成人综合网| 欧美美女网站色| 91一区二区在线| 国产高清不卡二三区| 日本伊人午夜精品| 欧美激情一区在线| 日韩欧美专区在线| 欧美日韩一级视频| 色88888久久久久久影院按摩| 国产一区二区三区最好精华液| 亚洲成人av在线电影| **网站欧美大片在线观看| 久久日一线二线三线suv| 色欧美片视频在线观看| 成人国产一区二区三区精品| 极品美女销魂一区二区三区免费| 亚洲天堂免费在线观看视频| 亚洲国产经典视频| 久久亚洲综合色一区二区三区| 91精品国产aⅴ一区二区| 欧美三级资源在线| 欧美色综合久久| 欧美撒尿777hd撒尿| 日本高清不卡视频| 成人中文字幕合集| 高清成人在线观看| 国产精品2024| 国产成人亚洲精品青草天美| 狠狠色狠狠色合久久伊人| 久久成人综合网| 九一九一国产精品| 九色综合狠狠综合久久| 久久精品久久精品| 国产一区免费电影| 粉嫩欧美一区二区三区高清影视 | 欧美日韩国产小视频| 日本高清不卡一区| 欧美日韩一区二区欧美激情| 在线精品视频一区二区三四| 欧美性videosxxxxx| 欧美午夜电影一区| 91精品综合久久久久久| 日韩小视频在线观看专区| 日韩一区二区免费在线电影| 日韩欧美国产午夜精品| 久久久美女毛片| 日本一区二区三区视频视频| 中文字幕视频一区二区三区久| 精品不卡在线视频| 日本一区二区三区四区在线视频 | 美腿丝袜在线亚洲一区| 国产xxx精品视频大全| 一本久久a久久精品亚洲| 欧美一区二区三区在线观看| 中文成人av在线| 三级亚洲高清视频| 成人久久18免费网站麻豆 | 亚洲欧美日韩系列| 男人的天堂亚洲一区| 国产suv一区二区三区88区| 欧美丝袜丝nylons| 国产婷婷色一区二区三区四区| 亚洲午夜在线电影| 成人综合婷婷国产精品久久蜜臀| 精品视频色一区| 国产精品无遮挡| 久久激五月天综合精品| 在线一区二区三区| 国产欧美精品一区aⅴ影院 | 波多野结衣欧美| 日韩三级电影网址| 一区二区三区四区蜜桃| 国产精品自产自拍| 91精品国产综合久久精品app| 国产精品国模大尺度视频| 久久精品国产在热久久| 欧美日韩一区二区三区在线看| 中文字幕精品三区| 久久99热狠狠色一区二区| 欧美天堂一区二区三区| 亚洲欧洲精品一区二区三区不卡| 青草国产精品久久久久久| 欧美亚洲国产一区二区三区| 国产精品久久久久一区| 蜜臀国产一区二区三区在线播放| 97久久精品人人做人人爽50路| 久久亚洲精品小早川怜子| 日本系列欧美系列| 欧美系列日韩一区| 亚洲精品国产a久久久久久 | 91国产精品成人| 国产精品麻豆网站| 国产99一区视频免费| 精品成人免费观看| 久久国产精品99久久久久久老狼| 欧美丰满少妇xxxbbb| 一区二区三区四区蜜桃| 91免费观看视频| 亚洲同性gay激情无套| 99re这里都是精品| 最新高清无码专区| 99视频在线精品| 日韩久久一区二区| 91尤物视频在线观看| 国产精品久久精品日日| 99久久久精品免费观看国产蜜| 国产三级久久久| 国产a久久麻豆| 国产精品久久免费看| 盗摄精品av一区二区三区| 亚洲国产成人在线| av电影在线观看一区| 亚洲六月丁香色婷婷综合久久| av成人免费在线| 亚洲情趣在线观看| 欧美性一级生活| 日韩中文字幕av电影| 日韩一区二区电影| 国产精品一区二区无线| 欧美极品少妇xxxxⅹ高跟鞋| gogogo免费视频观看亚洲一| 亚洲精品成人悠悠色影视| 国产99久久精品| 亚洲精品videosex极品| 88在线观看91蜜桃国自产| 美国十次了思思久久精品导航| 久久亚洲精品小早川怜子| 成人丝袜视频网| 一区二区三区四区中文字幕| 欧美精品自拍偷拍| 国产一区二区网址| 亚洲图片激情小说| 欧美片在线播放| 国精产品一区一区三区mba桃花 | 日韩一区二区三区免费看 | 欧美三级三级三级| 久久国产精品99久久人人澡| 日韩欧美专区在线| 91麻豆精品国产91久久久久| 韩国女主播一区二区三区| 国产一区二区三区精品视频| 国产不卡视频在线播放| 国产麻豆精品久久一二三| 国内精品国产三级国产a久久| 美腿丝袜在线亚洲一区| 最新国产の精品合集bt伙计| 精品国产亚洲在线| 亚洲综合无码一区二区| 久久成人免费日本黄色| 九色综合国产一区二区三区| 成人午夜碰碰视频| 国产精品一区二区免费不卡| 成人av免费在线播放| 欧美一区二区三区在线观看| 2022国产精品视频| 亚洲一卡二卡三卡四卡| 精品一区二区综合| 欧美色视频在线| 一区二区三区欧美激情| 国产一区激情在线| 欧美大片一区二区| 麻豆精品一区二区| 欧美一区二区福利视频| 亚洲第一主播视频| 欧美日本在线观看| 午夜精品久久久久久久久久久| 成人性生交大片免费看视频在线 | 自拍视频在线观看一区二区| 成人精品在线视频观看| 欧美一级国产精品| 五月激情综合网| 欧美高清dvd| 麻豆久久久久久久|