ReactOS  0.4.15-dev-1018-g0695ecb
CUiSplitPanel Class Reference

#include <rosui.h>

Inheritance diagram for CUiSplitPanel:
Collaboration diagram for CUiSplitPanel:

Public Member Functions

 CUiSplitPanel ()
 
virtual ~CUiSplitPanel ()
 
virtual CUiBoxAsBox ()
 
CUiCollectionFirst ()
 
CUiCollectionSecond ()
 
virtual VOID ComputeMinimalSize (SIZE *size)
 
virtual VOID ComputeContentBounds (RECT *rect)
 
virtual DWORD_PTR CountSizableChildren ()
 
virtual HDWP OnParentSize (RECT parentRect, HDWP hDwp)
 
INT GetPos ()
 
VOID SetPos (INT NewPos)
 
HWND Create (HWND hwndParent)
 
- Public Member Functions inherited from CUiPrimitive
virtual ~CUiPrimitive ()
 

Public Attributes

INT m_Pos
 
BOOL m_Horizontal
 
BOOL m_DynamicFirst
 
INT m_MinFirst
 
INT m_MinSecond
 
CUiMeasure m_Width
 
CUiMeasure m_Height
 
- Public Attributes inherited from CUiBox
CUiMargin m_Margin
 
CUiAlignment m_HorizontalAlignment
 
CUiAlignment m_VerticalAlignment
 

Protected Attributes

HCURSOR m_hCursor
 
CUiPanel m_First
 
CUiPanel m_Second
 
RECT m_LastRect
 
BOOL m_HasOldRect
 
- Protected Attributes inherited from CUiPrimitive
CUiPrimitivem_Parent
 

Private Member Functions

BOOL ProcessWindowMessage (HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam, LRESULT &theResult, DWORD dwMapId)
 

Static Private Attributes

static const INT THICKNESS = 4
 

Additional Inherited Members

- Protected Member Functions inherited from CUiBox
 CUiBox ()
 
virtual VOID ComputeRect (RECT parentRect, RECT currentRect, RECT *newRect)
 

Detailed Description

Definition at line 518 of file rosui.h.

Constructor & Destructor Documentation

◆ CUiSplitPanel()

CUiSplitPanel::CUiSplitPanel ( )
inline

Definition at line 546 of file rosui.h.

547  {
550  m_Pos = 100;
551  m_MinFirst = 100;
552  m_MinSecond = 100;
555  }
BOOL m_HasOldRect
Definition: rosui.h:534
INT m_MinFirst
Definition: rosui.h:540
CUiMeasure m_Width
Definition: rosui.h:543
#define FALSE
Definition: types.h:117
static CUiMeasure FitParent()
Definition: rosui.h:209
INT m_MinSecond
Definition: rosui.h:541
BOOL m_DynamicFirst
Definition: rosui.h:539
CUiMeasure m_Height
Definition: rosui.h:544
INT m_Pos
Definition: rosui.h:537

◆ ~CUiSplitPanel()

virtual CUiSplitPanel::~CUiSplitPanel ( )
inlinevirtual

Definition at line 557 of file rosui.h.

558  {
559  }

Member Function Documentation

◆ AsBox()

virtual CUiBox* CUiSplitPanel::AsBox ( )
inlinevirtual

Reimplemented from CUiPrimitive.

Definition at line 561 of file rosui.h.

561 { return this; }

◆ ComputeContentBounds()

virtual VOID CUiSplitPanel::ComputeContentBounds ( RECT rect)
inlinevirtual

Reimplemented from CUiBox.

Definition at line 576 of file rosui.h.

577  {
578  RECT r;
579 
582 
583  ::GetWindowRect(m_hWnd, &r);
584 
585  rect->left = min(rect->left, r.left);
586  rect->top = min(rect->top, r.top);
587  rect->right = max(rect->right, r.right);
588  rect->bottom = max(rect->bottom, r.bottom);
589  };
#define max(a, b)
Definition: svc.c:63
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
& rect
Definition: startmenu.cpp:1413
CUiPanel m_First
Definition: rosui.h:529
CUiPanel m_Second
Definition: rosui.h:530
#define min(a, b)
Definition: monoChain.cc:55
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
virtual VOID ComputeContentBounds(RECT *rect)
Definition: rosui.h:391

◆ ComputeMinimalSize()

virtual VOID CUiSplitPanel::ComputeMinimalSize ( SIZE size)
inlinevirtual

Reimplemented from CUiBox.

Definition at line 566 of file rosui.h.

567  {
568  if (m_Horizontal)
569  size->cx = max(size->cx, THICKNESS);
570  else
571  size->cy = max(size->cy, THICKNESS);
574  };
#define max(a, b)
Definition: svc.c:63
virtual VOID ComputeMinimalSize(SIZE *size)
Definition: rosui.h:379
static const INT THICKNESS
Definition: rosui.h:523
GLsizeiptr size
Definition: glext.h:5919
CUiPanel m_First
Definition: rosui.h:529
BOOL m_Horizontal
Definition: rosui.h:538
CUiPanel m_Second
Definition: rosui.h:530

