ReactOS  0.4.14-dev-50-g13bb5e2
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 509 of file rosui.h.

Constructor & Destructor Documentation

◆ CUiSplitPanel()

CUiSplitPanel::CUiSplitPanel ( )
inline

Definition at line 537 of file rosui.h.

538  {
541  m_Pos = 100;
542  m_MinFirst = 100;
543  m_MinSecond = 100;
546  }
BOOL m_HasOldRect
Definition: rosui.h:525
INT m_MinFirst
Definition: rosui.h:531
CUiMeasure m_Width
Definition: rosui.h:534
static CUiMeasure FitParent()
Definition: rosui.h:209
INT m_MinSecond
Definition: rosui.h:532
BOOL m_DynamicFirst
Definition: rosui.h:530
CUiMeasure m_Height
Definition: rosui.h:535
INT m_Pos
Definition: rosui.h:528

◆ ~CUiSplitPanel()

virtual CUiSplitPanel::~CUiSplitPanel ( )
inlinevirtual

Definition at line 548 of file rosui.h.

549  {
550  }

Member Function Documentation

◆ AsBox()

virtual CUiBox* CUiSplitPanel::AsBox ( )
inlinevirtual

Reimplemented from CUiPrimitive.

Definition at line 552 of file rosui.h.

552 { return this; }

◆ ComputeContentBounds()

virtual VOID CUiSplitPanel::ComputeContentBounds ( RECT rect)
inlinevirtual

Reimplemented from CUiBox.

Definition at line 567 of file rosui.h.

568  {
569  RECT r;
570 
573 
574  ::GetWindowRect(m_hWnd, &r);
575 
576  rect->left = min(rect->left, r.left);
577  rect->top = min(rect->top, r.top);
578  rect->right = max(rect->right, r.right);
579  rect->bottom = max(rect->bottom, r.bottom);
580  };
#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:520
CUiPanel m_Second
Definition: rosui.h:521
#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 557 of file rosui.h.

558  {
559  if (m_Horizontal)
560  size->cx = max(size->cx, THICKNESS);
561  else
562  size->cy = max(size->cy, THICKNESS);
565  };
#define max(a, b)
Definition: svc.c:63
virtual VOID ComputeMinimalSize(SIZE *size)
Definition: rosui.h:379
static const INT THICKNESS
Definition: rosui.h:514
GLsizeiptr size
Definition: glext.h:5919
CUiPanel m_First
Definition: rosui.h:520
BOOL m_Horizontal
Definition: rosui.h:529
CUiPanel m_Second
Definition: rosui.h:521

Referenced by OnParentSize().

◆ CountSizableChildren()

virtual DWORD_PTR CUiSplitPanel::CountSizableChildren ( )
inlinevirtual

Reimplemented from CUiBox.

Definition at line 582 of file rosui.h.

583  {
584  INT count = 1;
587  return count;
588  };
GLuint GLuint GLsizei count
Definition: gl.h:1545
int32_t INT
Definition: typedefs.h:56
CUiPanel m_First
Definition: rosui.h:520
CUiPanel m_Second
Definition: rosui.h:521
virtual DWORD_PTR CountSizableChildren()
Definition: rosui.h:403

Referenced by SetPos().

◆ Create()

HWND CUiSplitPanel::Create ( HWND  hwndParent)
inline

Definition at line 790 of file rosui.h.

791  {
792  if (m_Horizontal)
794  else
796 
798  DWORD exStyle = WS_EX_TRANSPARENT;
799 
800  RECT size = {205, 180, 465, THICKNESS};
801  size.right += size.left;
802  size.bottom += size.top;
803 
804  return CWindowImpl::Create(hwndParent, size, NULL, style, exStyle);
805  }
#define IDC_SIZEWE
Definition: winuser.h:689
HCURSOR m_hCursor
Definition: rosui.h:518
_In_ BOOLEAN Create
Definition: pstypes.h:511
static const INT THICKNESS
Definition: rosui.h:514
#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:529
#define LoadCursor
Definition: winuser.h:5713
Arabic default style
Definition: afstyles.h:93
#define WS_VISIBLE
Definition: pedump.c:620

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

◆ First()

CUiCollection& CUiSplitPanel::First ( )
inline

Definition at line 554 of file rosui.h.

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

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

◆ GetPos()

INT CUiSplitPanel::GetPos ( )
inline

Definition at line 742 of file rosui.h.

743  {
744  return m_Pos;
745  }
INT m_Pos
Definition: rosui.h:528

◆ OnParentSize()

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

Reimplemented from CUiBox.

Definition at line 590 of file rosui.h.

