コード例 #1
0
ファイル: ScrollBar.cpp プロジェクト: pedia/raidget
void ScrollBar::LeftDown(Point p, dword) {
	push = GetMousePart();
	LLOG("ScrollBar::LeftDown(" << p << ")");
	LLOG("MousePos = " << GetMousePos() << ", ScreenView = " << GetScreenView()
	<< ", rel. pos = " << (GetMousePos() - GetScreenView().TopLeft()));
	LLOG("GetWorkArea = " << GetWorkArea());
	LLOG("VisibleScreenView = " << GetVisibleScreenView());
	LLOG("PartRect(0) = " << GetPartRect(0));
	LLOG("PartRect(1) = " << GetPartRect(1));
	LLOG("PartRect(2) = " << GetPartRect(2));
	LLOG("ScrollBar::LeftDown: mousepart = " << (int)push << ", rect = " << GetPartRect(push)
		<< ", overthumb = " << style->overthumb << ", slider = " << Slider());
	LLOG("thumbpos = " << thumbpos << ", thumbsize = " << thumbsize);
	if(push == 2)
		delta = GetHV(p.x, p.y) - thumbpos;
	else {
		if(jump) {
			delta = thumbsize / 2;
			Drag(p);
		}
		else
			if(push == 0)
				PrevPage();
			else
				NextPage();
	}
	SetCapture();
	Refresh();
	WhenLeftClick();
}
コード例 #2
0
ファイル: MainFrame.cpp プロジェクト: page31/GJTalk
void CMainFrame::UpdateDock(LPRECT pRect)
{
	RECT rc;
	POINT mp;
	::GetCursorPos(&mp);
	if(!pRect) 
		GetWindowRect(*this,&rc); 
	else 
		rc=*pRect; 


	RECT rcWork;
	GetWorkArea(&rcWork);
	if(mp.y-rcWork.top<10)
	{
		m_Dock=DOCK_TOP;
		OffsetRect(&rc,0,rcWork.top-rc.top);
	}
	else if(rcWork.right-mp.x<10)
	{
		m_Dock=DOCK_RIGHT;
		OffsetRect(&rc,rcWork.right-rc.right,0);
	}
	else if(mp.x-rcWork.left<10)
	{
		m_Dock=DOCK_LEFT;
		OffsetRect(&rc,rcWork.left-rc.left,0);
	}
	else
	{
		m_Dock=DOCK_NONE;
	}
	if(pRect)
		*pRect=rc;
}
コード例 #3
0
ファイル: ToolTip.cpp プロジェクト: pedia/raidget
void QTFPopUp::PopUp(Ctrl *parent) {
	Close();
	Rect r = Rect(0, 0, width, maxheight);
	GetFrame().FrameLayout(r);
	int cy = min(maxheight, GetHeight(r.Width()) + maxheight - r.Height());
	Rect area = GetWorkArea();
	Point p = GetMousePos();
	r.top = max(area.top, p.y + 16);
	r.bottom = r.top + cy;
	if(r.bottom > area.bottom) {
		r.bottom = area.bottom;
		r.top = r.bottom - cy;
	}
	r.left = max(area.left, p.x - width / 2);
	r.right = r.left + width;
	if(r.right > area.right) {
		r.right = area.right;
		r.left = r.right - width;
	}
	open = false;
	SetRect(r);
	Ctrl::PopUp(parent);
	SetFocus();
	open = true;
}
コード例 #4
0
ファイル: candui.cpp プロジェクト: jrywu/OpenVanilla-Win32
void SetCandPosition(HWND hCandWnd)
{
    LPUIPRIV       lpUIPriv;
    HIMC           hIMC;
    LPINPUTCONTEXT lpIMC;                 
    POINT          ptNew;

    lpUIPriv = (LPUIPRIV)GetWindowLong(hCandWnd, IMMGWL_PRIVATE);
    if (!lpUIPriv) {
        return;
    }

    if (!lpUIPriv->lpCandList) {
        return;
    }

    hIMC = (HIMC)GetWindowLong(hCandWnd, IMMGWL_IMC);
    if (!hIMC) {
        return;
    }

    lpIMC = (LPINPUTCONTEXT)ImmLockIMC(hIMC);
    if (!lpIMC) {
        ImmUnlockIMC(hIMC);
        return;
    }
    GetWorkArea(&g_sImeUIG.rcWorkArea);

    ImmUnlockIMC(hIMC);

    AdjustCandWnd(hCandWnd, ptNew);

    return;
}
コード例 #5
0
ファイル: MainFrame.cpp プロジェクト: page31/GJTalk
void CMainFrame::Appear()
{

	if(IsWindowVisible(this->m_hWnd))
	{ 
		if(::IsIconic(this->m_hWnd))
			::ShowWindow(this->m_hWnd,SW_RESTORE);
		SetForegroundWindow();
	}
	else
	{
		::ShowWindow(this->m_hWnd,SW_SHOW);
	}
	if(m_Dock!=DOCK_NONE)
	{
		StopAnimateDock();
		RECT rc,rcWork;
		GetWindowRect(*this,&rc);
		GetWorkArea(&rcWork);
		if(DOCK_TOP==m_Dock&& rc.top<0)
		{
			SetWindowPos(*this,NULL,rc.left,0,0,0,SWP_NOSIZE|SWP_NOZORDER);
		}
		else if(DOCK_LEFT==m_Dock&&rc.left<rcWork.left) 
		{
			SetWindowPos(*this,NULL,0,rc.top,0,0,SWP_NOSIZE|SWP_NOZORDER);
		}
		else if(DOCK_RIGHT==m_Dock&&rc.right>rcWork.right)
		{
			SetWindowPos(*this,NULL,rcWork.right-(rc.right-rc.left),rc.top,0,0,SWP_NOSIZE|SWP_NOZORDER); 
		}
		StopAnimateDock(); 
	} 
}
コード例 #6
0
ファイル: Win32Wnd.cpp プロジェクト: dreamsxin/ultimatepp
Rect Ctrl::GetWorkArea(Point pt)
{
	Array<Rect> rc;
	GetWorkArea(rc);
	for(int i = 0; i < rc.GetCount(); i++)
		if(rc[i].Contains(pt))
			return rc[i];
	return GetPrimaryWorkArea();
}
コード例 #7
0
ファイル: Win32Wnd.cpp プロジェクト: koz4k/soccer
Rect Ctrl::GetVirtualWorkArea()
{
	Rect out = GetPrimaryWorkArea();
	Array<Rect> rc;
	GetWorkArea(rc);
	for(int i = 0; i < rc.GetCount(); i++)
		out |= rc[i];
	return out;
}
コード例 #8
0
ファイル: TopWindow.cpp プロジェクト: AbdelghaniDr/mirror
void TopWindow::WorkAreaTrim()
{
	Rect a = GetWorkArea();
	Rect h = GetRect();
	h.left = max(h.left, a.left);
	h.right = min(h.right, a.right);
	h.top = max(h.top, a.top);
	h.bottom = min(h.bottom, a.bottom);
	if(h != GetRect() && !IsChild())
		SetRect(h);
}
コード例 #9
0
//****************************************************************************************
void CBCGPropSheetBar::EnsureVisible (int iButton)
{
	ASSERT_VALID (this);

	CBCGToolbarButton* pButton = GetButton (iButton);
	ASSERT_VALID (pButton);

	CRect rectButton = pButton->Rect ();

	CRect rectWork;
	GetWorkArea (rectWork);

	if (rectButton.Height () >= rectWork.Height ())
	{
		// Work area is too small, nothing to do
		return;
	}

	if (rectButton.top >= rectWork.top && rectButton.bottom <= rectWork.bottom)
	{
		// Already visible
		return;
	}

	if (rectButton.top < rectWork.top)
	{
		while (pButton->Rect ().top < rectWork.top)
		{
			int iScrollOffset = m_iScrollOffset;

			ScrollUp ();

			if (iScrollOffset == m_iScrollOffset)
			{
				break;
			}
		}
	}
	else
	{
		while (pButton->Rect ().bottom > rectWork.bottom)
		{
			int iScrollOffset = m_iScrollOffset;

			ScrollDown ();

			if (iScrollOffset == m_iScrollOffset)
			{
				break;
			}
		}
	}
}
コード例 #10
0
ファイル: GtkWnd.cpp プロジェクト: guowei8412/upp-mirror
Rect Ctrl::GetWorkArea() const
{
	GuiLock __;
	static Array<Rect> rc;
	if(rc.IsEmpty()) 
		GetWorkArea(rc);
	
	Point pt = GetScreenRect().TopLeft();
	for (int i = 0; i < rc.GetCount(); i++)
		if(rc[i].Contains(pt))
			return rc[i];
	return GetPrimaryWorkArea();
}
コード例 #11
0
ファイル: GtkWnd.cpp プロジェクト: guowei8412/upp-mirror
Rect Ctrl::GetVirtualWorkArea()
{
	GuiLock __;
	static Rect r;
	if(r.right == 0) {
		r = GetPrimaryWorkArea();
		Array<Rect> rc;
		GetWorkArea(rc);
		for(int i = 0; i < rc.GetCount(); i++)
			r |= rc[i];
	}
	return r;
}
コード例 #12
0
ファイル: About.cpp プロジェクト: ultimatepp/mirror
	AboutDlg() {
		Size isz = MakeLogo(*this, ctrl);
		int cx = min(isz.cx * 2, GetWorkArea().GetWidth());
		SetRect(0, 0, cx, isz.cy);
		about.SetQTF(GetTopic("ide/app/About$en-us"), Zoom(DPI(120), 1024));
		about.SetZoom(Zoom(1, 1));
		about.RightPos(0, cx - isz.cx - DPI(1)).VSizePos();
		about.HMargins(Zx(4));
		about.SetFrame(NullFrame());
		about.NoLazy();
		Background(PaintRect(ColorDisplay(), SColorPaper()));
		Add(about);
//		separator.Color(Gray());
//		Add(separator.RightPos(cx - isz.cx, DPI(1)).VSizePos());
		Title("About TheIDE");
	}