Referenced by OnParentSize().

◆ CountSizableChildren()

virtual DWORD_PTR CUiSplitPanel::CountSizableChildren ( )
inlinevirtual

Reimplemented from CUiBox.

Definition at line 591 of file rosui.h.

592  {
593  INT count = 1;
596  return count;
597  };
GLuint GLuint GLsizei count
Definition: gl.h:1545
int32_t INT
Definition: typedefs.h:58
CUiPanel m_First
Definition: rosui.h:529
CUiPanel m_Second
Definition: rosui.h:530
virtual DWORD_PTR CountSizableChildren()
Definition: rosui.h:403

Referenced by SetPos().

◆ Create()

HWND CUiSplitPanel::Create ( HWND  hwndParent)
inline

Definition at line 799 of file rosui.h.

800  {
801  if (m_Horizontal)
803  else
805 
807  DWORD exStyle = WS_EX_TRANSPARENT;
808 
809  RECT size = {205, 180, 465, THICKNESS};
810  size.right += size.left;
811  size.bottom += size.top;
812 
813  return CWindowImpl::Create(hwndParent, size, NULL, style, exStyle);
814  }
#define IDC_SIZEWE
Definition: winuser.h:689
HCURSOR m_hCursor
Definition: rosui.h:527
_In_ BOOLEAN Create
Definition: pstypes.h:519
static const INT THICKNESS
Definition: rosui.h:523
#define WS_EX_TRANSPARENT
Definition: pedump.c:649
#define WS_CHILD
Definition: pedump.c:617
#define IDC_SIZENS
Definition: winuser.h:690
smooth NULL
Definition: ftsmooth.c:416
static HWND hwndParent
Definition: cryptui.c:300
GLsizeiptr size
Definition: glext.h:5919
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL m_Horizontal
Definition: rosui.h:538
#define LoadCursor
Definition: winuser.h:5787
Arabic default style
Definition: afstyles.h:93
#define WS_VISIBLE
Definition: pedump.c:620

Referenced by CApplicationView::CreateHSplitter(), and CMainWindow::CreateVSplitter().

◆ First()

CUiCollection& CUiSplitPanel::First ( )
inline

Definition at line 563 of file rosui.h.

563 { return m_First.Children(); }
CUiPanel m_First
Definition: rosui.h:529
CUiCollection & Children()
Definition: rosui.h:355

Referenced by CApplicationView::CreateListView(), and CMainWindow::CreateTreeView().

◆ GetPos()

INT CUiSplitPanel::GetPos ( )
inline

Definition at line 751 of file rosui.h.

752  {
753  return m_Pos;
754  }
INT m_Pos
Definition: rosui.h:537

◆ OnParentSize()

virtual HDWP CUiSplitPanel::OnParentSize ( RECT  parentRect,
HDWP  hDwp 
)
inlinevirtual

Reimplemented from CUiBox.

Definition at line 599 of file rosui.h.