591  {
592  RECT rect = {0};
593 
594  SIZE content = {0};
596 
597  INT preferredWidth = m_Width.ComputeMeasure(parentRect.right - parentRect.left, content.cx);
598  INT preferredHeight = m_Width.ComputeMeasure(parentRect.bottom - parentRect.top, content.cy);
599 
600  rect.right = preferredWidth;
601  rect.bottom = preferredHeight;
602 
603  ComputeRect(parentRect, rect, &rect);
604 
605  SIZE growth = {0};
606  if (m_HasOldRect)
607  {
608  RECT oldRect = m_LastRect;
609 
610  growth.cx = (parentRect.right - parentRect.left) - (oldRect.right - oldRect.left);
611  growth.cy = (parentRect.bottom - parentRect.top) - (oldRect.bottom - oldRect.top);
612  }
613 
614  RECT splitter = rect;
615  RECT first = rect;
616  RECT second = rect;
617 
618  if (m_Horizontal)
619  {
620  rect.top += m_MinFirst;
621  rect.bottom -= THICKNESS + m_MinSecond;
622  if (m_DynamicFirst)
623  {
624  if (growth.cy > 0)
625  {
626  m_Pos += min(growth.cy, rect.bottom - (m_Pos + THICKNESS));
627  }
628  else if (growth.cy < 0)
629  {
630  m_Pos += max(growth.cy, rect.top - m_Pos);
631  }
632  }
633 
634  if (m_Pos > rect.bottom)
635  m_Pos = rect.bottom;
636 
637  if (m_Pos < rect.top)
638  m_Pos = rect.top;
639 
640  splitter.top = m_Pos;
641  splitter.bottom = m_Pos + THICKNESS;
642  first.bottom = splitter.top;
643  second.top = splitter.bottom;
644  }
645  else
646  {
647  rect.left += m_MinFirst;
648  rect.right -= THICKNESS + m_MinSecond;
649  if (m_DynamicFirst)
650  {
651  if (growth.cx > 0)
652  {
653  m_Pos += min(growth.cx, rect.right - (m_Pos + THICKNESS));
654  }
655  else if (growth.cx < 0)
656  {
657  m_Pos += max(growth.cy, rect.left - m_Pos);
658  }
659  }
660 
661  if (m_Pos > rect.right)
662  m_Pos = rect.right;
663 
664  if (m_Pos < rect.left)
665  m_Pos = rect.left;
666 
667  splitter.left = m_Pos;
668  splitter.right = m_Pos + THICKNESS;
669  first.right = splitter.left;
670  second.left = splitter.right;
671  }
672 
673  m_LastRect = parentRect;
674  m_HasOldRect = TRUE;
675 
676  hDwp = m_First.OnParentSize(first, hDwp);
677  hDwp = m_Second.OnParentSize(second, hDwp);
678 
679  if (hDwp)
680  {
681  return DeferWindowPos(hDwp, NULL,
682  splitter.left, splitter.top,
683  splitter.right - splitter.left,
684  splitter.bottom - splitter.top,
686  }
687  else
688  {
690  splitter.left, splitter.top,
691  splitter.right - splitter.left,
692  splitter.bottom - splitter.top,
694  return NULL;
695  }
696  };
BOOL m_HasOldRect
Definition: rosui.h:525
#define max(a, b)
Definition: svc.c:63
#define TRUE
Definition: types.h:120
RECT m_LastRect
Definition: rosui.h:523
static const INT THICKNESS
Definition: rosui.h:514
const GLint * first
Definition: glext.h:5794
INT m_MinFirst
Definition: rosui.h:531
LONG top
Definition: windef.h:292
LONG left
Definition: windef.h:291
#define SWP_NOZORDER
Definition: winuser.h:1232
CUiMeasure m_Width
Definition: rosui.h:534
LONG right
Definition: windef.h:293
int32_t INT
Definition: typedefs.h:56
& 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:994
smooth NULL
Definition: ftsmooth.c:416
LONG cx
Definition: windef.h:319
INT m_MinSecond
Definition: rosui.h:532
virtual VOID ComputeMinimalSize(SIZE *size)
Definition: rosui.h:557
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:520
BOOL m_DynamicFirst
Definition: rosui.h:530
#define SWP_NOACTIVATE
Definition: winuser.h:1227
BOOL m_Horizontal
Definition: rosui.h:529
CUiPanel m_Second
Definition: rosui.h:521
INT m_Pos
Definition: rosui.h:528
#define min(a, b)
Definition: monoChain.cc:55
LONG bottom
Definition: windef.h:294
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
LONG cy
Definition: windef.h:320

Referenced by SetPos().

◆ ProcessWindowMessage()

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

Definition at line 699 of file rosui.h.

700  {
701  theResult = 0;
702  switch (Msg)
703  {
704  case WM_SETCURSOR:
706  theResult = TRUE;
707  break;
708 
709  case WM_LBUTTONDOWN:
710  SetCapture();
711  break;
712 
713  case WM_LBUTTONUP:
714  case WM_RBUTTONDOWN:
715  if (GetCapture() == m_hWnd)
716  {
717  ReleaseCapture();
718  }
719  break;
720 
721  case WM_MOUSEMOVE:
722  if (GetCapture() == m_hWnd)
723  {
724  POINT Point;
727  if (m_Horizontal)
728  SetPos(Point.y);
729  else
730  SetPos(Point.x);
731  }
732  break;
733 
734  default:
735  return FALSE;
736  }
737 
738  return TRUE;
739  }
#define TRUE
Definition: types.h:120
#define WM_LBUTTONDOWN
Definition: winuser.h:1758
HCURSOR m_hCursor
Definition: rosui.h:518
BOOL WINAPI GetCursorPos(_Out_ LPPOINT)
Definition: cursoricon.c:2635
struct @1576 Msg[]
#define WM_SETCURSOR
Definition: winuser.h:1618
HWND WINAPI GetCapture(void)
Definition: message.c:2879
#define WM_RBUTTONDOWN
Definition: winuser.h:1761
BOOL m_Horizontal
Definition: rosui.h:529
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:2888
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)
VOID SetPos(INT NewPos)
Definition: rosui.h:747

◆ Second()

CUiCollection& CUiSplitPanel::Second ( )
inline

Definition at line 555 of file rosui.h.

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

Referenced by CMainWindow::CreateHSplitter(), and CMainWindow::CreateRichEdit().

◆ SetPos()

VOID CUiSplitPanel::SetPos ( INT  NewPos)
inline

Definition at line 747 of file rosui.h.

748  {
749  RECT rcParent;
750 
751  rcParent = m_LastRect;
752 
753  if (m_Horizontal)
754  {
755  rcParent.bottom -= THICKNESS;
756 
757  m_Pos = NewPos;
758 
759  if (m_Pos < rcParent.top)
760  m_Pos = rcParent.top;
761 
762  if (m_Pos > rcParent.bottom)
763  m_Pos = rcParent.bottom;
764  }
765  else
766  {
767  rcParent.right -= THICKNESS;
768 
769  m_Pos = NewPos;
770 
771  if (m_Pos < rcParent.left)
772  m_Pos = rcParent.left;
773 
774  if (m_Pos > rcParent.right)
775  m_Pos = rcParent.right;
776  }
777 
779 
780  HDWP hdwp = NULL;
781  hdwp = BeginDeferWindowPos(count);
782  if (hdwp) hdwp = OnParentSize(m_LastRect, hdwp);
783  if (hdwp) EndDeferWindowPos(hdwp);
784  }
HDWP WINAPI BeginDeferWindowPos(_In_ int)
RECT m_LastRect
Definition: rosui.h:523
static const INT THICKNESS
Definition: rosui.h:514
GLuint GLuint GLsizei count
Definition: gl.h:1545
LONG top
Definition: windef.h:292
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
int32_t INT
Definition: typedefs.h:56
BOOL WINAPI EndDeferWindowPos(_In_ HDWP)
virtual DWORD_PTR CountSizableChildren()
Definition: rosui.h:582
smooth NULL
Definition: ftsmooth.c:416
BOOL m_Horizontal
Definition: rosui.h:529
virtual HDWP OnParentSize(RECT parentRect, HDWP hDwp)
Definition: rosui.h:590
INT m_Pos
Definition: rosui.h:528
LONG bottom
Definition: windef.h:294

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 525 of file rosui.h.

Referenced by CUiSplitPanel(), and OnParentSize().

◆ m_hCursor

HCURSOR CUiSplitPanel::m_hCursor
protected

Definition at line 518 of file rosui.h.

Referenced by Create(), and ProcessWindowMessage().

◆ m_Height

CUiMeasure CUiSplitPanel::m_Height

Definition at line 535 of file rosui.h.

Referenced by CUiSplitPanel().

◆ m_Horizontal

◆ m_LastRect

RECT CUiSplitPanel::m_LastRect
protected

Definition at line 523 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 534 of file rosui.h.

Referenced by CUiSplitPanel(), and OnParentSize().

◆ THICKNESS

const INT CUiSplitPanel::THICKNESS = 4
staticprivate

Definition at line 514 of file rosui.h.

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


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