예제 #1
0
BOOL CWndMessageBoxUpper::OnChildNotify( UINT message, UINT nID, LRESULT* pLResult )
{
	switch(nID)
	{
		case IDABORT: 
		case IDCANCEL:   
		case IDIGNORE:   
		case IDNO:       
		case IDOK:       
		case IDRETRY:    
		case IDYES:
#ifndef _DEBUG			
			if( m_bPostLogoutMsg )
				::PostMessage( g_Neuz.GetSafeHwnd(), WM_LOGOUT, TRUE, 0 );
#endif
			Destroy(); 
			break;
	}
	
	if( nID == 10000 )
		return TRUE;

	if( GetParentWnd() != m_pWndRoot )
		GetParentWnd()->OnCommand( nID, message, this );

	return CWndNeuz::OnChildNotify( message, nID, pLResult );
}
	virtual void OnDraw (CDC* pDC)
	{
		ASSERT_VALID (pDC);

		CBCGPBaseRibbonElement* pElement = (CBCGPBaseRibbonElement*) m_dwData;
		ASSERT_VALID (pElement);

		CBCGPToolbarMenuButton dummy;

		dummy.m_strText = m_strText;

		CString strValue = pElement->GetText ();

		if (strValue.GetLength () > nMaxValueLen)
		{
			strValue = strValue.Left (nMaxValueLen - 1);
		}

		if (!strValue.IsEmpty ())
		{
			dummy.m_strText += _T('\t');
			dummy.m_strText += strValue;
		}

		dummy.m_bMenuMode = TRUE;
		dummy.m_pWndParent = GetParentWnd ();

		if (pElement->IsVisible ())
		{
			dummy.m_nStyle |= TBBS_CHECKED;
		}

		dummy.OnDraw (pDC, m_rect, NULL, TRUE, FALSE, m_bIsHighlighted);
	}
예제 #3
0
BOOL CWndRepairItemCtrl::OnDropIcon( LPSHORTCUT pShortcut, CPoint point )
{
	int nDstId	= -1;
	CRect rect	= GetClientRect();
	int nWidth	= rect.Width() / 32;
	int nHeight		= rect.Height() / 35;
	CPoint pt( 3, 3 );
	if( pShortcut->m_dwType == ITYPE_ITEM && pShortcut->m_dwData == 0 )
	{
		return TRUE;
	}
	else
	{
		CItemBase* pItemBase = g_pPlayer->GetItemId( pShortcut->m_dwId );
		if( pItemBase )
		{
			for( int i = 0; i < MAX_REPAIRINGITEM; i++ )
			{
				int x	= i % 5;
				int y	= i / 5;
				rect.SetRect( x * 32, y * 32, x * 32 + 32, y * 32 + 32 );

				if( rect.PtInRect( point ) && m_pdwIdRepair[i] == NULL_ID )
				{
					pShortcut->m_dwData		= i + 100;
					CWndBase* pParent	= (CWndBase*)GetParentWnd();
					pParent->OnChildNotify( WIN_ITEMDROP, m_nIdWnd, (LRESULT*)pShortcut );
				}
			}
			return TRUE;
		}
	}
	return TRUE;
}
//**************************************************************************
CWnd* CBCGPRibbonBackstageViewItemPropertySheet::OnCreateFormWnd()
{
	ASSERT_VALID (this);

	CBCGPPropertySheetCtrl* pForm = new CBCGPPropertySheetCtrl;
	if (pForm == NULL)
	{
		ASSERT(FALSE);
		return NULL;
	}

	pForm->EnableVisualManagerStyle();
	pForm->EnableLayout();
	pForm->SetLook(CBCGPPropertySheet::PropSheetLook_List, -1);

	if (m_nIconsListResID != 0)
	{
		pForm->SetIconsList (m_nIconsListResID, m_nIconWidth);
	}

	pForm->m_bBackstageMode = TRUE;
	pForm->m_bIsAutoDestroy = FALSE;

	int nCaptionIndex = 0;

	for (int i = 0; i < (int)m_arPages.GetSize(); i++)
	{
		CBCGPPropertyPage* pPage = m_arPages[i];
		if (pPage == NULL)
		{
			pForm->AddGroup(m_arCaptions[nCaptionIndex++]);
		}
		else
		{
			ASSERT_VALID(pPage);

			pPage->m_pBackstageWatermark = m_WatermarkColorized.GetImageWell() != NULL ? &m_WatermarkColorized : &m_Watermark;
			pForm->AddPage(pPage);
		}
	}

	if (!pForm->Create(GetParentWnd(), WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VISIBLE, 0))
	{
		ASSERT(FALSE);
		delete pForm;
		pForm = NULL;
	}

	CRect rectClient;
	pForm->GetWindowRect(&rectClient);

	m_sizeDlg = rectClient.Size();
	m_sizeDlg.cx += pForm->GetNavBarWidth();

	return pForm;
}
예제 #5
0
void AxWidget::OnProcessMessage( Message& wuiMsg )
{
	if (m_pContainer == NULL || !m_pContainer->IsWindowless())
		return;
	MSG winMsg;
	winMsg.hwnd = GetParentWnd();
	if (!wuiMessageToWinMsg(wuiMsg, winMsg))
		return;
	m_pContainer->OnProcessMessage(winMsg.message, winMsg.wParam, winMsg.lParam);
}
예제 #6
0
    void GridControl::Create(const CRect& rect)
    {
        int nID = GetID();
        CWnd* pParent = GetParentWnd();
        VERIFY(CGridCtrlCell::Create(rect, pParent, nID, NULL, WS_CHILD|WS_VISIBLE));
        TRACE("GridControl %d\r\n", nID);

        AutoSize();
        SetEditMode();
    }
예제 #7
0
BOOL CWndVendorCtrl::OnDropIcon( LPSHORTCUT pShortcut, CPoint point )
{
	int nDstId	= -1;
	CRect rect	= GetClientRect();
	int nWidth	= rect.Width() / 32;
	int nHeight		= rect.Height() / 35;
	CPoint pt( 3, 3 );
	if( pShortcut->m_dwType == ITYPE_ITEM && pShortcut->m_dwData == 0 )
	{
		//		CWndBase* pParent	= (CWndBase*)GetParentWnd();
		//		pParent->OnChildNotify( WIN_ITEMDROP, m_nIdWnd, (LRESULT*)pShortcut );
		return TRUE;
	}
	else
	{
		CItemBase* pItemBase = g_pPlayer->GetItemId( pShortcut->m_dwId );
		if( pItemBase )
		{
#if __VER >= 8 //__S8_VENDOR_REVISION
			for( int i = 0; i < MAX_VENDOR_REVISION; i++ )
#else //__S8_VENDOR_REVISION
			for( int i = 0; i < MAX_VENDITEM; i++ )
#endif //__S8_VENDOR_REVISION
			{
#if __VER >= 8 // __S8_VENDOR_REVISION
				int x	= i % 2;
				int y	= i / 2;
				
				int nX;
				int nY = y * 32 + 8 + y * 4;
				if( x == 0 )
					nX = x * 32 + 15;			
				else
					nX = 235;
				
				rect.SetRect( nX, nY, nX + 180, nY + 32 );
#else // __VER >= 8 // __S8_VENDOR_REVISION
				int x	= i % 6;
				int y	= i / 6;
				rect.SetRect( x * 32 + 7, y * 32 + 11, x * 32 + 32 + 5, y * 32 + 32 + 9 );
#endif // __VER >= 8 // __S8_VENDOR_REVISION
				
				if( rect.PtInRect( point ) && GetItem( i ) == NULL )
				{
					pShortcut->m_dwData		= i + 100;
					CWndBase* pParent	= (CWndBase*)GetParentWnd();
					pParent->OnChildNotify( 100, m_nIdWnd, (LRESULT*)pShortcut );
				}
			}
			return TRUE;
		}
	}
	return TRUE;
}
예제 #8
0
BOOL CWndMessageBox::OnChildNotify( UINT message, UINT nID, LRESULT* pLResult )
{
	switch(nID)
	{
		case IDABORT: 
		case IDCANCEL:   
		case IDIGNORE:   
		case IDNO:       
		case IDOK:       
		case IDRETRY:    
		case IDYES:
			if( _tcscmp( m_wndText.m_string, _T( prj.GetText(TID_DIAG_0035) ) ) == 0 )
				::PostMessage( g_Neuz.GetSafeHwnd(), WM_CLOSE, TRUE, 0 );
			Destroy(); 
			break;
	}
	if( GetParentWnd() != m_pWndRoot )
		GetParentWnd()->OnCommand( nID, message, this );
	return CWndNeuz::OnChildNotify( message, nID, pLResult );
}
//**********************************************************************************
BOOL CBCGPRibbonBackstageViewPanel::OnKey (UINT nChar)
{
	if (!m_rectPageTransition.IsRectEmpty())
	{
		return TRUE;
	}

	if ((nChar == VK_RIGHT || nChar == VK_TAB) && m_pHighlighted != NULL &&
		m_pHighlighted->GetBackstageAttachedView() != NULL)
	{
		CBCGPRibbonBackstageViewItemForm* pForm = DYNAMIC_DOWNCAST(CBCGPRibbonBackstageViewItemForm, m_pHighlighted->GetBackstageAttachedView());
		if (pForm != NULL && pForm->m_pWndForm->GetSafeHwnd() != NULL)
		{
			pForm->m_pWndForm->SetFocus();
			return FALSE;
		}
	}

	if (!CBCGPRibbonMainPanel::OnKey(nChar))
	{
		return FALSE;
	}

	switch (nChar)
	{
	case VK_HOME:
		GetParentWnd()->SetFocus();
		return TRUE;

	case VK_UP:
	case VK_DOWN:
		break;

	default:
		SelectView(m_pHighlighted);
		break;
	}

	GetParentWnd()->SetFocus();
	return TRUE;
}
//*****************************************************************************
void CBCGPRibbonProgressBar::SetPos (int nPos, BOOL bRedraw)
{
	ASSERT_VALID (this);

	m_nPos = min (max (m_nMin, nPos), m_nMax);

	if (bRedraw)
	{
		Redraw ();

		CWnd* pMenu = CBCGPPopupMenu::GetActiveMenu ();

		if (pMenu != NULL && CWnd::FromHandlePermanent (pMenu->GetSafeHwnd ()) != NULL &&
			GetParentWnd () != NULL)
		{
			CRect rectScreen = m_rect;
			GetParentWnd ()->ClientToScreen (&rectScreen);

			CBCGPPopupMenu::UpdateAllShadows (rectScreen);
		}
	}
}
예제 #11
0
BOOL CWndShopCtrl::OnDropIcon( LPSHORTCUT pShortcut, CPoint point )
{
	CWndBase* pWndFrame =  pShortcut->m_pFromWnd->GetFrameWnd();
	if( pWndFrame->GetWndId() != APP_SHOP_ )
		return FALSE;

	if( pShortcut->m_dwShortcut == SHORTCUT_ITEM )
	{
		CItemElem* pItemElem = (CItemElem*)pShortcut->m_dwData;
		DWORD nTempCost = 0;
		if( m_nTabType == 0)
		{
			nTempCost += pItemElem->GetCost();
			nTempCost = static_cast< int >( static_cast< float >( nTempCost ) * prj.m_fShopBuyRate );

			if(CTax::GetInstance()->IsApplyTaxRate( g_pPlayer, pItemElem ))
				nTempCost += ( static_cast<DWORD>(nTempCost * CTax::GetInstance()->GetPurchaseTaxRate( g_pPlayer )) );
		}
		else if( m_nTabType == 1 || m_nTabType == 2 )
			nTempCost += pItemElem->GetChipCost();

		nTempCost = (int)((float)nTempCost * prj.m_fShopCost );
		
		if( pItemElem && pItemElem->m_dwItemId == II_SYS_SYS_SCR_PERIN )
			nTempCost = PERIN_VALUE;

		if( nTempCost > INT_MAX )
			return FALSE;

		for( int i = 0; i < MAX_CART; i++ )
		{
			int x = i % 6;
			int y = i / 6;			
			CRect rectHittest = CRect( x * 35, y * 35 + 3, x * 35 + 35, y * 35 + 35 + 3);
			if( rectHittest.PtInRect( point ) )
			{
				m_nLastPoint = i;
				break;
			}
		}
		CWndBase* pParent = (CWndBase*)GetParentWnd();
		pParent->OnChildNotify( WIN_ITEMDROP, m_nIdWnd, (LRESULT*)pShortcut ); 
		return TRUE;
	}

	return FALSE;
}
//**************************************************************************
CWnd* CBCGPRibbonBackstageViewItemForm::OnCreateFormWnd()
{
	ASSERT_VALID (this);
	ASSERT(m_pDlgClass != NULL);

	CBCGPDialog* pForm = NULL;

	if (m_pDlgClass == RUNTIME_CLASS(CBCGPDialog))
	{
		pForm = new CBCGPDialog;
	}
	else
	{
		pForm = DYNAMIC_DOWNCAST(CBCGPDialog, m_pDlgClass->CreateObject());
	}

	if (pForm == NULL)
	{
		ASSERT(FALSE);
		return NULL;
	}

	CBCGPRibbonBackstagePageRecent* pRecentFrom = DYNAMIC_DOWNCAST(CBCGPRibbonBackstagePageRecent, pForm);
	if (pRecentFrom != NULL)
	{
		pRecentFrom->SetFlags(m_nRecentFlags);
	}

	if (!pForm->Create(m_nDlgTemplateID, GetParentWnd()))
	{
		ASSERT(FALSE);
		delete pForm;
		pForm = NULL;
	}

	pForm->EnableVisualManagerStyle();
	pForm->EnableBackstageMode();
	pForm->m_pBackstageWatermark = m_WatermarkColorized.GetImageWell() != NULL ? &m_WatermarkColorized : &m_Watermark;

	CRect rectClient;
	pForm->GetWindowRect(&rectClient);

	m_sizeDlg = rectClient.Size();

	return pForm;
}
예제 #13
0
void CWndVendorCtrl::OnLButtonDblClk( UINT nFlags, CPoint point )
{
	if( m_pMover == g_pPlayer )
		return;

	int nItem	= HitTest( point );
	if( nItem == -1 )
		return;

	CItemBase* pItemBase	= GetItem( nItem );
	if( pItemBase )
	{
		m_pFocusItem	= pItemBase;
		m_nCurSel	= nItem;
		if( m_pFocusItem )
		{
			CWndVendor* pWndVendor	= (CWndVendor*)GetParentWnd();
			SAFE_DELETE( pWndVendor->m_pWndVendorBuy );
			pWndVendor->m_pWndVendorBuy		= new CWndVendorBuy( pItemBase, nItem );
			pWndVendor->m_pWndVendorBuy->Initialize( pWndVendor, APP_VENDOR_BUY );
//			pParent->OnChildNotify( WIN_DBLCLK, m_nIdWnd, (LRESULT*)m_pFocusItem );
		}
	}
}
예제 #14
0
void CWndGuildVoteSeting::OnInitialUpdate() 
{ 
	CWndNeuz::OnInitialUpdate(); 
	// 여기에 코딩하세요

	if( m_nSelect != -1 )
	{
		//WIDC_EDIT1
		CWndEdit* pEdit;
		CWndComboBox* pCombo = (CWndComboBox*)GetParentWnd()->GetDlgItem(WIDC_COMBOBOX1);

		CString str = pCombo->GetString();

		pEdit = (CWndEdit*) GetDlgItem( WIDC_EDIT1 );
		pEdit->SetString( str );


		pEdit  = (CWndEdit*) GetDlgItem( WIDC_EDIT2 );
		pEdit->SetString( ((CWndEdit*) GetParentWnd()->GetDlgItem(WIDC_EDIT1))->GetString() );

		pEdit = (CWndEdit*) GetDlgItem( WIDC_EDIT3 );
		pEdit->SetString( ((CWndEdit*) GetParentWnd()->GetDlgItem(WIDC_EDIT4))->GetString() );

		pEdit = (CWndEdit*) GetDlgItem( WIDC_EDIT5 );
		pEdit->SetString( ((CWndEdit*) GetParentWnd()->GetDlgItem(WIDC_EDIT2))->GetString() );

		pEdit = (CWndEdit*) GetDlgItem( WIDC_EDIT6 );
		pEdit->SetString( ((CWndEdit*) GetParentWnd()->GetDlgItem(WIDC_EDIT5))->GetString() );

		pEdit = (CWndEdit*) GetDlgItem( WIDC_EDIT4 );
		pEdit->SetString( ((CWndEdit*) GetParentWnd()->GetDlgItem(WIDC_EDIT3))->GetString() );
		
	}

	// 윈도를 중앙으로 옮기는 부분.
	CRect rectRoot = m_pWndRoot->GetLayoutRect();
	CRect rectWindow = GetWindowRect();
	CPoint point( rectRoot.right - rectWindow.Width(), 110 );
	Move( point );
	MoveParentCenter();
} 
예제 #15
0
파일: edit.c 프로젝트: navoj/xlisp
/* MakeEditText - make an edit text or rich edit text control */
static xlValue MakeEditText(xlValue obj,int type)
{
    xlValue hscrollp,vscrollp,autohscrollp,autovscrollp;
    xlValue label,multilinep,justify,borderp;
    WidgetPosition pos;
    FrameWidget *parent;
    Widget *widget;
    DWORD style;
    HWND wnd;
    
    /* parse the arguments */
    parent = GetArgFrameWidget();
    xlGetKeyArg(k_label,xlNil,&label);
    xlGetKeyArg(k_hscrollp,xlFalse,&hscrollp);
    xlGetKeyArg(k_vscrollp,xlFalse,&vscrollp);
    xlGetKeyArg(k_autohscrollp,xlFalse,&autohscrollp);
    xlGetKeyArg(k_autovscrollp,xlFalse,&autovscrollp);
    xlGetKeyArg(k_multilinep,xlFalse,&multilinep);
    xlGetKeyArg(k_justify,s_left,&justify);
    xlGetKeyArg(k_borderp,xlTrue,&borderp);
    GetWidgetPosition(&pos);

    /* setup the style */
    style = WS_CHILD | WS_VISIBLE | ES_NOHIDESEL;
    if (type == wtEditText)
        style |= DS_LOCALEDIT;
    if (hscrollp != xlFalse)
        style |= WS_HSCROLL;
    if (vscrollp != xlFalse)
        style |= WS_VSCROLL;
    if (autohscrollp != xlFalse)
        style |= ES_AUTOHSCROLL;
    if (autovscrollp != xlFalse)
        style |= ES_AUTOVSCROLL;
    if (multilinep != xlFalse)
        style |= ES_MULTILINE;
    if (justify == s_left)
        style |= ES_LEFT;
    else if (justify == s_right)
        style |= ES_RIGHT;
    else if (justify == s_center)
        style |= ES_CENTER;
    else
        xlError("expecting 'left, 'right or 'center",justify);
    if (borderp != xlFalse)
        style |= WS_BORDER;

    /* allocate the widget data structure */
    if (!(widget = MakeWidget(parent,type,sizeof(Widget))))
        return xlNil;
    widget->position = pos;

    /* make the button */
    wnd = CreateWindow(type == wtEditText ? "edit" : "RichEdit",
                       xlStringP(label) ? xlGetString(label) : "Edit Text",
                       style,
                       pos.x,               /* horizontal position */
                       pos.y,               /* vertical position */
                       pos.width,           /* width */
                       pos.height,          /* height */
                       GetParentWnd(parent),
                       (HMENU)widget->childID,
                       hInstance,
                       NULL);

    /* make sure the widget was created */
    if ((widget->wnd = wnd) == NULL) {
        FreeWidget(widget);
        return xlNil;
    }

    /* store the widget data structure pointer */
    SetWindowLong(wnd,GWL_USERDATA,(long)widget);

    /* setup to filter messages */
    widget->wndProc = (WNDPROC)SetWindowLong(widget->wnd,GWL_WNDPROC,(LONG)TextFilter);

    /* set the font */
    SendMessage(wnd,WM_SETFONT,(WPARAM)GetStockObject(ANSI_FIXED_FONT),0);
    
    /* return the widget object */
    SetWidget(obj,widget);
    return obj;
}
예제 #16
0
//**************************************************************************
void CBCGPRibbonComboBox::OnAfterChangeRect (CDC* pDC)
{
	ASSERT_VALID (this);
	ASSERT_VALID (pDC);

	CBCGPRibbonButton::OnAfterChangeRect (pDC);

	if (m_rect.IsRectEmpty ())
	{
		if (m_pWndEdit->GetSafeHwnd () != NULL)
		{
			m_pWndEdit->ShowWindow (SW_HIDE);
		}

		if (m_pBtnClear->GetSafeHwnd () != NULL)
		{
			m_pBtnClear->ShowWindow (SW_HIDE);
		}
		return;
	}

	CRect rectCommandOld = m_rectCommand;

	m_Location = RibbonElementSingleInGroup;

	m_rectMenu = m_rect;
	m_rectMenu.left = m_rectMenu.right - GetDropDownImageWidth () - 2 * m_nMenuArrowMargin;
	
	m_rectCommand = m_rect;
	m_rectCommand.right = m_rectMenu.left;
	m_rectCommand.left += m_nLabelImageWidth;

	int cx = m_bFloatyMode ? m_nWidthFloaty : m_nWidth;
	if (globalData.GetRibbonImageScale () > 1.)
	{
		cx = (int)(.5 + globalData.GetRibbonImageScale () * cx);
	}

	if (m_rectCommand.Width () > cx)
	{
		m_rectCommand.left = m_rectCommand.right - cx;
	}

	m_rectMenu.DeflateRect (1, 1);

	m_bMenuOnBottom = FALSE;

	if (!m_bHasEditBox)
	{
		return;
	}

	if (m_pWndEdit == NULL)
	{
		DWORD dwEditStyle = WS_CHILD | ES_WANTRETURN | 
							ES_AUTOHSCROLL | WS_TABSTOP;

		dwEditStyle |= m_nAlign;

		CWnd* pWndParent = GetParentWnd ();
		ASSERT_VALID (pWndParent);

		if ((m_pWndEdit = CreateEdit (pWndParent, dwEditStyle)) == NULL)
		{
			return;
		}

		m_pWndEdit->SendMessage (EM_SETTEXTMODE, TM_PLAINTEXT);
		m_pWndEdit->SetEventMask (m_pWndEdit->GetEventMask () | ENM_CHANGE);
		m_pWndEdit->SetFont (GetTopLevelRibbonBar ()->GetFont ());
		m_pWndEdit->SetWindowText (m_strEdit);
	}

	if (rectCommandOld != m_rectCommand || !m_pWndEdit->IsWindowVisible ())
	{
		CRect rectEdit = m_rectCommand;
		rectEdit.DeflateRect (m_szMargin.cx, m_szMargin.cy, 0, m_szMargin.cy);
		rectEdit.DeflateRect(0, m_sizePadding.cy / 2);

		if (m_bSearchMode)
		{
			rectEdit.right -= m_rect.Height();
		}

		m_pWndEdit->SetWindowPos (NULL, 
			rectEdit.left, rectEdit.top,
			rectEdit.Width (), rectEdit.Height (),
			SWP_NOZORDER | SWP_NOACTIVATE);

		m_pWndEdit->ShowWindow (SW_SHOWNOACTIVATE);

		if (m_bSearchMode && m_pBtnClear->GetSafeHwnd () != NULL)
		{
			m_pBtnClear->SetWindowPos (NULL, 
				m_rectMenu.left - m_rect.Height() + 2, m_rect.top + 1,
				m_rect.Height () - 2, m_rect.Height () - 2,
				SWP_NOZORDER | SWP_NOACTIVATE);
			m_pBtnClear->ShowWindow (m_strEdit.IsEmpty() ? SW_HIDE : SW_SHOWNOACTIVATE);
		}
	}
}
예제 #17
0
//**************************************************************************
void CBCGPRibbonComboBox::DropDownList ()
{
	ASSERT_VALID (this);

	if (IsDisabled ())
	{
		return;
	}

	if (m_pWndEdit->GetSafeHwnd () != NULL && !m_pWndEdit->IsWindowVisible ())
	{
		return;
	}

	if (CBCGPPopupMenu::GetActiveMenu () != NULL)
	{
		if (CBCGPPopupMenu::GetActiveMenu ()->GetMenuBar () != m_pParentMenu)
		{
			CBCGPPopupMenu::GetActiveMenu ()->SendMessage (WM_CLOSE);
			return;
		}
	}

	CBCGPBaseRibbonElement::OnShowPopupMenu ();

	if (m_bIsCalculator)
	{
		if (m_pCalcPopup != NULL)
		{
			m_pCalcPopup->SendMessage (WM_CLOSE);
			m_pCalcPopup = NULL;

			SetDroppedDown(NULL);
		}
		else
		{
			if (CBCGPPopupMenu::GetActiveMenu () != NULL)
			{
				if (CBCGPPopupMenu::GetActiveMenu ()->GetMenuBar () != m_pParentMenu)
				{
					CBCGPPopupMenu::GetActiveMenu ()->SendMessage (WM_CLOSE);
					return;
				}
			}

			CBCGPBaseRibbonElement::OnShowPopupMenu ();

			double dblValue = 0.;

			CString strValue = GetEditText ();
			if (!strValue.IsEmpty ())
			{
				strValue.Replace (_T(','), _T('.'));
	#if _MSC_VER < 1400
				_stscanf (strValue, _T("%lf"), &dblValue);
	#else
				_stscanf_s (strValue, _T("%lf"), &dblValue);
	#endif
			}

			m_pCalcPopup = new CBCGPCalculatorPopup (dblValue, 0, this);
			m_pCalcPopup->m_bAutoDestroyParent = FALSE;
			m_pCalcPopup->SetParentRibbonElement (this);

			CBCGPCalculator* pCalc = DYNAMIC_DOWNCAST (CBCGPCalculator, m_pCalcPopup->GetMenuBar());
			if (pCalc != NULL)
			{
				ASSERT_VALID (pCalc);

				if (!m_lstCalcAdditionalCommands.IsEmpty ())
				{
					pCalc->SetAdditionalCommands (m_lstCalcAdditionalCommands);
				}

				if (!m_lstCalcExtCommands.IsEmpty ())
				{
					pCalc->SetExtendedCommands (m_lstCalcExtCommands);
				}

				if (!m_strCalcDisplayFormat.IsEmpty())
				{
					pCalc->SetDisplayFormat(m_strCalcDisplayFormat);
				}
			}

			CRect rectWindow;
			m_pWndEdit->GetWindowRect (rectWindow);

			if (!m_pCalcPopup->Create (m_pWndEdit, rectWindow.left - m_szMargin.cx, rectWindow.bottom + m_szMargin.cy, NULL, TRUE))
			{
				ASSERT (FALSE);
				m_pCalcPopup = NULL;
			}
			else
			{
				SetDroppedDown(m_pCalcPopup);

				m_pCalcPopup->GetMenuBar()->SetFocus ();
				
				CRect rect;
				m_pCalcPopup->GetWindowRect (&rect);
				m_pCalcPopup->UpdateShadow (&rect);
			}
		}

		return;
	}

	CBCGPDropDownList* pList = new CBCGPDropDownList (this);
	pList->SetParentRibbonElement (this);

	int i = 0;
	for (POSITION pos = m_lstItems.GetHeadPosition (); pos != NULL; i++)
	{
		CString strItem = m_lstItems.GetNext (pos);
		pList->AddString (strItem);

		if (m_bHasEditBox && strItem == m_strEdit)
		{
			m_iSelIndex = i;
		}
	}

	pList->SetCurSel (m_iSelIndex);
	pList->SetMaxHeight (m_nDropDownHeight);
	pList->SetMinWidth (m_rect.Width ());

	CWnd* pWndParent = GetParentWnd ();
	if (pWndParent == NULL)
	{
		ASSERT (FALSE);
		return;
	}

	const BOOL bIsRTL = (pWndParent->GetExStyle () & WS_EX_LAYOUTRTL);

	CRect rect = m_rectCommand.IsRectEmpty () ? m_rect : m_rectCommand;
	pWndParent->ClientToScreen (&rect);

	SetDroppedDown (pList);

	if (m_pParent != NULL)
	{
		ASSERT_VALID (m_pParent);
		m_pParent->HighlightPanel (NULL, CPoint (-1, -1));
	}

	if (m_pWndEdit->GetSafeHwnd () != NULL)
	{
		m_pWndEdit->SetFocus ();
		m_pWndEdit->SetSel (0, -1);
	}

	if (m_bResizeDropDownList)
	{
		pList->EnableVertResize (2 * globalData.GetTextHeight ());
	}

	pList->Track (CPoint (
		bIsRTL ? rect.right : rect.left, rect.bottom), pWndParent->GetOwner ());
}
//**********************************************************************************
void CBCGPRibbonBackstageViewPanel::AdjustScrollBars()
{
	ASSERT_VALID(this);

	if (m_bInAdjustScrollBars)
	{
		return;
	}

	m_bInAdjustScrollBars = TRUE;

	int nScrollOffsetOld = m_nScrollOffset;
	int nScrollOffsetHorzOld = m_nScrollOffsetHorz;

	m_rectScrollCorner.SetRectEmpty();

	m_rectRight.right = m_rect.right;
	m_rectRight.bottom = m_rect.bottom;

	const int cxScroll = ::GetSystemMetrics (SM_CXVSCROLL);
	const int cyScroll = ::GetSystemMetrics (SM_CYHSCROLL);

	int nTotalWidth = m_rectMenuElements.Width() + m_sizeRightView.cx;

	BOOL bHasVertScrollBar = FALSE;
	BOOL bHasHorzScrollBar = m_pScrollBarHorz->GetSafeHwnd() != NULL && nTotalWidth > m_rect.Width();

	// Adjust vertical scroll bar:
	if (m_pScrollBar->GetSafeHwnd() == NULL)
	{
		m_nScrollOffset = 0;
	}
	else
	{
		int nTotalHeight = max(m_nTotalHeight, m_sizeRightView.cy);

		if (nTotalHeight <= m_rect.Height())
		{
			m_pScrollBar->ShowWindow(SW_HIDE);
			m_nScrollOffset = 0;
		}
		else
		{
			int nVertScrollHeight = m_rect.Height();
			if (bHasHorzScrollBar)
			{
				nVertScrollHeight -= cyScroll;
			}

			m_pScrollBar->SetWindowPos (NULL,
				m_rect.right - cxScroll, m_rect.top,
				cxScroll, nVertScrollHeight,
				SWP_NOZORDER | SWP_NOACTIVATE);

			SCROLLINFO si;

			ZeroMemory (&si, sizeof (SCROLLINFO));
			si.cbSize = sizeof (SCROLLINFO);
			si.fMask = SIF_RANGE | SIF_PAGE;

			si.nMin = 0;
			si.nMax = nTotalHeight;
			si.nPage = m_rect.Height ();

			m_pScrollBar->SetScrollInfo (&si, TRUE);
			m_pScrollBar->ShowWindow(SW_SHOWNOACTIVATE);
			m_pScrollBar->RedrawWindow();

			m_rectRight.right -= cxScroll;

			if (m_nScrollOffset > nTotalHeight)
			{
				m_nScrollOffset = nTotalHeight;
			}

			bHasVertScrollBar = TRUE;
		}
	}

	// Adjust horizontal scroll bar:
	if (m_pScrollBarHorz->GetSafeHwnd() == NULL)
	{
		m_nScrollOffsetHorz = 0;
	}
	else
	{
		if (nTotalWidth <= m_rect.Width())
		{
			m_pScrollBarHorz->ShowWindow(SW_HIDE);
			m_nScrollOffsetHorz = 0;
		}
		else
		{
			int nHorzScrollWidth = m_rect.Width();
			if (bHasVertScrollBar)
			{
				nHorzScrollWidth -= cxScroll;
			}

			m_pScrollBarHorz->SetWindowPos (NULL,
				m_rect.left, m_rect.bottom - cyScroll,
				nHorzScrollWidth, cyScroll,
				SWP_NOZORDER | SWP_NOACTIVATE);

			SCROLLINFO si;

			ZeroMemory (&si, sizeof (SCROLLINFO));
			si.cbSize = sizeof (SCROLLINFO);
			si.fMask = SIF_RANGE | SIF_PAGE;

			si.nMin = 0;
			si.nMax = nTotalWidth;
			si.nPage = m_rect.Width ();

			m_pScrollBarHorz->SetScrollInfo (&si, TRUE);
			m_pScrollBarHorz->ShowWindow(SW_SHOWNOACTIVATE);
			m_pScrollBarHorz->RedrawWindow();

			m_rectRight.bottom -= cyScroll;

			if (m_nScrollOffsetHorz > nTotalWidth)
			{
				m_nScrollOffsetHorz = nTotalWidth;
			}
		}
	}

	if (bHasVertScrollBar && bHasHorzScrollBar)
	{
		m_rectScrollCorner = m_rect;
		m_rectScrollCorner.left = m_rectScrollCorner.right - cxScroll - 1;
		m_rectScrollCorner.top = m_rectScrollCorner.bottom - cyScroll - 1;
	}

	if ((nScrollOffsetOld != m_nScrollOffset) || (nScrollOffsetHorzOld != m_nScrollOffsetHorz) && m_pMainButton != NULL)
	{
		ASSERT_VALID (m_pMainButton);
		ASSERT_VALID (m_pMainButton->GetParentRibbonBar ());

		CClientDC dc(m_pMainButton->GetParentRibbonBar());

		CFont* pOldFont = dc.SelectObject (m_pMainButton->GetParentRibbonBar()->GetFont());
		ASSERT (pOldFont != NULL);

		Repos(&dc, m_rect);

		dc.SelectObject (pOldFont);

		GetParentWnd()->RedrawWindow();

		m_pMainButton->GetParentRibbonBar()->SetBackstageHorzOffset(m_nScrollOffsetHorz);
	}

	m_bInAdjustScrollBars = FALSE;
}
//**************************************************************************
void CBCGPRibbonBackstageViewItemForm::OnAfterChangeRect (CDC* pDC)
{
	SetLayoutReady(FALSE);

	CBCGPBaseRibbonElement::OnAfterChangeRect(pDC);

	if (m_rect.IsRectEmpty ())
	{
		if (m_pWndForm->GetSafeHwnd () != NULL)
		{
			m_pWndForm->ShowWindow (SW_HIDE);
		}
		return;
	}

	BOOL bForceAdjustLocations = FALSE;

	if (m_pWndForm == NULL)
	{
		if ((m_pWndForm = OnCreateFormWnd()) == NULL)
		{
			return;
		}

		SetLayoutReady(FALSE);
		bForceAdjustLocations = TRUE;

		if (m_Watermark.GetImageWell() != NULL)
		{
			BOOL bMirror = FALSE;

			if (GetParentWnd()->GetExStyle () & WS_EX_LAYOUTRTL)
			{
				if (!m_bImageMirror)
				{
					m_bImageMirror = TRUE;
					bMirror = TRUE;
				}
			}
			else if (m_bImageMirror)
			{
				m_bImageMirror = FALSE;
				bMirror = TRUE;
			}

			if (bMirror)
			{
				m_Watermark.Mirror();
				OnChangeVisualManager();
			}
		}
	}

	CRect rectWindow = m_rect;
	CRect rectWatermark(0, 0, 0, 0);

	if (m_sizeWaterMark != CSize(0, 0))
	{
		int xWatermark = max(rectWindow.Width(), m_sizeDlg.cx) - m_sizeWaterMark.cx;
		int yWatermark = max(rectWindow.Height(), m_sizeDlg.cy) - m_sizeWaterMark.cy;

		rectWatermark = CRect(CPoint(xWatermark, yWatermark), m_sizeWaterMark);
	}

	OnSetBackstageWatermarkRect(rectWatermark);

	m_pWndForm->SetWindowPos (NULL, 
		rectWindow.left, rectWindow.top,
		rectWindow.Width (), rectWindow.Height () + 1,
		SWP_NOZORDER | SWP_NOACTIVATE);

	if (!m_pWndForm->IsWindowVisible())
	{
		m_pWndForm->ShowWindow (SW_SHOWNOACTIVATE);
	}

	SetLayoutReady();

	if (bForceAdjustLocations)
	{
		CBCGPRibbonPanel* pParentPanel = GetParentPanel();
		if (pParentPanel != NULL && pParentPanel->GetParentMenuBar()->GetSafeHwnd() != NULL)
		{
			CRect rectPanel;
			pParentPanel->GetParentMenuBar()->GetClientRect(rectPanel);

			pParentPanel->GetParentMenuBar()->PostMessage(WM_SIZE, MAKEWPARAM(rectPanel.Width(), rectPanel.Height()));
		}
	}

	m_pWndForm->RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE | RDW_ALLCHILDREN);
}
//********************************************************************************
void CBCGPRibbonBackstageViewPanel::Repos (CDC* pDC, const CRect& rect)
{
	CBCGPRibbonMainPanel::Repos(pDC, rect);

	if (m_pSelected == NULL && !m_bIsCalcWidth)
	{
		CBCGPRibbonPanelMenuBar* pMenuBar = DYNAMIC_DOWNCAST(CBCGPRibbonPanelMenuBar, GetParentWnd());
		if (pMenuBar != NULL)
		{
			CFrameWnd* pTarget = (CFrameWnd*) pMenuBar->GetCommandTarget ();
			if (pTarget == NULL || !pTarget->IsFrameWnd())
			{
				pTarget = BCGPGetParentFrame(pMenuBar);
			}
			
			if (pTarget != NULL)
			{
				pMenuBar->OnUpdateCmdUI(pTarget, TRUE);
			}
		}

		if (m_pMainButton != NULL)
		{
			ASSERT_VALID(m_pMainButton);
			
			if (m_pMainButton->GetParentRibbonBar () != NULL)
			{
				ASSERT_VALID (m_pMainButton->GetParentRibbonBar ());

				int nInitialPage = m_pMainButton->GetParentRibbonBar ()->GetInitialBackstagePage();
				int nDefaultPage = m_pMainButton->GetParentRibbonBar ()->GetDefaultBackstagePage();

				int nStartPage = (nInitialPage == -1) ? nDefaultPage : nInitialPage;
				if (nStartPage >= 0)
				{
					int nPage = 0;

					for (int i = 0; i < m_arElements.GetSize (); i++)
					{
						CBCGPBaseRibbonElement* pElem = m_arElements [i];
						ASSERT_VALID (pElem);

						if (pElem->GetBackstageAttachedView() != NULL)
						{
							if (nPage == nStartPage)
							{
								if (!pElem->IsDisabled())
								{
									m_pSelected = pElem;
									m_pSelected->m_bIsChecked = TRUE;
								}

								break;
							}

							nPage++;
						}
					}
				}
			}
		}

		if (m_pSelected == NULL)
		{
			for (int i = 0; i < m_arElements.GetSize (); i++)
			{
				CBCGPBaseRibbonElement* pElem = m_arElements [i];
				ASSERT_VALID (pElem);

				if (!pElem->IsDisabled() && pElem->GetBackstageAttachedView() != NULL)
				{
					m_pSelected = pElem;
					m_pSelected->m_bIsChecked = TRUE;
					break;
				}
			}
		}

		if (m_pHighlighted == NULL)
		{
			m_pHighlighted = m_pSelected;
		}
	}

	m_rectRight = rect;
	m_rectRight.left = m_rectMenuElements.right;
	m_rectRight.top -= m_nScrollOffset;

	if (m_bIsCalcWidth)
	{
		return;
	}

	AdjustScrollBars();
	ReposActiveForm();
}
예제 #21
0
BOOL CWndGuildVoteSeting::OnChildNotify( UINT message, UINT nID, LRESULT* pLResult ) 
{ 
	switch( nID )
	{
	// 길드 설정창 클리어
	case WIDC_VOTE_CLEAR:
		{
			CWndEdit* pEdit;
			
			pEdit = (CWndEdit*) GetDlgItem( WIDC_EDIT1 );
			pEdit->SetString( "" );
			pEdit = (CWndEdit*) GetDlgItem( WIDC_EDIT2 );
			pEdit->SetString( "" );
			pEdit = (CWndEdit*) GetDlgItem( WIDC_EDIT3 );
			pEdit->SetString( "" );
			pEdit = (CWndEdit*) GetDlgItem( WIDC_EDIT5 );
			pEdit->SetString( "" );
			pEdit = (CWndEdit*) GetDlgItem( WIDC_EDIT6 );
			pEdit->SetString( "" );
			pEdit = (CWndEdit*) GetDlgItem( WIDC_EDIT4 );
			pEdit->SetString( "" );

			m_nSelect = -1;
		}
		break;
	// 길드 투표 시작
	case WIDC_VOTE_START:
		{
			CGuild* pGuild = g_pPlayer->GetGuild();

			if( pGuild )
			{
				// 현재 투표할 메뉴가 완료된것이냐?
				CWndComboBox* pCombo = (CWndComboBox*)GetParentWnd()->GetDlgItem(WIDC_COMBOBOX1);

				if( m_nSelect != -1 )
				{
					if( pGuild->m_votes.size() )
					{
						list <CGuildVote*>::iterator it = pGuild->m_votes.begin();
						
						for ( ; it != pGuild->m_votes.end() ; ++it )
						{
							if( (*it)->GetID() == pCombo->GetItemData(m_nSelect) )
							{
								if( (*it)->IsCompleted() )
								{
									g_WndMng.OpenMessageBox( "투표가 완료된 사항입니다.", MB_OK, this );
									return FALSE;
								}
								else
								{
									g_WndMng.OpenMessageBox( "이미 진행중입니다.", MB_OK, this );
									return FALSE;
								}
								
							}
						}
					}
				}
				

				// 입력사항 체크 부분...
				CWndEdit* pEdit1 = (CWndEdit*) GetDlgItem( WIDC_EDIT1 );
				CWndEdit* pEdit2 = (CWndEdit*) GetDlgItem( WIDC_EDIT2 );

				if( strlen( pEdit1->GetString() ) <= 0 || strlen( pEdit2->GetString() ) <= 0 )
				{
					g_WndMng.OpenMessageBox( "투표제목과 내용은 필수 입력 사항입니다.", MB_OK, this );
					break;
				}

				int nChk = -1;
				CWndEdit* pEdit[4];
				
				pEdit[0] = (CWndEdit*) GetDlgItem( WIDC_EDIT3 );
				pEdit[1] = (CWndEdit*) GetDlgItem( WIDC_EDIT5 );
				pEdit[2] = (CWndEdit*) GetDlgItem( WIDC_EDIT6 );
				pEdit[3] = (CWndEdit*) GetDlgItem( WIDC_EDIT4 );
				int i;
				for(  i=0; i<4; i++ )
				{
					if( strlen( pEdit[i]->GetString() ) > 0 )
						nChk = i;
				}

				if( nChk != -1 )
				{
					if( nChk < 1 )
					{
						g_WndMng.OpenMessageBox( "투표 항목은 최소한 2개 이상이어야 합니다.", MB_OK, this );
						break;
					}

					for( i=0; i<=nChk; i++ )
					{
						if( strlen( pEdit[i]->GetString() ) <= 0 )
						{
							g_WndMng.OpenMessageBox( "중간에 빈 내용이 있습니다.", MB_OK, this );
							return FALSE;
						}
					}
					
				}
				else
				{
					g_WndMng.OpenMessageBox( "투표 항목은 최소한 2개 이상이어야 합니다.", MB_OK, this );
					break;
				}

				LPCTSTR ptext[4];

				ptext[0] = pEdit[0]->GetString();
				ptext[1] = pEdit[1]->GetString();
				ptext[2] = pEdit[2]->GetString();
				ptext[3] = pEdit[3]->GetString();
				
				g_DPlay.SendAddVote( pEdit1->GetString(), pEdit2->GetString(), ptext );
			}

			Destroy();
		}
		break;
	// 길드투표 끝내기
	case WIDC_VOTE_FINISH:
		{
			CWndComboBox* pCombo = (CWndComboBox*)GetParentWnd()->GetDlgItem(WIDC_COMBOBOX1);
			
			if( pCombo->GetCurSel() != -1 )
				g_DPlay.SendCloseVote( pCombo->GetItemData( pCombo->GetCurSel() ) );

			Destroy();
		}
		break;
	}

	return CWndNeuz::OnChildNotify( message, nID, pLResult ); 
}