コード例 #13
0
ファイル: GtkWnd.cpp プロジェクト: guowei8412/upp-mirror
Rect Ctrl::GetPrimaryWorkArea()
{
	GuiLock __;
	static Rect r;
	if (r.right == 0) {
		Array<Rect> rc;
		GetWorkArea(rc);
#if GTK_CHECK_VERSION(2, 20, 0)
		int primary = gdk_screen_get_primary_monitor(gdk_screen_get_default());
#else
		int primary = 0;
#endif
		primary >= 0 && primary < rc.GetCount() ? r = rc[primary] : r = GetVirtualScreenArea();
	}
	return r;
}
コード例 #14
0
ファイル: Puzzle.cpp プロジェクト: kolyden/mirror
void Puzzle::Generate()
{
    int n = size.cx * size.cy;
    box.Alloc(n);
    n--;
    for(int i = 0; i < n; i++)
        box[i] = i + 1;
    box[n] = 0;
    hole = size - 1;
    n = 20 * size.cx * size.cy;
    while(n > 0)
        n -= Move(hole.x + (rand() % 3) - 1, hole.y + (rand() % 3) - 1);
    moves = 0;
    Status();
    SetRect(GetWorkArea().CenterRect(AddFrameSize(size * 32)));
}
コード例 #15
0
ファイル: DockManager.cpp プロジェクト: jithuin/infogeezer
void CDockManager::OnMaximize()
{
	ASSERT (IsMaximized());

	BOOL bDockVisible = ::IsWindowVisible(ScGetHwnd());
	CRect rMain = GetWorkArea();
	
	if (bDockVisible && IsDocked())
	{
		CRect rDock;
		::GetWindowRect(ScGetHwnd(), rDock);
		
		switch (m_nDockPos)
		{
		case DMP_LEFT:
			if (m_nWidthDockedMax == -1)
				rMain.left += min(rDock.Width(), rMain.Width() / 2);
			else
				rMain.left += m_nWidthDockedMax;
			break;
			
		case DMP_RIGHT:
			if (m_nWidthDockedMax == -1)
				rMain.right -= min(rDock.Width(), rMain.Width() / 2);
			else
				rMain.right -= m_nWidthDockedMax;
			break;

		case DMP_BELOW:
			if (m_nHeightDockedMax == -1)
				rMain.bottom -= min(rDock.Height(), rMain.Height() / 2);
			else
				rMain.bottom -= m_nHeightDockedMax;
			break;

		default:
			ASSERT(0);
			return;
		}
	}

	MoveWindow(GetCWnd(), rMain);

	if (bDockVisible && IsDocked())
		UpdateDockWindowPos();
}
コード例 #16
0
//
// AdjustCandWnd()                                                    
//
void AdjustCandWnd(HWND hCandWnd,  LPUIPRIV        lpUIPriv,  LPINPUTCONTEXT  lpIMC)
{
    //LPUIPRIV        lpUIPriv;
	POINT ptNew;
    

	GetWorkArea(&g_sImeUIG.rcWorkArea);
	
    if (GetCaretPos(&ptNew)){
        ClientToScreen(lpIMC->hWnd, &ptNew);
        murmur("AdjustCandWnd() ptNew.x = %d, ptNew.y = %d, rcWorkArea.bottom = %d, nCandHi=%d\n", ptNew.x, ptNew.y, g_sImeUIG.rcWorkArea.bottom, lpUIPriv->nCandHi);
        if(  ( g_sImeUIG.rcWorkArea.bottom - ptNew.y < 2*lpUIPriv->nCandHi ) && 
			 ( g_sImeUIG.rcWorkArea.bottom - ptNew.y >0 ) &&
				ptNew.y < g_sImeUIG.rcWorkArea.bottom ){
             ptNew.y -= lpUIPriv->nCandHi;
			
        } else 
        ptNew.y = g_sImeUIG.rcWorkArea.bottom - lpUIPriv->nCandHi;
    } else 
		ptNew.y = g_sImeUIG.rcWorkArea.bottom - lpUIPriv->nCandHi;
        
    
    ptNew.x = 0;

    murmur("AdjustCandWnd() ptNew.x = %d, ptNew.y = %d\n", ptNew.x, ptNew.y);
        
   

    InvalidateRect(hCandWnd, NULL, FALSE);

	lpUIPriv->rcCandText.right = g_sImeUIG.rcWorkArea.right -g_sImeUIG.nCandCharWi *2;
	
    if (ptNew.x != lpUIPriv->ptCand.x ||
        ptNew.y != lpUIPriv->ptCand.y ||
		g_sImeUIG.rcWorkArea.right != lpUIPriv->nCandWi
		) {
        lpUIPriv->ptCand = ptNew;
		lpUIPriv->nCandWi = g_sImeUIG.rcWorkArea.right;
		SetWindowPos(hCandWnd, NULL, ptNew.x, ptNew.y, g_sImeUIG.rcWorkArea.right, g_sImeUIG.nCandLineHi,
				SWP_NOACTIVATE|SWP_NOZORDER);
    }

    return;
}
コード例 #17
0
ファイル: WinSpyWindow.c プロジェクト: RaMMicHaeL/winspy
BOOL WinSpy_ZoomTo(HWND hwnd, UINT uCorner)
{
	RECT rcDisplay;
	RECT rect;

	//SystemParametersInfo(SPI_GETWORKAREA, 0, &rcDisplay, FALSE);
	GetWindowRect(hwnd, &rect);
	GetWorkArea(&rect, &rcDisplay);

	switch (uCorner)
	{
	case PINNED_TOPLEFT:
		ptPinPos.x = rcDisplay.left + X_ZOOM_BORDER;
		ptPinPos.y = rcDisplay.top + Y_ZOOM_BORDER;
		break;

	case PINNED_TOPRIGHT:
		ptPinPos.x = rcDisplay.right - X_ZOOM_BORDER;
		ptPinPos.y = rcDisplay.top + Y_ZOOM_BORDER;
		break;

	case PINNED_BOTTOMRIGHT:
		ptPinPos.x = rcDisplay.right - X_ZOOM_BORDER;
		ptPinPos.y = rcDisplay.bottom - Y_ZOOM_BORDER;
		break;

	case PINNED_BOTTOMLEFT:
		ptPinPos.x = rcDisplay.left + X_ZOOM_BORDER;
		ptPinPos.y = rcDisplay.bottom - Y_ZOOM_BORDER;
		break;

	default:
		return FALSE;
	}

	SetPinState(TRUE);

	uPinnedCorner = uCorner;
	SetWindowLayout(hwnd, WINSPY_MINIMIZED);

	return TRUE;
}
コード例 #18
0
static __inline LRESULT OnCandCreate(HWND hCandWnd, CONST CREATESTRUCT * lpCS)
{
    HWND     hUIWnd;
    LPUIPRIV lpUIPriv;
    HIMC     hIMC;

    hUIWnd = GetWindow(hCandWnd, GW_OWNER);
    if (!hUIWnd) {
        return -1L;
    }

    lpUIPriv = (LPUIPRIV)GetWindowLong(hUIWnd, IMMGWL_PRIVATE);
    if (!lpUIPriv) {
        return -1L;
    }
    SetWindowLong(hCandWnd, IMMGWL_PRIVATE, (LONG)lpUIPriv);

    hIMC = (HIMC)GetWindowLong(hUIWnd, IMMGWL_IMC);
    if (!lpUIPriv) {
        return -1L;
    }
    SetWindowLong(hCandWnd, IMMGWL_IMC, (LONG)hIMC);

	GetWorkArea(&g_sImeUIG.rcWorkArea);

   
    
    lpUIPriv->ptCand.x = 0;// lpCS->x;
    lpUIPriv->ptCand.y = 0;//lpCS->y;

	lpUIPriv->nCandWi = g_sImeUIG.rcWorkArea.right; //lpCS->cx;
    lpUIPriv->nCandHi = g_sImeUIG.nCandLineHi ;//lpCS->cy;

    lpUIPriv->rcCandText.left = g_sImeUIG.nCandCharWi*2; //space for left arrow
    lpUIPriv->rcCandText.top =  0;//g_sImeUIG.rcWorkArea.bottom - g_sImeUIG.nCandLineHi;
    lpUIPriv->rcCandText.right =  g_sImeUIG.rcWorkArea.right - 2* g_sImeUIG.nCandCharWi;// space for right arrow
    lpUIPriv->rcCandText.bottom = g_sImeUIG.nCandLineHi;//g_sImeUIG.rcWorkArea.bottom;


    return 0L;
}
コード例 #19
0
ファイル: Top.cpp プロジェクト: kolyden/mirror
void TopWindow::Open(Ctrl *owner)
{
    GuiLock __;
    Rect r = GetRect();
    if(r.IsEmpty())
        SetRect(GetDefaultWindowRect());
    else if(r.left == 0 && r.top == 0)
        if(owner && center == 1)
            SetRect(owner->GetRect().CenterRect(r.GetSize()));
        else if(center)
            SetRect(GetWorkArea().CenterRect(r.GetSize()));
    frame->SetClient(GetRect());
    frame->window = this;
    frame->PopUp(owner, false, true);
    PopUp(frame, false, true);
    popup = false;
    SetRect(frame->GetClient());
    SyncCaption();
    if(state == MAXIMIZED)
        frame->Maximize();
}
コード例 #20
0
ファイル: DockManager.cpp プロジェクト: jithuin/infogeezer
CSize CDockManager::GetMinMaximizedSize()
{
   CSize sizeMin = GetWorkArea().Size();
   
   if (IsDocked() && ::IsWindowVisible(ScGetHwnd()))
   {
      switch (m_nDockPos)
      {
      case DMP_LEFT:
      case DMP_RIGHT:
         sizeMin.cx = MINMAXSIZE;
         break;
      
      case DMP_BELOW:
         sizeMin.cy = MINMAXSIZE;
         break;
      
      default:
         ASSERT(0);
      }
   }
   
   return sizeMin;
}
コード例 #21
0
ファイル: DockManager.cpp プロジェクト: jithuin/infogeezer
void CDockManager::OnMinMaxInfo(LPMINMAXINFO pMMI, BOOL /*bMain*/)
{
	if (IsMaximized())
	{
   		CSize sizeMin = GetMinMaximizedSize();
		CRect rWork = GetWorkArea();
		
		if (m_nDockPos == DMP_BELOW)
		{
			pMMI->ptMinTrackSize.y = sizeMin.cy;
			pMMI->ptMaxTrackSize.y = rWork.Height() - sizeMin.cy;
		}
		else
		{
			pMMI->ptMinTrackSize.x = sizeMin.cx;
			pMMI->ptMaxTrackSize.x = rWork.Width() - sizeMin.cx;
		}
	}
	else
	{
   		CSize sizeMin;
		if (m_nDockPos == DMP_BELOW)
		{
			sizeMin.cx = max(m_sizeMainMin.cx, m_sizeDockMin.cx);
			sizeMin.cy = m_sizeDockMin.cy;
		}
		else
		{
			sizeMin.cx = m_sizeDockMin.cx;
			sizeMin.cy = max(m_sizeMainMin.cy, m_sizeDockMin.cy);
		}
		
		pMMI->ptMinTrackSize.y = max(sizeMin.cy, pMMI->ptMinTrackSize.y);
		pMMI->ptMinTrackSize.x = max(sizeMin.cx, pMMI->ptMinTrackSize.x);
	}
}
コード例 #22
0
ファイル: ParamInfo.cpp プロジェクト: dreamsxin/ultimatepp
void AssistEditor::SyncParamInfo()
{
	String qtf;
	Ctrl *p = GetTopCtrl();
	int mpar = INT_MAX;
	int pos = 0;
	if(p && p->HasFocusDeep()) {
		for(int q = 0; q < PARAMN; q++) {
			ParamInfo& m = param[q];
			int i = GetCursorLine();
			if(m.line >= 0 && m.line < GetLineCount() && i >= m.line && i < m.line + 10
			   && m.editfile == theide->editfile && GetWLine(m.line).StartsWith(m.test)) {
				int c = GetCursor();
				i = GetPos(m.line) + m.test.GetCount();
				if(c >= i) {
					int par = 0;
					int pari = 0;
					for(;;) {
						int ch = Ch(i++);
						if(i > c) {
							if(par < mpar) {
								qtf = "[A1  " + DecoratedItem(m.item.name, m.item, m.item.natural, pari);
								mpar = par;
								pos = m.pos;
							}
							break;
						}
						if(ch == ')') {
							if(par <= 0)
								break;
							par--;
						}
						if(ch == '(')
							par++;
						if(ch == ',' && par == 0)
							pari++;
					}
				}
			}
		}
	}
	if(param_qtf != qtf)
		param_info.SetQTF(qtf);
	Rect r = GetLineScreenRect(GetCursorLine());
	int cx = max(GetSize().cx - 30, 300);
	int h = param_info.GetHeight(cx);
	h = min(h, 550);
	int y = r.top - h - 6;
	if(y < GetWorkArea().top)
		y = r.bottom;
	r = RectC(r.left, y, min(param_info.GetWidth(), cx) + 8, h + 6);
	r.OffsetHorz(GetColumnLine(pos).x * GetFontSize().cx);
	r.OffsetHorz(min(GetWorkArea().right - r.right, 0));
	if(param_qtf != qtf || r != param_info.GetRect()) {
		param_qtf = qtf;
		if(IsNull(qtf)) {
			if(param_info.IsOpen())
				param_info.Close();
		}
		else {
			param_info.SetRect(r);
			if(!param_info.IsOpen() && !IsSelection())
				param_info.Ctrl::PopUp(this, false, false, false);
		}
	}
}
コード例 #23
0
ファイル: WinSpyWindow.c プロジェクト: RaMMicHaeL/winspy
void GetPinnedPosition(HWND hwnd, POINT *pt)
{
	RECT rect;
	RECT rcDisplay;

	//
	GetWindowRect(hwnd, &rect);

	// get
	GetWorkArea(&rect, &rcDisplay);

	uPinnedCorner = PINNED_NONE;

	if (rect.left + szLastExp.cx >= rcDisplay.right)
		uPinnedCorner |= PINNED_RIGHT;
	else
		uPinnedCorner |= PINNED_LEFT;

	if (rect.top + szLastExp.cy >= rcDisplay.bottom)
		uPinnedCorner |= PINNED_BOTTOM;
	else
		uPinnedCorner |= PINNED_TOP;

	if (fPinWindow == FALSE)
		uPinnedCorner = PINNED_TOPLEFT;

	switch (uPinnedCorner)
	{
	case PINNED_TOPLEFT:
		pt->x = rect.left;
		pt->y = rect.top;
		break;

	case PINNED_TOPRIGHT:
		pt->x = rect.right;
		pt->y = rect.top;
		break;

	case PINNED_BOTTOMRIGHT:
		pt->x = rect.right;
		pt->y = rect.bottom;
		break;

	case PINNED_BOTTOMLEFT:
		pt->x = rect.left;
		pt->y = rect.bottom;
		break;

	}

	//
	// Sanity check!!!
	//
	// If the window is in an expanded state, and it is
	// moved so that its lower-right edge extends off the screen,
	// then when it is minimized, it will disappear (i.e. position
	// itself off-screen!). This check stops that
	//
	if (pt->x - szLastExp.cx < rcDisplay.left || pt->x >= rcDisplay.right)
	{
		pt->x = rect.left;
		uPinnedCorner &= ~PINNED_RIGHT;
	}

	if (pt->y - szLastExp.cy < rcDisplay.top || pt->y >= rcDisplay.bottom)
	{
		pt->y = rect.top;
		uPinnedCorner &= ~PINNED_BOTTOM;
	}
}
コード例 #24
0
ファイル: MenuBar.cpp プロジェクト: koz4k/soccer
void MenuBar::PopUp(Ctrl *owner, Point p, Size rsz)
{
	bool szcx = true;
	bool szcy = true;
	bool szx = false;
	bool szy = false;
	if(parentmenu) {
		if(parentmenu->IsChild())
			szcx = false;
		else
			szcy = false;
		WhenHelp = parentmenu->WhenHelp;
	}
	Rect r = GetWorkArea(p);
	restorefocus = GetFocusCtrl();
	LLOG("PopUp " << UPP::Name(this) << " set restorefocus:" << UPP::Name(restorefocus));
	DistributeAccessKeys();
	frame.Set(style->popupframe);
	if(GUI_GlobalStyle() >= GUISTYLE_XP)
		SetFrame(frame);
	else
		SetFrame(OutsetFrame());
	pane.SubMenu();
	Size sz = pane.Repos(false, r.Height());
	pane.RightPos(0, sz.cx).BottomPos(0, sz.cy);
	Size sz0 = sz;
	sz = AddFrameSize(sz);
	if(p.y + sz.cy > r.bottom) {
		if(p.y - r.top > r.bottom - p.y) {
			int y0;
			if (parentmenu && parentmenu->GetActiveSubmenu() && parentmenu->submenuitem) 
				y0 = parentmenu->submenuitem->GetScreenRect().BottomRight().y + 2 + rsz.cy;
			else
				y0 = p.y + rsz.cy;
			szy = szcy;
			sz = pane.Repos(false, y0 - max(y0 - sz.cy, r.top) - (sz.cy - sz0.cy));
			pane.RightPos(0, sz.cx).TopPos(0, sz.cy);
			sz = AddFrameSize(sz);
			p.y = y0 - sz.cy;
		}
		else {
			sz = pane.Repos(false, r.bottom - p.y - (sz.cy - sz0.cy));
			pane.RightPos(0, sz.cx).BottomPos(0, sz.cy);
			sz = AddFrameSize(sz);
		}
	}
	if(p.x + sz.cx > r.right) {
		p.x = max(p.x + rsz.cx - sz.cx, r.left);
		szx = szcx;
		pane.LeftPos(0, sz.cx);
	}
	bool eff = parentmenu == NULL || parentmenu->doeffect;
	if(eff && GUI_PopUpEffect() == GUIEFFECT_SLIDE)
		SetRect(szx ? p.x + sz.cx : p.x, szy ? p.y + sz.cy : p.y, parentmenu ? sz.cx : 1, 1);
	else
		SetRect(p.x, p.y, sz.cx, sz.cy);
#ifdef PLATFORM_WIN32
	DWORD dummy;
	CloseHandle(CreateThread(NULL, 0, PlaySoundThread, NULL, 0, &dummy));
#endif
	doeffect = true;
	Ctrl::PopUp(owner, true, true, GUI_DropShadows(), !owner);
	GuiPlatformAfterMenuPopUp();
	if(eff)
		Animate(*this, p.x, p.y, sz.cx, sz.cy);
}
コード例 #25
0
ファイル: DockManager.cpp プロジェクト: jithuin/infogeezer
void CDockManager::UpdateMainWindowPos()
{
	ASSERT (IsDocked());

	if (!IsDocked())
		return;

	CRect rMain, rDock;

	GetWindowRect(rMain);
	::GetWindowRect(ScGetHwnd(), rDock);

	// if the main window is maximized then shrink/enlarge
	// the window
	if (IsMaximized())
	{
		rMain = GetWorkArea();

		switch (m_nDockPos)
		{
		case DMP_LEFT:
			rMain.left = rDock.right;
			break;

		case DMP_RIGHT:
			rMain.right = rDock.left;
			break;

		case DMP_BELOW:
			rMain.bottom = rDock.top;
			break;

		default:
			ASSERT(0);
			return;
		}
	}
	// else just move the main window
	else
	{
		switch (m_nDockPos)
		{
		case DMP_LEFT:
			rMain.top = rDock.top;
			rMain.bottom = rDock.bottom;
			rMain.right = rDock.right + rMain.Width();
			rMain.left = rDock.right;
			break;

		case DMP_RIGHT:
			rMain.top = rDock.top;
			rMain.bottom = rDock.bottom;
			rMain.left = rDock.left - rMain.Width();
			rMain.right = rDock.left;
			break;

		case DMP_BELOW:
			rMain.left = rDock.left;
			rMain.right = rDock.right;
			rMain.top = rDock.top - rMain.Height();
			rMain.bottom = rDock.top;
			break;

		default:
			ASSERT(0);
			return;
		}
	}

	MoveWindow(GetCWnd(), rMain);
}
コード例 #26
0
ファイル: FormEdit.cpp プロジェクト: dreamsxin/ultimatepp
FormEdit::FormEdit()
{
	Title(t_("GUI Form Editor (c) Web\'n\'soft Group"));
	Sizeable().MinimizeBox().MaximizeBox();
	SetRect(GetWorkArea().CenterRect(1000, 700));

	_ToolSize = Size(HorzLayoutZoom(240), VertLayoutZoom(18));

	MultiButton::SubButton* b = &_GUILayouts.AddButton();
	b->SetImage(FormEditImg::AddGuiLayout());
	*b <<= THISBACK(AddGUILayout);
	b->Left();
	b = &_GUILayouts.AddButton();
	b->SetImage(FormEditImg::RemoveGuiLayout());
	*b <<= THISBACK(RemoveGUILayout);
	b->Left();

	b = &_GUILayouts.AddButton();
	b->Tip(t_("Lock interface..."));
	b->SetImage(FormEditImg::Locking());
	*b <<= THISBACK(ToggleLayoutLock);

	b = &_GUILayouts.AddButton();
	b->Tip(t_("Save layout"));
	b->SetImage(FormEditImg::SaveLayout());
	*b <<= THISBACK(SaveGUILayout);

	_GUILayouts.WhenAction = THISBACK(UpdateGUILayout);

	StdFontZoom();

	_ViewMode = VIEW_MODE_AS_IS;

	AddFrame(_MenuBar);
	AddFrame(TopSeparatorFrame());
	AddFrame(_ToolBar);

	Add(_CtrlContainer.SizePos());
	Add(_Container.SizePos());
	_View.Transparent();

	_Container.Set(_View, _View.GetPageRect().GetSize());

	_ItemProperties.WhenChildZ = THISBACK(UpdateChildZ);

	_View.SetContainer(_Container);
	_View.WhenUpdate = THISBACK(UpdateTools);
	_View.WhenObjectProperties = THISBACK(OpenObjectProperties);
	_View.WhenChildSelected = THISBACK(UpdateChildProperties);
	_View.WhenUpdateLayouts = THISBACK(UpdateLayoutList);
	_View.WhenChildAllPos = THISBACK(UpdateChildAllPos);
	_View.WhenChildCount = THISBACK(UpdateChildCount);
	_View.WhenUpdateTabs = THISBACK(UpdateTabCtrls);
	_View.WhenChildPos = THISBACK(UpdateChildPos);
	_View.WhenMenuBar = THISBACK(CreateToolBar);
	_View.WhenChildZ = THISBACK(UpdateChildZ);

	SetViewMode(VIEW_MODE_INFO);
	UpdateTools();

	_LayoutList.Appending().Removing().Editing().SetFrame(NullFrame());
	_LayoutList.AddColumn(t_("Name")).Edit(_LayoutNameField);
	_LayoutList.HideRow(0);
	_LayoutList.SetInfoOffset(0);
	_LayoutList.SetInfo(t_("No lays"));
	_LayoutList.NotUseKeys();
	_LayoutList.WhenNewRow = THISBACK(OnAddLayout);
	_LayoutList.WhenChangeRow = THISBACK(OnSelectLayout);
	_LayoutList.WhenUpdateRow = THISBACK(OnUpdateLayout);
	_LayoutList.WhenRemoveRow = THISBACK(OnRemoveLayout);

	_ItemList.Editing().EditMode(1).MultiSelect().SetFrame(NullFrame());
	_ItemList.AddColumn(t_("Type")).Edit(_TypeList);
	_ItemList.AddColumn(t_("Variable")).Edit(_ObjectNameField);
	_ItemList.SetInfo(t_("No items"));
	_ItemList.WhenMenuBar = THISBACK(CreateObjectMenu);
	_ItemList.WhenChangeRow = THISBACK(SelectItem);
	_ItemList.WhenLeftClick = THISBACK(SelectItem);
	_ItemList.NotUseKeys();
	_TypeList.Add("Button");
	_TypeList.Add("Label");
	_TypeList.Add("EditField");
	_TypeList.Add("EditInt");
	_TypeList.Add("DropDate");
	_TypeList.Add("TabCtrl");
	_TypeList.Add("GridCtrl");
	_TypeList.Add("ProgressBar");
	_TypeList.Add("Form");
	_TypeList.WhenAction = THISBACK(UpdateObjectType);
	_ItemList.WhenUpdateRow = THISBACK(UpdateObjectName);
	_ObjectNameField.WhenAction = THISBACK(UpdateTempObjectName);
#ifdef PLATFORM_WIN32
	_ItemList.Chameleon();
#endif

	_ItemProperties.SetFrame(NullFrame());

	NewFile();
}
コード例 #27
0
ファイル: DockManager.cpp プロジェクト: jithuin/infogeezer
void CDockManager::FitDockWindowToWorkArea()
{
	// make sure the dock window is fully visible
	CRect rDock, rMain, rWorkArea = GetWorkArea();
	::GetWindowRect(ScGetHwnd(), rDock);
	GetWindowRect(rMain);

	CRect rIntersect;
	
	// if it is then we're done
	if (rIntersect.IntersectRect(rWorkArea, rDock) && rIntersect == rDock)
		return;

	// else adjust the edges to be within the work area
	// try adjust the size until we hit m_sizeDockMin
	switch (m_nDockPos)
	{
		case DMP_LEFT:
			rDock.left = max(rDock.left, rWorkArea.left);
			rDock.right = max(rDock.left + m_sizeDockMin.cx, rDock.right);

			ScGetCWnd()->MoveWindow(rDock);

			// check we've not pushed the main window over
			if (rDock.right > rMain.left)
			{
				rMain.OffsetRect(rDock.right - rMain.left, 0);

				// and stop the right edge of the main window spilling out
				rMain.right = min(rMain.right, rWorkArea.right);

				GetCWnd()->MoveWindow(rMain);
			}
			break;

		case DMP_RIGHT:
			rDock.right = min(rDock.right, rWorkArea.right);
			rDock.left = min(rDock.right - m_sizeDockMin.cx, rDock.left);

			ScGetCWnd()->MoveWindow(rDock);

			// check we've not pushed the main window over
			if (rDock.left < rMain.right)
			{
				rMain.OffsetRect(rDock.left - rMain.right, 0);

				// and stop the left edge of the main window spilling out
				rMain.left = max(rMain.left, rWorkArea.left);

				GetCWnd()->MoveWindow(rMain);
			}
			break;

		case DMP_BELOW:
			rDock.bottom = min(rDock.bottom, rWorkArea.bottom);
			rDock.top = min(rDock.bottom - m_sizeDockMin.cy, rDock.top);

			ScGetCWnd()->MoveWindow(rDock);

			// check we've not pushed the main window over
			if (rDock.top < rMain.bottom)
			{
				rMain.OffsetRect(0, rDock.top - rMain.bottom);

				// and stop the top edge of the main window spilling out
				rMain.top = max(rMain.top, rWorkArea.top);

				GetCWnd()->MoveWindow(rMain);
			}
			break;

		case DMP_UNDOCKED:
			// just centre the window on the desktop
			ScGetCWnd()->CenterWindow();
			break;
	}
}
コード例 #28
0
ファイル: DockManager.cpp プロジェクト: jithuin/infogeezer
LRESULT CDockManager::ScWindowProc(HWND hRealWnd, UINT msg, WPARAM wp, LPARAM lp)
{
	switch (msg)
	{
	case WM_MOVE:
		if (IsDocked())
		{
			LRESULT lr = ScDefault(hRealWnd);

			if (m_bResizeUpdate)
				UpdateMainWindowPos();

			return lr;
		}
		break;

	case WM_SIZE:
		if (IsDocked())
		{
			LRESULT lr = ScDefault(hRealWnd);

			if (m_bResizeUpdate)
				UpdateMainWindowPos();

			// save dock width
			if (m_bSizeUpdate && ::IsWindowVisible(ScGetHwnd()))
			{
				CRect rDock;
				::GetWindowRect(ScGetHwnd(), rDock);

				if (IsMaximized())
				{
					if (m_nDockPos == DMP_BELOW)
						m_nHeightDockedMax = rDock.Height();
					else
						m_nWidthDockedMax = rDock.Width();
				}
				else
				{
					if (m_nDockPos == DMP_BELOW)
						m_nHeightDocked = rDock.Height();
					else
						m_nWidthDocked = rDock.Width();
				}
			}
			
			return lr;
		}
		break;

	case WM_SYSCOMMAND:
		if (IsDocked())
		{
			switch (wp)
			{
			// hide system menu
			case SC_KEYMENU:
			case SC_MOUSEMENU:
				return 0;
			
			// don't allow docked window to be minimized or maximized directly
			// instead, send the message to the main window
			case SC_MAXIMIZE:
			case SC_MINIMIZE:
				return SendMessage(msg, wp, lp);

			// if the dock window is being closed and the main window is maximized
			// then readjust the main window rect
			case SC_CLOSE:
				if (IsMaximized())
				{
					LRESULT lr = ScDefault(hRealWnd);

					OnMaximize();

					return lr;
				}
				break;
			}
		}
		break;

	case WM_NCRBUTTONDOWN:
		// if this is in the caption then eat it
		if (IsDocked() && wp == HTCAPTION)
		{
			// activate the window first
			ScSendMessage(WM_ACTIVATE, WA_CLICKACTIVE, NULL);
			return 0;
		}
		break;

	case WM_NCLBUTTONDOWN:
		// if this is in the caption and the main window in maxed
		// then eat
		if (IsDocked() && wp == HTCAPTION && IsMaximized())
		{
			// activate the window first
			ScSendMessage(WM_ACTIVATE, WA_CLICKACTIVE, NULL);
			return 0;
		}
		break;

	case WM_NCLBUTTONDBLCLK:
		if (wp == HTCAPTION)
		{
			// toggle the docked state
			if (IsDocked())
				UnDock();
			else
				Dock(m_nLastDockPos);

			// and eat the message
			return 0;
		}
		break;

	case WM_NCHITTEST:
		if (IsDocked())
		{
			UINT nHitTest = ScDefault(hRealWnd);

			// if the main window is _not_ unmaximized then don't let the 
			// docked window be resized on it's docked edge
			// because its not intuitive and causes no end of trouble :)
			if (!IsMaximized())
			{
				switch (m_nDockPos)
				{
				case DMP_LEFT:
					if (nHitTest == HTRIGHT || nHitTest == HTTOPRIGHT || nHitTest == HTBOTTOMRIGHT)
						nHitTest = HTCLIENT;
					break;

				case DMP_RIGHT:
					if (nHitTest == HTLEFT || nHitTest == HTTOPLEFT || nHitTest == HTBOTTOMLEFT)
						nHitTest = HTCLIENT;
					break;

				case DMP_BELOW:
					if (nHitTest == HTTOP || nHitTest == HTTOPLEFT || nHitTest == HTTOPRIGHT)
						nHitTest = HTCLIENT;
					break;

				default:
					ASSERT(0);
					break;
				}
			}
			// else main window is maximized so _only_ let it be resized on its
			// docked edge and resize the main window afterwards
			else 
			{
				switch (m_nDockPos)
				{
				case DMP_LEFT:
					if (nHitTest == HTTOPRIGHT || nHitTest == HTBOTTOMRIGHT ||
						nHitTest == HTLEFT || nHitTest == HTTOPLEFT || 
						nHitTest == HTBOTTOMLEFT ||	nHitTest == HTTOP || nHitTest == HTBOTTOM)
					{
						nHitTest = HTCLIENT;
					}
					break;

				case DMP_RIGHT:
					if (nHitTest == HTTOPRIGHT || nHitTest == HTBOTTOMRIGHT ||
						nHitTest == HTRIGHT || nHitTest == HTTOPLEFT || 
						nHitTest == HTBOTTOMLEFT ||	nHitTest == HTTOP || nHitTest == HTBOTTOM)
					{
						nHitTest = HTCLIENT;
					}
					break;

				case DMP_BELOW:
					if (nHitTest == HTTOPRIGHT || nHitTest == HTBOTTOMRIGHT ||
						nHitTest == HTRIGHT || nHitTest == HTTOPLEFT || 
						nHitTest == HTBOTTOMLEFT ||	nHitTest == HTLEFT || nHitTest == HTBOTTOM)
					{
						nHitTest = HTCLIENT;
					}
					break;

				default:
					ASSERT(0);
					break;
				}
			}

			return nHitTest;
		}
		break;

	case WM_GETMINMAXINFO:
		if (IsDocked())
		{
			LRESULT lr = ScDefault(hRealWnd);

			// save off our last min size
			LPMINMAXINFO pMMI = (LPMINMAXINFO)lp;
			m_sizeDockMin = pMMI->ptMinTrackSize;

			OnMinMaxInfo(pMMI, FALSE);
			return lr;
		}

	case WM_WINDOWPOSCHANGED:
		// if the dock window is being shown/hidden and the main window is maximized 
		// then adjust the main window rect
		if (IsDocked() && IsMaximized())
		{
			LPWINDOWPOS lpwp = (LPWINDOWPOS)lp;

			BOOL bVisible = ::IsWindowVisible(hRealWnd);
			BOOL bWantHide = (lpwp->flags & SWP_HIDEWINDOW);
			//BOOL bWantShow = (lpwp->flags & SWP_SHOWWINDOW);

			if (bVisible && bWantHide) // special case
			{
				CAutoFlag af(m_bResizeUpdate, FALSE);
				LRESULT lr = ScDefault(hRealWnd);

				CRect rMain = GetWorkArea();
				MoveWindow(GetCWnd(), rMain);
				
				return lr;

			}
			else //if (!bVisible && bWantShow)
			{
				LRESULT lr = ScDefault(hRealWnd);
				OnMaximize();
				
				return lr;
			}
		}
		break;
	}

	return ScDefault(hRealWnd);
}
コード例 #29
0
ファイル: DockManager.cpp プロジェクト: jithuin/infogeezer
void CDockManager::UpdateDockWindowPos()
{
	ASSERT (IsDocked());

	if (!IsDocked())
		return;

	CRect rMain, rDock;

	GetWindowRect(rMain);
	::GetWindowRect(ScGetHwnd(), rDock);

	if (IsMaximized())
	{
		CRect rWorkArea = GetWorkArea();

		switch (m_nDockPos)
		{
		case DMP_LEFT:
			rDock.top = rMain.top;
			rDock.bottom = rMain.bottom;
			rDock.left = rWorkArea.left;
			rDock.right = rMain.left;
			break;

		case DMP_RIGHT:
			rDock.top = rMain.top;
			rDock.bottom = rMain.bottom;
			rDock.right = rWorkArea.right;
			rDock.left = rMain.right;
			break;

		case DMP_BELOW:
			rDock.left = rMain.left;
			rDock.right = rMain.right;
			rDock.bottom = rWorkArea.bottom;
			rDock.top = rMain.bottom;
			break;

		default:
			ASSERT(0);
			return;
		}
	}
	else // not maximized
	{
		switch (m_nDockPos)
		{
		case DMP_LEFT:
			rDock.top = rMain.top;
			rDock.bottom = rMain.bottom;
			rDock.left = rMain.left - rDock.Width();
			rDock.right = rMain.left;
			break;

		case DMP_RIGHT:
			rDock.top = rMain.top;
			rDock.bottom = rMain.bottom;
			rDock.right = rMain.right + rDock.Width();
			rDock.left = rMain.right;
			break;

		case DMP_BELOW:
			rDock.left = rMain.left;
			rDock.right = rMain.right;
			rDock.bottom = rMain.bottom + rDock.Height();
			rDock.top = rMain.bottom;
			break;

		default:
			ASSERT(0);
			return;
		}
	}

	MoveWindow(ScGetCWnd(), rDock);
}
コード例 #30
0
ファイル: MainFrame.cpp プロジェクト: page31/GJTalk
void CMainFrame::DoAnimateDock()
{
	if(m_bMoving||m_Dock==DOCK_NONE)
	{
		StopAnimateDock();
		return;
	}
	RECT rc,rcWork;
	int dx=0,dy=0;
	POINT mp; 
	bool mousein;
	::GetCursorPos(&mp);
	GetWorkArea(&rcWork);
	::GetWindowRect(*this,&rc);
	mousein=mp.x>=rc.left&&mp.x<=rc.right&&mp.y>=rc.top&&mp.y<=rc.bottom;
	if(mousein)
	{
		switch (m_Dock)
		{ 
		case DOCK_TOP:
			dy=rcWork.top-rc.top;
			FIX_DOCK_P(dy);
			break;
		case DOCK_LEFT:
			dx=rcWork.left-rc.left;
			FIX_DOCK_P(dx);
			break;
		case DOCK_RIGHT:
			dx=rcWork.right-rc.right;
			FIX_DOCK_N(dy);
			break; 
		}
	}
	else
	{
		switch (m_Dock)
		{ 
		case DOCK_TOP:
			dy=rcWork.top-rc.bottom+DOCK_HANDLE_WIDTH;
			FIX_DOCK_N(dy);
			break;
		case DOCK_LEFT:
			dx=rcWork.left-rc.right+DOCK_HANDLE_WIDTH;
			FIX_DOCK_N(dx);
			break;
		case DOCK_RIGHT:
			dx=rcWork.right-rc.left-DOCK_HANDLE_WIDTH;
			FIX_DOCK_P(dx);
			break; 
		}
	}
	if(dx||dy)
	{
		OffsetRect(&rc,dx,dy);
		::SetWindowPos(*this,NULL,rc.left,rc.top,rc.right-rc.left,rc.bottom-rc.top,SWP_NOSIZE|SWP_NOZORDER);
	}
	else
	{
		StopAnimateDock();
		return;
	}
}