600  {
601  RECT rect = {0};
602 
603  SIZE content = {0};
605 
606  INT preferredWidth = m_Width.ComputeMeasure(parentRect.right - parentRect.left, content.cx);
607  INT preferredHeight = m_Width.ComputeMeasure(parentRect.bottom - parentRect.top, content.cy);
608 
609  rect.right = preferredWidth;
610  rect.bottom = preferredHeight;
611 
612  ComputeRect(parentRect, rect, &rect);
613 
614  SIZE growth = {0};
615  if (m_HasOldRect)
616  {
617  RECT oldRect = m_LastRect;
618 
619  growth.cx = (parentRect.right - parentRect.left) - (oldRect.right - oldRect.left);
620  growth.cy = (parentRect.bottom - parentRect.top) - (oldRect.bottom - oldRect.top);
621  }
622 
623  RECT splitter = rect;
624  RECT first = rect;
625  RECT second = rect;
626 
627  if (m_Horizontal)
628  {
629  rect.top += m_MinFirst;
630  rect.bottom -= THICKNESS + m_MinSecond;
631  if (m_DynamicFirst)
632  {
633  if (growth.cy > 0)
634  {
635  m_Pos += min(growth.cy, rect.bottom - (m_Pos + THICKNESS));
636  }
637  else if (growth.cy < 0)
638  {
639  m_Pos += max(growth.cy, rect.top - m_Pos);
640  }
641  }
642 
643  if (m_Pos > rect.bottom)
644  m_Pos = rect.bottom;
645 
646  if (m_Pos < rect.top)
647  m_Pos = rect.top;
648 
649  splitter.top = m_Pos;
650  splitter.bottom = m_Pos + THICKNESS;
651  first.bottom = splitter.top;
652  second.top = splitter.bottom;
653  }
654  else
655  {
656  rect.left += m_MinFirst;
657  rect.right -= THICKNESS + m_MinSecond;
658  if (m_DynamicFirst)
659  {
660  if (growth.cx > 0)
661  {
662  m_Pos += min(growth.cx, rect.right - (m_Pos + THICKNESS));
663  }
664  else if (growth.cx < 0)
665  {
666  m_Pos += max(growth.cy, rect.left - m_Pos);
667  }
668  }
669 
670  if (m_Pos > rect.right)
671  m_Pos = rect.right;
672 
673  if (m_Pos < rect.left)
674  m_Pos = rect.left;
675 
676  splitter.left = m_Pos;
677  splitter.right = m_Pos + THICKNESS;
678  first.right = splitter.left;
679  second.left = splitter.right;
680  }
681 
682  m_LastRect = parentRect;
683  m_HasOldRect = TRUE;
684 
685  hDwp = m_First.OnParentSize(first, hDwp);
686  hDwp = m_Second.OnParentSize(second, hDwp);
687 
688  if (hDwp)
689  {
690  return DeferWindowPos(hDwp, NULL,
691  splitter.left, splitter.top,
692  splitter.right - splitter.left,
693  splitter.bottom - splitter.top,
695  }
696  else
697  {
699  splitter.left, splitter.top,
700  splitter.right - splitter.left,
701  splitter.bottom - splitter.top,
703  return NULL;
704  }
705  };
BOOL m_HasOldRect
Definition: rosui.h:534
#define max(a, b)
Definition: svc.c:63
RECT m_LastRect
Definition: rosui.h:532
#define TRUE
Definition: types.h:120
static const INT THICKNESS
Definition: rosui.h:523
const GLint * first
Definition: glext.h:5794
INT m_MinFirst
Definition: rosui.h:540
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
#define SWP_NOZORDER
Definition: winuser.h:1232
CUiMeasure m_Width
Definition: rosui.h:543
LONG right
Definition: windef.h:308
int32_t INT
Definition: typedefs.h:58
& rect
Definition: startmenu.cpp:1413
virtual HDWP OnParentSize(RECT parentRect, HDWP hDwp)
Definition: rosui.h:417
INT ComputeMeasure(INT parent, INT content)
Definition: rosui.h:186
content
Definition: atl_ax.c:993
smooth NULL
Definition: ftsmooth.c:416
LONG cx
Definition: windef.h:334
INT m_MinSecond
Definition: rosui.h:541
virtual VOID ComputeMinimalSize(SIZE *size)
Definition: rosui.h:566
virtual VOID ComputeRect(RECT parentRect, RECT currentRect, RECT *newRect)
Definition: rosui.h:248
HDWP WINAPI DeferWindowPos(_In_ HDWP, _In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
CUiPanel m_First
Definition: rosui.h:529
BOOL m_DynamicFirst
Definition: rosui.h:539
#define SWP_NOACTIVATE
Definition: winuser.h:1227
BOOL m_Horizontal
Definition: rosui.h:538
CUiPanel m_Second
Definition: rosui.h:530
INT m_Pos
Definition: rosui.h:537
#define min(a, b)
Definition: monoChain.cc:55
LONG bottom
Definition: windef.h:309
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
LONG cy
Definition: windef.h:335

Referenced by SetPos().

◆ ProcessWindowMessage()

BOOL CUiSplitPanel::ProcessWindowMessage ( HWND  hwnd,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam,
LRESULT theResult,
DWORD  dwMapId 
)
inlineprivate

Definition at line 708 of file rosui.h.

709  {
710  theResult = 0;
711  switch (Msg)
712  {
713  case WM_SETCURSOR:
715  theResult = TRUE;
716  break;
717 
718  case WM_LBUTTONDOWN:
719  SetCapture();
720  break;
721 
722  case WM_LBUTTONUP:
723  case WM_RBUTTONDOWN:
724  if (GetCapture() == m_hWnd)
725  {
726  ReleaseCapture();
727  }
728  break;
729 
730  case WM_MOUSEMOVE:
731  if (GetCapture() == m_hWnd)
732  {
733  POINT Point;
736  if (m_Horizontal)
737  SetPos(Point.y);
738  else
739  SetPos(Point.x);
740  }
741  break;
742 
743  default:
744  return FALSE;
745  }
746 
747  return TRUE;
748  }
#define WM_LBUTTONDOWN
Definition: winuser.h:1758
HCURSOR m_hCursor
Definition: rosui.h:527
#define TRUE
Definition: types.h:120
struct @1610 Msg[]
BOOL WINAPI GetCursorPos(_Out_ LPPOINT)
Definition: cursoricon.c:2635
#define FALSE
Definition: types.h:117
#define WM_SETCURSOR
Definition: winuser.h:1618
HWND WINAPI GetCapture(void)
Definition: message.c:2880
#define WM_RBUTTONDOWN
Definition: winuser.h:1761
BOOL m_Horizontal
Definition: rosui.h:538
struct Point Point
HWND WINAPI GetParent(_In_ HWND)
HWND WINAPI SetCapture(_In_ HWND hWnd)
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
#define WM_LBUTTONUP
Definition: winuser.h:1759
#define WM_MOUSEMOVE
Definition: winuser.h:1757
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2889
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)
VOID SetPos(INT NewPos)
Definition: rosui.h:756

◆ Second()

CUiCollection& CUiSplitPanel::Second ( )
inline

Definition at line 564 of file rosui.h.

564 { return m_Second.Children(); }
CUiPanel m_Second
Definition: rosui.h:530
CUiCollection & Children()
Definition: rosui.h:355

Referenced by CApplicationView::CreateAppInfoDisplay(), and CMainWindow::CreateApplicationView().

◆ SetPos()

VOID CUiSplitPanel::SetPos ( INT  NewPos)
inline

Definition at line 756 of file rosui.h.

757  {
758  RECT rcParent;
759 
760  rcParent = m_LastRect;
761 
762  if (m_Horizontal)
763  {
764  rcParent.bottom -= THICKNESS;
765 
766  m_Pos = NewPos;
767 
768  if (m_Pos < rcParent.top)
769  m_Pos = rcParent.top;
770 
771  if (m_Pos > rcParent.bottom)
772  m_Pos = rcParent.bottom;
773  }
774  else
775  {
776  rcParent.right -= THICKNESS;
777 
778  m_Pos = NewPos;
779 
780  if (m_Pos < rcParent.left)
781  m_Pos = rcParent.left;
782 
783  if (m_Pos > rcParent.right)
784  m_Pos = rcParent.right;
785  }
786 
788 
789  HDWP hdwp = NULL;
790  hdwp = BeginDeferWindowPos(count);
791  if (hdwp) hdwp = OnParentSize(m_LastRect, hdwp);
792  if (hdwp) EndDeferWindowPos(hdwp);
793  }
HDWP WINAPI BeginDeferWindowPos(_In_ int)
RECT m_LastRect
Definition: rosui.h:532
static const INT THICKNESS
Definition: rosui.h:523
GLuint GLuint GLsizei count
Definition: gl.h:1545
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
int32_t INT
Definition: typedefs.h:58
BOOL WINAPI EndDeferWindowPos(_In_ HDWP)
virtual DWORD_PTR CountSizableChildren()
Definition: rosui.h:591
smooth NULL
Definition: ftsmooth.c:416
BOOL m_Horizontal
Definition: rosui.h:538
virtual HDWP OnParentSize(RECT parentRect, HDWP hDwp)
Definition: rosui.h:599
INT m_Pos
Definition: rosui.h:537
LONG bottom
Definition: windef.h:309

Referenced by ProcessWindowMessage().

Member Data Documentation

◆ m_DynamicFirst

BOOL CUiSplitPanel::m_DynamicFirst

◆ m_First

CUiPanel CUiSplitPanel::m_First
protected

◆ m_HasOldRect

BOOL CUiSplitPanel::m_HasOldRect
protected

Definition at line 534 of file rosui.h.

Referenced by CUiSplitPanel(), and OnParentSize().

◆ m_hCursor

HCURSOR CUiSplitPanel::m_hCursor
protected

Definition at line 527 of file rosui.h.

Referenced by Create(), and ProcessWindowMessage().

◆ m_Height

CUiMeasure CUiSplitPanel::m_Height

Definition at line 544 of file rosui.h.

Referenced by CUiSplitPanel().

◆ m_Horizontal

◆ m_LastRect

RECT CUiSplitPanel::m_LastRect
protected

Definition at line 532 of file rosui.h.

Referenced by OnParentSize(), and SetPos().

◆ m_MinFirst

INT CUiSplitPanel::m_MinFirst

◆ m_MinSecond

INT CUiSplitPanel::m_MinSecond

◆ m_Pos

INT CUiSplitPanel::m_Pos

◆ m_Second

CUiPanel CUiSplitPanel::m_Second
protected

◆ m_Width

CUiMeasure CUiSplitPanel::m_Width

Definition at line 543 of file rosui.h.

Referenced by CUiSplitPanel(), and OnParentSize().

◆ THICKNESS

const INT CUiSplitPanel::THICKNESS = 4
staticprivate

Definition at line 523 of file rosui.h.

Referenced by ComputeMinimalSize(), Create(), OnParentSize(), and SetPos().


The documentation for this class was generated from the following file: