31#define OWL_CLIP_TAB_BOUNDING_RECT_ 0
32#define OWL_DRAW_TAB_BOUNDING_RECT_ 0
34#if OWL_CLIP_TAB_BOUNDING_RECT_
36bool ShouldClipTabBoundingRect_ =
false;
40#if OWL_DRAW_TAB_BOUNDING_RECT_
42bool ShouldDrawTabBoundingRect_ =
false;
66 int x,
int y,
int w,
int h,
71 TControl(parent, id, nullptr, x, y, w, h, module),
72 WindowFace(!dialogBuddy),
88 TControl(parent, resourceId, module),
89 WindowFace(!dialogBuddy),
115 BuddyHandle = Buddy->GetHandle();
129 return Insert(label,
GetCount(), clientData, imageIdx, imageLoc, shouldSelect);
146 TabList.insert(TabList.begin() + index,
164 if (index < 0 || index >=
GetCount())
return false;
170 for (
int i = index; i <
GetCount(); i++)
176 TabList.erase(TabList.begin() + index);
186 if (index < SelectedTab || SelectedTab == n)
188 CHECK(SelectedTab >= -1 && SelectedTab < n);
189 if (index < FirstVisibleTab || FirstVisibleTab == n)
191 CHECK(FirstVisibleTab >= -1 && FirstVisibleTab < n);
195 if ((SelectedTab >= 0) && (SelectedTab < n))
225 return static_cast<int>(TabList.size());
248 if (index < 0 || index >=
GetCount())
return -1;
249 if (index == SelectedTab)
return index;
254 if (SelectedTab >= 0 && SelectedTab <
GetCount())
264 if (SelectedTab >= 0 && SelectedTab <
GetCount())
274 for (
int i = 0; i !=
GetCount(); ++i)
277 labelHeight = std::max(labelHeight,
static_cast<int>(TabList[i].LabelSize.cy));
316 LabelImageMargin = v;
356 SelectedTabProtrusion = v;
387 return SelectedTabFont ? *SelectedTabFont : *TabFont;
417 SelectedTabColor = v;
441 tabItem = TabList[index];
462 if (index <
GetCount() && index >= 0) {
464 TabList[index] = tabItem;
515 ShouldUseThemes =
false;
517 LabelMargin =
TSize(5, 3);
518 SelectedTabProtrusion = 0;
519 LabelImageMargin = 3;
520 FocusMargin =
TSize(2, 2);
530 SelectedTabFont.reset();
534 OwnedCelArray.reset();
539 ScrollButtons =
new TUpDown{
this, -1, 0, 0, 0, 0};
550TNoteTab::GetBoundingRect(
const TRect& tabRect)
const
554 return tabRect.
IsEmpty() ?
TRect() : tabRect.InflatedBy(TabTapering, 0);
604 const TFont& TabFont;
605 const TFont& SelectedTabFont;
611 const TRect& paintRect,
612 const TFont& tabFont,
613 const TFont& selectedTabFont,
616 TColor selectedTabColor,
619 : Window(w), Dc(dc), TabFont(tabFont), SelectedTabFont(selectedTabFont), TabTextColor(tabTextColor)
622 void PaintPageEdge(
const TSize& margin)
625 void PaintTabFace(
const TRect& tabBoundingRect, TPoint (&pt)[4],
bool isSelectedTab)
628 void DrawTabContour(
const TPoint (&pt)[4],
bool isSelectedTab)
631 void PaintTabIcon(
const TNoteTabItem& tab,
const TCelArray& celArray, TColor transparentColor,
const TSize& labelMargin,
bool isSelectedTab,
int selectedTabProtrusion)
633 CHECK(!tab.Rect.IsEmpty());
634 int dy = isSelectedTab ? selectedTabProtrusion : 0;
635 TRect imageRect(tab.Rect.TopLeft() + TSize(0, dy), tab.Rect.BottomRight());
636 TUIFace face(imageRect, celArray, transparentColor);
637 TSize size = celArray.CelSize();
638 TRect srcRect(celArray.CelRect(tab.ImageIdx));
640 (tab.ImageLoc ==
alRight) ? imageRect.Width() - (size.cx + labelMargin.cx) : labelMargin.cx,
641 (imageRect.Height() - size.cy) / 2);
645 void DrawTabText(
const TNoteTabItem& tab,
const TCelArray* celArray,
const TSize& labelMargin,
int labelImageMargin,
bool isSelectedTab,
int selectedTabProtrusion)
647 bool hasImage = celArray && tab.ImageIdx >= 0;
648 int leftMargin = tab.Rect.left + labelMargin.cx;
649 int rightMargin = tab.Rect.right - labelMargin.cx;
650 int topMargin = labelMargin.cy + (isSelectedTab ? selectedTabProtrusion : 0);
652 (hasImage && tab.ImageLoc ==
alLeft) ? (leftMargin + celArray->CelSize().cx + labelImageMargin) : leftMargin,
653 tab.Rect.top + topMargin,
654 (hasImage && tab.ImageLoc ==
alRight) ? (rightMargin - celArray->CelSize().cx - labelImageMargin) : rightMargin,
655 tab.Rect.bottom - labelMargin.cy);
656 uint16 labelAlign =
static_cast<uint16>(!hasImage ? DT_CENTER : (tab.ImageLoc ==
alRight ? DT_RIGHT : DT_LEFT));
657 uint16 labelFormat =
static_cast<uint16>(DT_SINGLELINE | DT_VCENTER | labelAlign);
658 int oldBkMode = Dc.SetBkMode(TRANSPARENT);
659 Dc.SetTextColor(TabTextColor);
660 Dc.SelectObject(isSelectedTab ? SelectedTabFont : TabFont);
661 Dc.DrawText(tab.Label, -1, labelRect, labelFormat);
662 Dc.SetBkMode(oldBkMode);
665 void DrawTabFocusRect(
const TNoteTabItem& tab,
const TSize& focusMargin,
int selectedTabProtrusion)
667 DrawTabFocusRect(Dc, tab, focusMargin, selectedTabProtrusion);
670 static void DrawTabFocusRect(TDC& dc,
const TNoteTabItem& tab,
const TSize& focusMargin,
int selectedTabProtrusion)
672 int oldBkMode = dc.SetBkMode(TRANSPARENT);
673 TRect selectedRect =
TRect(
674 tab.Rect.TopLeft().OffsetBy(0, selectedTabProtrusion),
675 tab.Rect.BottomRight())
676 .InflatedBy(-focusMargin);
677 dc.DrawFocusRect(selectedRect);
678 dc.SetBkMode(oldBkMode);
687 void FillPageEdge(
const TSize& margin,
const TBrush& brush)
689 TRect r = Window.GetClientRect();
690 TRect m(r.TopLeft(), TSize(r.Width(), margin.cy));
691 Dc.FillRect(m, brush);
694 void DrawPageEdge(
const TSize& margin,
const TPen& pen)
696 TRect r = Window.GetClientRect();
697 TRect m(r.TopLeft(), TSize(r.Width(), margin.cy));
698 Dc.SelectObject(pen);
699 Dc.MoveTo(m.BottomLeft());
700 Dc.LineTo(m.BottomRight());
703 void FillPolygon(
const TPoint (&pt)[4],
const TBrush& brush)
705 Dc.SelectStockObject(NULL_PEN);
706 Dc.SelectObject(brush);
710 void DrawContour(
const TPoint (&pt)[4],
const TPen& pen)
713#if defined(OWL_GDIPLUS_H)
717 Gdiplus::Graphics g(Dc);
719 Gdiplus::Point points[
COUNTOF(pt)];
721 g.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias);
722 g.DrawLines(&gdiPlusPen, points,
COUNTOF(points));
726 Dc.SelectObject(pen);
728 Dc.SetPixel(pt[3], pen.GetObject().lopnColor);
736 struct TFlatRenderer_
745 const TRect& paintRect,
746 const TFont& tabFont,
747 const TFont& selectedTabFont,
750 TColor selectedTabColor,
753 : TRenderer_(w, dc, paintRect, tabFont, selectedTabFont, tabTextColor, tabColor, selectedTabColor, edgeColor),
758 void PaintPageEdge(
const TSize& margin)
760 FillPageEdge(margin, TabBrush);
761 DrawPageEdge(margin, EdgePen);
764 void PaintTabFace(
const TRect& tabBoundingRect, TPoint (&pt)[4],
bool isSelectedTab)
767 FillPolygon(pt, TabBrush);
770 void DrawTabContour(
const TPoint (&pt)[4],
bool isSelectedTab)
772 InUse(isSelectedTab);
773 DrawContour(pt, EdgePen);
778 struct TWindowFaceRenderer_
781 TBrush SelectedTabBrush;
783 TWindowFaceRenderer_(
786 const TRect& paintRect,
787 const TFont& tabFont,
788 const TFont& selectedTabFont,
791 TColor selectedTabColor,
794 : TFlatRenderer_(w, dc, paintRect, tabFont, selectedTabFont, tabTextColor, tabColor, selectedTabColor, edgeColor),
795 SelectedTabBrush(selectedTabColor)
798 void PaintPageEdge(
const TSize& margin)
800 FillPageEdge(margin, SelectedTabBrush);
801 DrawPageEdge(margin, EdgePen);
804 void PaintTabFace(
const TRect& tabBoundingRect, TPoint (&pt)[4],
bool isSelectedTab)
806 InUse(tabBoundingRect);
807 FillPolygon(pt, isSelectedTab ? SelectedTabBrush : TabBrush);
812 struct TStyle3dRenderer_
824 const TRect& paintRect,
825 const TFont& tabFont,
826 const TFont& selectedTabFont,
829 TColor selectedTabColor,
832 : TRenderer_(w, dc, paintRect, tabFont, selectedTabFont, tabTextColor, tabColor, selectedTabColor, edgeColor),
834 LightPen(TColor::Sys3dLight),
835 HilightPen(TColor::Sys3dHilight),
836 ShadowPen(TColor::Sys3dShadow),
837 DkShadowPen(TColor::Sys3dDkShadow)
840 void PaintPageEdge(
const TSize& margin)
842 FillPageEdge(margin, FaceBrush);
846 TRect r = Window.GetClientRect();
848 r.TopLeft().OffsetBy(0, margin.cy),
853 void PaintTabFace(
const TRect& tabBoundingRect, TPoint (&pt)[4],
bool isSelectedTab)
856 FillPolygon(pt, FaceBrush);
859 void DrawTabContour(
const TPoint (&pt)[4],
bool isSelectedTab)
861 InUse(isSelectedTab);
863 Dc.SelectObject(LightPen);
864 Dc.MoveTo(pt[0].x + 1, pt[0].y);
865 Dc.LineTo(pt[1].x + 1, pt[1].y - 1);
867 Dc.SelectObject(HilightPen);
868 Dc.MoveTo(pt[0].x, pt[0].y);
869 Dc.LineTo(pt[1].x, pt[1].y);
871 Dc.SelectObject(ShadowPen);
872 Dc.MoveTo(pt[1].x + 1, pt[1].y - 1);
873 Dc.LineTo(pt[2].x - 1, pt[2].y - 1);
874 Dc.MoveTo(pt[2].x - 1, pt[2].y);
875 Dc.LineTo(pt[3].x - 1, pt[3].y);
877 Dc.SelectObject(DkShadowPen);
878 Dc.MoveTo(pt[1].x + 1, pt[1].y);
879 Dc.LineTo(pt[2].x, pt[2].y);
880 Dc.LineTo(pt[3].x, pt[3].y);
885 struct TThemeRenderer_
893 const TRect& paintRect,
894 const TFont& tabFont,
895 const TFont& selectedTabFont,
898 TColor selectedTabColor,
901 : TRenderer_(w, dc, paintRect, tabFont, selectedTabFont, tabTextColor, tabColor, selectedTabColor, edgeColor),
905 void PaintPageEdge(
const TSize& margin)
907 TRect r = Window.GetClientRect();
908 TRect m(r.TopLeft(), TSize(r.Width(), margin.cy));
909 TThemePart p(Window, L
"TAB", TABP_BODY, 0);
910 p.DrawBackground(Dc, m);
911 DrawPageEdge(margin, EdgePen);
914 void PaintTabFace(
const TRect& tabBoundingRect, TPoint (&pt)[4],
bool isSelectedTab)
916 int item = isSelectedTab ? TABP_TOPTABITEM : TABP_TABITEM;
917 int state = isSelectedTab ? TIS_SELECTED : TIS_NORMAL;
918 TThemePart p(Window, L
"TAB", item, state);
919 TRegion savedClipRegion;
920 int r = Dc.GetClipRgn(savedClipRegion);
CHECK(r != -1);
921 TRegion clipRegion(pt,
COUNTOF(pt), WINDING);
922 Dc.SelectClipRgn(clipRegion);
923 p.DrawBackground(Dc, tabBoundingRect.InflatedBy(0, 1));
924 Dc.SelectClipRgn(r == 1 ? savedClipRegion.GetHandle() : NULL);
927 void DrawTabContour(
const TPoint (&pt)[4],
bool isSelectedTab)
929 InUse(isSelectedTab);
930 DrawContour(pt, EdgePen);
940template <
class TPartRenderer>
941void TNoteTab::PaintTabs(
TDC& dc,
const TRect& paintRect)
945 TPartRenderer renderer(
961 for (
int i =
GetCount(); --i >= -1;)
965 if (i ==
GetSel())
continue;
966 const bool isSelectedTab = (i == -1);
971 renderer.PaintPageEdge(Margin);
975 const TNoteTabItem& tab = TabList[isSelectedTab ?
GetSel() : i];
976 TRect tabBoundingRect = GetBoundingRect(tab.Rect);
977 if (tabBoundingRect.IsNull())
continue;
978 CHECK(!tabBoundingRect.IsEmpty());
984 if (!(tabBoundingRect.InflatedBy(1, 1).Touches(paintRect)))
987#if OWL_CLIP_TAB_BOUNDING_RECT_
989 struct TTabBoundingRectClipper
992 TRegion SavedClipRegion;
993 bool DidSaveClipRegion;
995 TTabBoundingRectClipper(TDC& d,
const TRect& b)
996 : Dc(d), SavedClipRegion(), DidSaveClipRegion(false)
998 if (!ShouldClipTabBoundingRect_)
return;
999 int rc = Dc.GetClipRgn(SavedClipRegion);
1001 DidSaveClipRegion = rc == 1;
1002 int ri = Dc.IntersectClipRect(b);
1006 ~TTabBoundingRectClipper()
1008 if (!ShouldClipTabBoundingRect_)
return;
1009 int r = DidSaveClipRegion ?
1010 Dc.SelectClipRgn(SavedClipRegion) :
1015 tbrc_(dc, tabBoundingRect);
1033 int dx = TabTapering;
1036 tabBoundingRect.TopLeft(),
1037 tabBoundingRect.BottomLeft().OffsetBy(dx, -1),
1038 tabBoundingRect.BottomRight().OffsetBy(-dx - 1, -1),
1039 tabBoundingRect.TopRight().OffsetBy(-1, 0)
1045 renderer.PaintTabFace(tabBoundingRect, pt, isSelectedTab);
1046 renderer.DrawTabContour(pt, isSelectedTab);
1048 renderer.DrawTabFocusRect(tab, FocusMargin, SelectedTabProtrusion);
1049 bool hasImage = CelArray && tab.ImageIdx >= 0;
1051 renderer.PaintTabIcon(tab, *CelArray, TransparentColor, LabelMargin, isSelectedTab, SelectedTabProtrusion);
1052 renderer.DrawTabText(tab, CelArray, LabelMargin, LabelImageMargin, isSelectedTab, SelectedTabProtrusion);
1055#if OWL_DRAW_TAB_BOUNDING_RECT_
1057 if (ShouldDrawTabBoundingRect_)
1058 for (
int i = 0; i !=
GetCount(); ++i)
1060 const TNoteTabItem& tab = TabList[i];
1061 if (tab.Rect.IsNull())
continue;
1066 dc.SelectObject(tabRectPen);
1067 TRect b = GetBoundingRect(tab.Rect);
1068 TPoint bp[] = {b.TopLeft(), b.BottomLeft(), b.BottomRight(), b.TopRight(), b.TopLeft()};
1101 TRegion r(paintRect & tabsArea);
1102 for (TNoteTabItemArray::const_iterator i = TabList.begin(); i != TabList.end(); ++i)
1114 if (ShouldUseThemes && IsThemed_())
1115 PaintTabs<TThemeRenderer_>(dc, paintRect);
1117 PaintTabs<TStyle3dRenderer_>(dc, paintRect);
1118 else if (WindowFace)
1119 PaintTabs<TWindowFaceRenderer_>(dc, paintRect);
1121 PaintTabs<TFlatRenderer_>(dc, paintRect);
1123 if (ScrollButtons->IsWindowVisible())
1125 ScrollButtons->Invalidate(
false);
1126 ScrollButtons->UpdateWindow();
1151 const auto& p = LastClientRectPainted;
1152 const auto hasPaintedBefore = !p.IsNull();
1154 if (hasPaintedBefore && n.Width() > p.Width())
1156 else if (!hasPaintedBefore || n.Width() < p.Width())
1159 if (hasPaintedBefore && n.Height() > p.Height())
1161 else if (!hasPaintedBefore || n.Height() < p.Height())
1186 if (ScrollButtons->IsWindowVisible() &&
GetScrollerArea().Contains(point))
return;
1236 if (tab < 0)
return;
1239 if (GetKeyState(VK_CONTROL) & 0x8000)
switch (key)
1275#if OWL_CLIP_TAB_BOUNDING_RECT_
1278 ShouldClipTabBoundingRect_ = !ShouldClipTabBoundingRect_;
1284#if OWL_DRAW_TAB_BOUNDING_RECT_
1287 ShouldDrawTabBoundingRect_ = !ShouldDrawTabBoundingRect_;
1313 static const tchar overhangSet[] =
_T(
"dfkmVWY");
1314 bool hasOverhang = !tab.
Label.empty() &&
1315 (TabFont->GetObject().lfItalic || selectedTabFont.
GetObject().lfItalic) &&
1316 find(begin(overhangSet), end(overhangSet), tab.
Label.back()) != end(overhangSet);
1320 tab.
LabelSize = (regularExtent | selectedExtent).Size();
1326 TSize size = CelArray->CelSize();
1327 tab.
LabelSize.cx += size.cx + LabelImageMargin;
1336TNoteTab::CalculateTabRect(
const TNoteTabItem& tab,
const TPoint& p,
bool isSelected)
const
1338 TSize padding(2 * LabelMargin.cx, 2 * LabelMargin.cy + (isSelected ? SelectedTabProtrusion : 0));
1348TNoteTab::CalculateTabRects(
int firstTab,
const TRect& area)
const
1356 rects.resize(std::min(firstTab,
GetCount()));
1360 TPoint p = area.TopLeft();
1361 for (
int i = firstTab; i !=
GetCount(); ++i)
1363 const TNoteTabItem& tab = TabList[i];
1364 const TRect r = CalculateTabRect(tab, p, i == SelectedTab);
1369 const TRect b = GetBoundingRect(r);
1370 bool isVisible = (b.left < area.right);
1379 p.Offset(r.Width() + TabSpacing, 0);
1392 TRect& r = tab.Rect;
1393 if (r == newRect)
return;
1408 bool ContainsHorizontalExtents_(
const TRect& area,
const TRect& r)
1410 if (area.IsEmpty() || r.IsEmpty())
return false;
1411 return r.left >= area.left && r.right <= area.right;
1423 PRECONDITION((tabCount == 0 && firstTab == 0) || (firstTab >= 0 && firstTab < tabCount));
1432 const auto allArea =
TRect{c.TopLeft() + Margin, c.BottomRight()};
1435 auto newRects = CalculateTabRects(firstTab, allArea);
1436 const auto needScrolling = ScrollLoc !=
alNone && tabCount > 1 &&
1439 newRects.back().IsNull() ||
1440 !ContainsHorizontalExtents_(allArea, GetBoundingRect(newRects.back()))
1443 newRects = CalculateTabRects(firstTab, scrollingTabsArea);
1444 EffectiveTabsArea = needScrolling ? scrollingTabsArea : allArea;
1445 CHECK(
static_cast<int>(newRects.size()) == tabCount);
1446 for (
auto i = 0; i != tabCount; ++i)
1447 AssignTabRect(TabList[i], newRects[i]);
1452 CHECK(ScrollButtons && ScrollButtons->GetHandle());
1455 const auto countNotFullyVisibleTabs = [&]
1460 for (
auto i = tabCount - 1; i >= firstTab && !
IsFullyVisible(i); --i)
1462 CHECK(n >= 0 && n <= tabCount);
1465 const auto upper = min(countNotFullyVisibleTabs(), tabCount - 1);
1466 CHECK(upper > 0 && upper < tabCount);
1467 ScrollButtons->SetRange(0, upper);
1468 ScrollButtons->SetPos(firstTab);
1469 ScrollButtons->MoveWindow(scrollerArea,
true);
1470 ScrollButtons->ShowWindow(SW_SHOW);
1471 ScrollButtons->UpdateWindow();
1474 ScrollButtons->ShowWindow(SW_HIDE);
1484 for (
int i = 0; i <
GetCount(); i++)
1504 if (index == SelectedTab)
return false;
1510 TNotify nSelChanging(*
this, Attr.Id, TCN_SELCHANGING);
1512 if (wasVetoed)
return false;
1517 TNotify nSelChange(*
this, Attr.Id, TCN_SELCHANGE);
1530 for (
int i = 0; i !=
GetCount(); ++i)
1544 rect.top = std::max(
1551 rect.left = rect.right = 0;
1576 rect.left += Margin.cx;
1577 rect.top += Margin.cy;
1583 rect.right -= scrollArea.
Width();
1586 rect.left += scrollArea.
Width();
1601 return TabList[index].Rect.IsNull() ? false :
true;
1613 if (EffectiveTabsArea.IsEmpty())
return false;
1615 TRect b = GetBoundingRect(TabList[index].Rect);
1617 return ContainsHorizontalExtents_(EffectiveTabsArea, b);
1627 FirstVisibleTab = index;
1641 int i = (index == -1) ?
GetSel() : index;
CHECK(i >= 0);
1655 if (scrollCode == SB_THUMBPOSITION)
1683 if (ScrollLoc == loc)
1700 OwnedCelArray.reset(del ==
AutoDelete ? array :
nullptr);
1712 TransparentColor = c;
Definition of a bitmap Cel array class.
#define PRECONDITION(condition)
#define CHECKX(condition, message)
The GDI Brush class is derived from TGdiObject.
TCelArray is a horizontal array of cels (a unit of animation) created by slicing a portion of or an e...
Class wrapper for management of color values.
static const TColor Transparent
a non-painting color
static const TColor None
not-a-color
static const TColor SysWindowFrame
The symbolic system color value for the frame around each window.
TColor()
Construct a null color.
static const TColor SysWindowText
The symbolic system color value for text in every window.
static const TColor Sys3dFace
The symbolic system color value for the face color of 3-dimensional display elements.
static const TColor SysWindow
The symbolic system color value for the background of each window.
static const TColor LtRed
Static TColor object with fixed Value set by RGB(255, 0, 0).
void EvPaint()
Intercept WM_PAINT to redirect from TWindow to the underlying control if this Owl object is just a wr...
TControl(TWindow *parent, int id, LPCTSTR title, int x, int y, int w, int h, TModule *module=nullptr)
Invokes TWindow's constructor, passing it parent (parent window), title (caption text),...
TDC is the root class for GDI DC wrappers.
bool FillSolidRect(const TRect &r, const TColor &color)
bool FillRgn(const TRegion ®ion, const TBrush &brush)
Fills the given region on this DC using the specified brush.
TDefaultGuiFont(TSystemFontId=sfiLegacyDefault)
Create a wrapper for the given system font.
TFont derived from TGdiObject provides constructors for creating font objects from explicit informati...
LOGFONT GetObject() const
Returns information about this font object.
TSize GetTextExtent(const tstring &text) const
Returns the extent of a given string using this particular font.
TFont(HFONT handle, TAutoDelete autoDelete=NoAutoDelete)
TFont encapsulates an HFONT.
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
TNotify is a thin wrapper around the NMHDR structure.
TPoint is a support class, derived from tagPOINT.
TPoint OffsetBy(int dx, int dy) const
Calculates an offset to this point using the given displacement arguments.
TPoint()
Constructs an uninitialized point.
TRect is a mathematical class derived from tagRect.
bool IsNull() const
Returns true if left, right, top, and bottom are all 0; otherwise, returns false.
const TPoint & BottomRight() const
Returns the TPoint object representing the bottom right corner of this rectangle.
const TPoint & TopLeft() const
Returns the upperleft point.
int Width() const
Returns the width of this rectangle (right - left).
bool Contains(const TPoint &point) const
Returns true if the given point lies within this rectangle; otherwise, it returns false.
TRect()
Default constructor that does nothing.
bool IsEmpty() const
Returns true if left >= right or top >= bottom; otherwise, returns false.
TRegion, derived from TGdiObject, represents GDI abstract shapes or regions.
Derived from TWindowDC, TScreenDC is a DC class that provides direct access to the screen bitmap.
The tagSIZE struct is defined as.
TSize()
Default constructor that does nothing.
static TThemeModule & GetInstance()
Returns the module instance.
TModuleProc0< BOOL > IsAppThemed
@ WndRecessed
Input field & other window recessed.
TUIBorder(const TRect &frame, TStyle style, uint flags=0)
Constructs a UIBorder object given a frame and a high-level style type.
static const TUIMetric CyEdge
static const TUIMetric CyHScroll
static const TUIMetric CyFixedFrame
static const TUIMetric CySizeFrame
static const TUIMetric CxFixedFrame
static const TUIMetric CxEdge
static const TUIMetric CxHScroll
TUpDown encapsulates an up-down control, which is a window with a pair of arrow buttons that the user...
Type-safe encapsulation of a Windows class name, a union between ATOM and LPCTSTR.
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
HWND SetFocus()
Sets the keyboard focus to current window and activates the window that receives the focus by sending...
void SetBkgndColor(TColor color, bool shouldUpdate=true)
Sets the background color for the window.
TWindow()
Protected constructor for use by immediate virtually derived classes.
TWindow * GetParent() const
Retrieves the OWL object of the parent window. If none exists, returns 0.
auto GetBkgndColor() const -> TColor
Returns the overriding background color set for the window.
virtual auto GetWindowClassName() -> TWindowClassName
virtual void InvalidateRect(const TRect &rect, bool erase=true)
Invalidates a specified client area.
uint EvGetDlgCode(const MSG *msg)
The default message handler for WM_GETDLGCODE.
void EvKillFocus(HWND hWndGetFocus)
Handle WM_KILLFOCUS so that we can have a parent window hold onto our Handle and possibly restore foc...
bool ModifyStyle(uint32 offBits, uint32 onBits, uint swpFlags=0)
Modifies the style bits of the window.
void UpdateWindow()
Updates the client area of the specified window by immediately sending a WM_PAINT message.
void EvSetFocus(HWND hWndLostFocus)
The default message handler for WM_SETFOCUS.
void SendNotification(int id, int notifyCode, HWND hCtl, TMsgId=WM_COMMAND)
Repacks a command message (msg) so that a child window (hCtl) can send a message to its parent regard...
virtual void SetupWindow()
Performs setup following creation of an associated MS-Windows window.
static HWND GetFocus()
Gets a handle to the window that has the focus.
void EvSize(uint sizeType, const TSize &size)
Response method for an incoming WM_SIZE message.
void GetClientRect(TRect &rect) const
Gets the coordinates of the window's client area and then copies them into the object referred to by ...
HWND THandle
TWindow encapsulates an HWND.
virtual void Invalidate(bool erase=true)
Invalidates (mark for painting) the entire client area of a window.
HWND GetHandle() const
Returns the handle of the window.
Definition of classes for CommonControl encapsulation.
Definition of container classes used and made available by OWL.
Definition of class TControl.
#define DEFINE_RESPONSE_TABLE1(cls, base)
Macro to define a response table for a class with one base.
Utilities for GDI+ interoperability.
TAutoDelete
Flag for Handle ctors to control Handle deletion in dtor.
void EvLButtonDown(uint modKeys, const TPoint &point)
WM_LBUTTONDOWN handler - Checks whether the mouse was clicked on a tab item and selects it.
TRect Rect
Location of tab [client-area base coords].
uint EvGetDlgCode(const MSG *msg)
WM_GETDLGCODE handler - Informs dialog manager that arrow keys are to be used.
int Add(LPCTSTR txt, INT_PTR clientData=0, int imageIdx=-1, TAbsLocation imageLoc=alLeft, bool shouldSelect=true)
Adds a new tabitem to the notetab control.
void SetSelectedTabFont(const TFont &)
Sets the font used to render the text part of the selected tab label.
void SetSelectedTabColor(const TColor &)
Sets the fill color used to paint the selected tab.
TSize LabelSize
Width and height of label.
void EvKeyDown(uint key, uint repeatCount, uint flags)
WM_KEYDOWN handler - handles arrow keys to allow user to navigate through tab items.
int TabFromPoint(const TPoint &pt) const
Returns the index of the tab item at the specified window coordinate.
void SetLabelMargin(const TSize &)
Sets the amount of padding around the tab label.
bool IsVisible(int index) const
Returns true if the tab item at the specified index is visible.
int GetSel() const
Returns the index of the selected tabitem.
bool EnsureVisible(int index)
If the tab specified by index is not visible, it is scrolled into view.
const TFont & GetSelectedTabFont() const
Returns the font used to render the text part of the selected tab label.
int Insert(LPCTSTR txt, int index, INT_PTR clientData=0, int imageIdx=-1, TAbsLocation imageLoc=alLeft, bool shouldSelect=true)
Inserts a new TTabItem at the specified index.
void SetSelectedTabProtrusion(int)
Sets the amount of extra height of the selected tab.
void EvSetFocus(THandle hWndLostFocus)
Handle WM_SETFOCUS: Draw focus to identify selected tab.
const TFont & GetTabFont() const
Returns the font used to render the text part of the tab labels.
HWND GetBuddy() const
Return handle of buddy window associated with the notetab control.
void SetFirstVisibleTab(int index)
Sets FirstVisibleTab to index if index is valid.
void SetTabFont(const TFont &)
Sets the font used to render the text part of the tab labels.
int ImageIdx
Index of tab image.
bool IsFullyVisible(int index) const
Returns true if the horizontal projection of the tab item at the specified index is contained within ...
void SetTabTapering(int)
Sets the amount of narrowing on each side of the tab towards the bottom.
void SetMargin(const TSize &)
Sets the amount of space to the left of the tabs and above the tabs.
bool GetItem(int index, TNoteTabItem &item) const
Retrieve information about the tab item at the specified index.
void SetEdgeColor(const TColor &)
Sets the pen color used to draw the edges of the tabs.
void SetFocusMargin(const TSize &)
Sets the margin around the focus rectangle for the selected tab.
void SetBuddy(HWND buddy)
Sets handle of the buddy window associated with this notetab control.
int SetSel(int index)
Selects the tabitem at the specified index.
void SetTabRects(int firstTab)
Lays out tab items (and scroll buttons) with the specified index at the leftmost.
void SetLabelImageMargin(int)
Sets the horizontal spacing between image and text in the label.
TNoteTab(TWindow *parent, int id, int x, int y, int w, int h, TWindow *buddy=0, bool dialogBuddy=true, TModule *module=0)
Constructor of NoteTab object.
TRect GetScrollerArea() const
Returns the desired location of the scrollers within the tab.
void EvHScroll(uint scrollCode, uint thumbPos, HWND hWndCtl)
Sets the first visible tab to the given thumb position.
bool Delete(int index)
Remove the tabitem at the specified 'index'.
void EvKillFocus(THandle hwndGetFocus)
Handle WM_KillFOCUS: Remove dotted focus rectangle from selected tab.
bool SetItem(int index, const TNoteTabItem &item)
Updates information about the tab item at the specified index.
void SetupWindow() override
Overriden virtual of TWindow - Initializes font used by control and resize accordingly.
bool NotifyAndSelect(int index)
Selects the tab at the given index and sends the appropriate notifications.
void SetTabColor(const TColor &)
Sets the fill color used to paint the tabs.
void EvPaint()
EV_WM_PAINT handler.
void SetCelArrayTransparentColor(const TColor &)
Sets the color assigned to denote transparency in the bitmaps used for the tabs (see SetCelArray).
int GetFirstVisibleTab() const
Returns FirstVisibleTab.
void InvalidateTab(int index)
Invalidates the rectangle occupied by the tab at the specified index.
void SetTabSize(int index)
Updates the internal information stored about the label of a particular tab item.
bool DeleteAll()
Removes all tab items in the notetab control. Always returns true.
void SetCelArray(TCelArray *array, TAutoDelete=AutoDelete)
Sets the bitmap array to be used for the tabs.
void SetScrollLocation(TAbsLocation pos)
Set the scroller location.
bool EvEraseBkgnd(HDC)
Disables automatic background erasure by returning false.
void SetTabSpacing(int)
Sets the horizontal distance between two tabs.
TRect GetScrollingTabsArea() const
Returns the rectangle of the area reserved for tabs when scrolling is active.
void EvSize(uint sizeType, const TSize &size)
WM_SIZE handler - Relay tab items.
void Paint(TDC &, bool erase, TRect &) override
TWindow::Paint override.
auto Transfer(void *buffer, TTransferDirection) -> uint override
Overrides TWindow virtual member function to handle transfers.
void InitCtrl()
Initialize internal variables used by NoteTab.
int GetCount() const
Return the number of tab items in the notetab control.
tstring Label
Label of tab.
int GetMinimalHeight()
Returns the minimal control height for which tabs are not clipped.
TAbsLocation
General use absolute 2-D rectangular location enum.
@ alRight
Refers to right edge of frame.
@ alLeft
Refers to left edge of frame.
@ alNone
No location specified.
TTransferDirection
The TTransferDirection enum describes the constants that the transfer function uses to determine how ...
Object Windows Library (OWLNext Core).
Gdiplus::Color gdiplus_cast< Gdiplus::Color >(const TColor &v)
TWindow * GetWindowPtr(HWND, const TApplication *)
Raw function to retrieve a TWindow pointer given an HWND from the a given app, or any app (app==0).
void InUse(const T &arg)
Handy utility to avoid compiler warnings about unused parameters.
auto GetCommCtrlVersion() -> DWORD
Returns the version number of the Common Control library (ComCtl32.dll).
TDest gdiplus_cast(const T &)
gdiplus_cast template; Simulates a cast operator that can convert to and from any of OWLNext types TS...
Definition of class TNoteTab.
#define COUNTOF(s)
Array element count Important: Only use this with an argument of array type.
TNoteTabItem holds information about each tab in a notetab control.
Microsoft UxTheme Library Encapsulation.
Definition of the UI Helper Classes: TUIHandle, TUIBorder, TUIFace, TUIPart.
Definition of TUIMetric, a UI metrics provider class.
Definition of class TUpDown.
#define EV_WM_LBUTTONDOWN