OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
gadget.cpp
Go to the documentation of this file.
1//----------------------------------------------------------------------------
2// ObjectWindows
3// Copyright (c) 1992, 1996 by Borland International, All Rights Reserved
4//
5/// \file
6/// Implementation of classes TGadget, TSeparatorGadget and TSizeGripGadget
7//----------------------------------------------------------------------------
8#include <owl/pch.h>
9#include <owl/defs.h>
10#include <owl/gadget.h>
11#include <owl/gadgetwi.h>
12#include <owl/framewin.h>
13#include <owl/tooltip.h>
14#include <owl/uihelper.h>
15#include <owl/uimetric.h>
16#include <owl/theme.h>
17
18using namespace std;
19
20namespace owl {
21
22
24
25//
26// Convert layout units to pixels using a given font height
27//
28// A layout unit is defined by dividing the font "em" into 8 vertical and 8
29// horizontal segments
30//
31static int
32layoutUnitsToPixels(int units, int fontHeight)
33{
34 const long unitsPerEM = 8;
35
36 return int((long(units) * fontHeight + unitsPerEM / 2) / unitsPerEM);
37}
38
39//
40// Return true if the Id is a predefined gadget id.
41//
42static bool
43predefinedGadgetId(int id)
44{
45 if (id == 0 || id == -1 || (IDG_FIRST <= id && id < IDG_LAST)) {
46 return true;
47 }
48 return false;
49}
50
51//
52// Retrieve the sizes of the 4 margins in pixels given a font height
53//
54void
55TMargins::GetPixels(int& left, int& right, int& top, int& bottom, int fontHeight) const
56{
57 switch (Units) {
58 case Pixels:
59 left = Left;
60 top = Top;
61 right = Right;
62 bottom = Bottom;
63 break;
64
65 case LayoutUnits:
66 left = layoutUnitsToPixels(Left, fontHeight);
67 top = layoutUnitsToPixels(Top, fontHeight);
68 right = layoutUnitsToPixels(Right, fontHeight);
69 bottom = layoutUnitsToPixels(Bottom, fontHeight);
70 break;
71
72 case BorderUnits:
75
76 left = Left * cxBorder;
77 top = Top * cyBorder;
78 right = Right * cxBorder;
79 bottom = Bottom * cyBorder;
80 break;
81 }
82}
83
84//
85/// Construct a gadget with a given id and border style. Used by derived
86/// classes.
87//
89{
90 Window = nullptr;
91 Bounds = TRect(0, 0, 0, 0);
92 Flags = Enabled | Visible;
93 TrackMouse = false;
94 MouseInGadget = false;
95 Clip = false;
96 WideAsPossible = false;
97 ShrinkWrapWidth = ShrinkWrapHeight = true;
98 Next = nullptr;
99 Id = id;
100
102}
103
104//
105/// Destroys a TGadget interface object and removes it from its associated window.
106//
108{
109 // If we're in a window, remove ourselves.
110 //
111 if (Window)
112 Window->Remove(*this);
113}
114
115//
116/// Called during idle time to allow the gadget to perform any idle actions. TGadget
117/// performs command enabling on first call in each idle period.
118//
119bool
121{
122 if (idleCount == 0)
124 return false;
125}
126
127//
128/// Provided so that the gadget can perform command enabling (so it can handle an
129/// incoming message if it's appropriate to do so).
130//
131void
135
136//
137/// Called when the system colors have been changed so that gadgets can rebuild and
138/// repaint, if necessary.
139//
140void
144
145//
146// A way to detect whether a button is created and visible
147//
148bool
150{
151 if (Window)
152 return Window->IsWindowVisible();
153 else
154 return false;
155}
156
157//
158/// Simple set accessor to set whether shrinkwrapping is performed horizontally
159/// and/or vertically.
160///
161/// Your derived class can call TGadgetWindow::GadgetChangedSize()
162/// if you want to change the size of the gadget.
163//
164void
166{
167 ShrinkWrapWidth = shrinkWrapWidth;
168 ShrinkWrapHeight = shrinkWrapHeight;
169}
170
171//
172/// Alters the size of the gadget and then calls TGadgetWindow::GadgetChangedSize()
173/// for the size change to take effect.
174/// This function is needed only if you have turned off shrink-wrapping in one or
175/// both dimensions; otherwise, use the GetDesiredSize() member function to return the
176/// shrink-wrapped size.
177//
178void
180{
181 Bounds.right = Bounds.left + size.cx;
182 Bounds.bottom = Bounds.top + size.cy;
183
184 if (Window)
185 Window->GadgetChangedSize(*this);
186}
187
188//
189/// Enables or disables keyboard and mouse input for the gadget. By default, the
190/// gadget is disabled when it is created and must be enabled before it can be
191/// activated.
192//
193void
195{
196 if (ToBool(Flags & Enabled) != enabled) {
197 if (enabled)
198 Flags |= Enabled;
199 else
200 Flags &= ~Enabled;
201 Invalidate(true);
202 }
203}
204
205//
206/// Called by the gadget window to inform the gadget of a change in its bounding
207/// rectangle. Default behavior here just updates instance variable "Bounds" but
208/// derived classes might override this method to update other internal state.
209//
210void
212{
213 if (rect != Bounds) {
214 Bounds = rect;
215 Moved();
216 }
217}
218
219//
220/// Sets the borders for the gadget. If the borders are changed, SetBorders calls
221/// TGadgetWindow::GadgetChangedSize() to notify the gadget window of the change.
222//
223void
225{
226 Borders = borders;
227
228 if (Window)
229 Window->GadgetChangedSize(*this);
230}
231
232//
233/// Sets the margins of the gadget. If the margins are changed, SetMargins calls
234/// TGadgetWindow::GadgetChangedSize() to notify the gadget window.
235//
236void
238{
239 Margins = margins;
240
241 if (Window)
242 Window->GadgetChangedSize(*this);
243}
244
245//
246/// Set the border style used by this gadget. Internal Border members are
247/// updated and owning Window is notified of a size change.
248//
249void
251{
252 BorderStyle = borderStyle;
253
254 int edgeThickness;
255 switch (BorderStyle) {
256 default:
257 case None:
258 edgeThickness = 0;
259 break;
260
261 case Plain:
262 case Raised:
263 case Recessed:
264 edgeThickness = 1;
265 break;
266
267 case Embossed:
268// edgeThickness = 3;
269 case Grooved:
270 case ButtonUp:
271 case ButtonDn:
272 case WndRaised:
273 case WndRecessed:
274 edgeThickness = 2;
275 break;
276 }
277
278 Borders.Left = Borders.Top = Borders.Right = Borders.Bottom = edgeThickness;
279
280 if (Window)
281 Window->GadgetChangedSize(*this);
282}
283
284//
285/// Determines if the point is within the receiver's bounding rectangle and returns
286/// true if this is the case; otherwise, returns false.
287//
288bool
290{
291 return IsVisible() &&
292 point.x >= 0 && point.y >= 0 &&
293 point.x < Bounds.Width() && point.y < Bounds.Height();
294}
295
296//
297/// This is the virtual called after the window holding a gadget has been created.
298//
299void
301{
302 PRECONDITION(Window);
303 PRECONDITION(Window->GetHandle());
304
305 // Register ourself with the tooltip window (if there's one)
306 //
307 TTooltip* tooltip = Window->GetTooltip();
308 if (tooltip && tooltip->IsWindow()) {
309
310 // Don't register gadget's with Id's of 0 or -1.
311 // Typically, 0 is reserved by separators and -1 could
312 // be used for dumb text gadgets...
313 //
314 if (!predefinedGadgetId(Id)) {
315 TToolInfo toolInfo(Window->GetHandle(), Bounds, Id);
316 tooltip->AddTool(toolInfo);
317 }
318 }
319}
320
321//
322/// Called after a gadget is inserted into a window.
323//
324void
328
329//
330/// Virtual called after a gadget is removed from a window.
331//
332void
334{
335 // Unregister ourself with the tooltip window (if there's one)
336 //
337 if (Window && Window->GetHandle()) {
338 TTooltip* tooltip = Window->GetTooltip();
339 if (tooltip && tooltip->IsWindow()) {
340
341 // Don't bother with gadgets with Id's of 0 or -1.
342 // Typically, 0 is reserved by separators and -1 could
343 // be used for dumb text gadgets...
344 //
345 if (!predefinedGadgetId(Id)) {
346 TToolInfo toolInfo(Window->GetHandle(), Bounds, Id);
347 tooltip->DeleteTool(toolInfo);
348 }
349 }
350 }
351}
352
353//
354/// This is the virtual called when a gadget is relocated.
355//
356void
358{
359 // Send tooltip window our updated location
360 //
361 if (Window && Window->GetHandle()) {
362 TTooltip* tooltip = Window->GetTooltip();
363 if (tooltip && tooltip->IsWindow()) {
364
365 // Don't bother with gadgets with Id's of 0 or -1.
366 // Typically, 0 is reserved by separators and -1 could
367 // be used for dumb text gadgets...
368 //
369 if (!predefinedGadgetId(Id)) {
370
371 // First retrieve information about the tool
372 //
373 TToolInfo ti(true);
374 ti.SetToolInfo(*Window, Id);
375 if (tooltip->GetToolInfo(ti)) {
376
377 // Update the tooltip info if we've moved
378 //
379 if (TRect(ti.rect) != Bounds)
380 tooltip->NewToolRect(TToolInfo(Window->GetHandle(), Bounds, Id));
381 }
382 }
383 }
384 }
385}
386
387//
388/// Invalidate a rectangle in our containing window. Rectangle is specified
389/// in gadget coordinates.
390//
391void
393{
394 if (Window && Window->GetHandle()) {
395 TRect updateRect(rect.left + Bounds.left, rect.top + Bounds.top,
396 rect.right + Bounds.left, rect.bottom + Bounds.top);
397
399 }
400}
401
402//
403/// Used to invalidate the active (usually nonborder) portion of the gadget,
404/// Invalidate calls InvalidateRect and passes the boundary width and height of the
405/// area to erase.
406//
407void
409{
410 InvalidateRect(TRect(0, 0, Bounds.Width(), Bounds.Height()), erase);
411}
412
413//
414/// Repaints the gadget if possible.
415//
416void
418{
419 if (Window && Window->GetHandle())
420 Window->UpdateWindow();
421}
422
423//
424/// Used to paint the border, PaintBorder determines the width and height of the
425/// gadget and uses the color returned by GetSyscolor to paint or highlight the area
426/// with the specified brush. Depending on whether the border style is raised,
427/// embossed, or recessed, PaintBorder paints the specified boundary. You can
428/// override this function if you want to implement a border style that is not
429/// supported by ObjectWindows' gadgets.
430//
431void
433{
434 if (BorderStyle != None) {
437
438 TRect boundsRect(0,0,Bounds.Width(),Bounds.Height());
439 if (BorderStyle == Plain) {
442 dc.RestoreBrush();
443 }
444 else {
446 TUIBorder(boundsRect, static_cast<uint>(BorderStyle) == static_cast<uint>(TUIBorder::Recessed) ?
449 }
450 else{
451 // Use the 1:1 mapping of BorderStyle to TUIBorder::TStyle
452 TUIBorder(boundsRect, TUIBorder::TStyle(BorderStyle)).Paint(dc);
453 }
454 }
455 }
456}
457
458//
459/// Calls PaintBorder() to paint the indicated device context.
460//
461void
463{
464 PaintBorder(dc);
465}
466
467//
468/// Request by the gadget window to query the gadget's desired size.
469//
470/// Determines how big the gadget can be. The gadget window sends this message to
471/// query the gadget's size. If shrink-wrapping is requested, GetDesiredSize returns
472/// the size needed to accommodate the borders and margins. If shrink-wrapping is
473/// not requested, it returns the gadget's current width and height. TGadgetWindow
474/// needs this information to determine how big the gadget needs to be, but it can
475/// adjust these dimensions if necessary. If WideAsPossible is true, then the width
476/// parameter (size.cx) is ignored.
477//
478void
480{
481 int left = 0;
482 int right = 0;
483 int top = 0;
484 int bottom = 0;
485 GetOuterSizes(left, right, top, bottom);
486
487 size.cx = ShrinkWrapWidth ? left+right : Bounds.Width();
488 size.cy = ShrinkWrapHeight ? top+bottom : Bounds.Height();
489}
490
491//
492/// Get the four total outer sizes in pixels which consists of the margins
493/// plus the borders.
494//
495void
496TGadget::GetOuterSizes(int& left, int& right, int& top, int& bottom)
497{
498 if (Window) {
501
502 Window->GetMargins(Margins, left, right, top, bottom);
503 left += Borders.Left * xBorder;
504 right += Borders.Right * xBorder;
505 top += Borders.Top * yBorder;
506 bottom += Borders.Bottom * yBorder;
507 }
508}
509
510//
511/// Computes the area of the gadget's rectangle excluding the borders and margins.
512//
513void
515{
516 int left = 0;
517 int right = 0;
518 int top = 0;
519 int bottom = 0;
520 GetOuterSizes(left, right, top, bottom);
521
522 innerRect.left = left;
523 innerRect.right = Bounds.Width() - right;
524 innerRect.top = top;
525 innerRect.bottom = Bounds.Height() - bottom;
526}
527
528//
529// Mouse response functions
530//
531
532//
533/// Mouse is entering this gadget. Called by gadget window if no other gadget
534/// has capture.
535///
536/// For toolbars with the flat style we want to allow the gadget to redraw with
537/// a slightly different style (e.g. border) when the mouse is hovering over
538/// the gadget. We handle this here by setting a flag (MouseInGadget) and then
539/// invalidating the gadget.
540//
541void
542TGadget::MouseEnter(uint /*modKeys*/, const TPoint&)
543{
544 PRECONDITION(Window);
545 MouseInGadget = true;
547 Invalidate(); // is flat style -> repaint gadget TWindow
548}
549
550//
551/// Mouse is moving over this gadget. Called by gadget window only if this
552/// gadget has captured the mouse
553///
554/// point is located in the receiver's coordinate system.
555//
556void
557TGadget::MouseMove(uint /*modKeys*/, const TPoint&)
558{
559}
560
561//
562/// Mouse is leaving this gadget. Called by gadget window if no other gadget
563/// has capture
564//
565void
566TGadget::MouseLeave(uint /*modKeys*/, const TPoint&)
567{
568 PRECONDITION(Window);
569 PRECONDITION(Window->GetHandle());
570
571 // Send a fake WM_MOUSEMOVE to the tooltip in case the user moved away
572 // from the gadget *very* quick without the window detecting mouse move
573 // messages.
574 //
575 TTooltip* tooltip = Window->GetTooltip();
576 if (tooltip && tooltip->IsWindow()) {
577
579 GetCursorPos(&crsPoint);
580 HWND hwnd = WindowFromPoint(crsPoint);
581 if (hwnd)
582 ::MapWindowPoints(HWND_DESKTOP, hwnd, LPPOINT(&crsPoint), 1);
583 else
584 hwnd = GetDesktopWindow();
585
586 MSG msg;
587 msg.hwnd = hwnd;
588 msg.message = WM_MOUSEMOVE;
589 msg.wParam = 0;
590 msg.lParam = MkUint32(static_cast<uint16>(crsPoint.x), static_cast<uint16>(crsPoint.y));
591 tooltip->RelayEvent(msg);
592 }
593 //
594 // for flat a la IE 3.0 toolbar
595 //
596 if(MouseInGadget){
597 MouseInGadget = false;
599 Invalidate(); // is flat style -> repaint gadget
600 }
601}
602
603//
604/// Captures the mouse if TrackMouse is set. point is located in the gadget's
605/// coordinate system.
606//
607void
608TGadget::LButtonDown(uint /*modKeys*/, const TPoint&)
609{
610 if (TrackMouse)
611 Window->GadgetSetCapture(*this);
612}
613
614//
615/// Releases the mouse capture if TrackMouse is set. point is located in the
616/// gadget's coordinate system.
617//
618void
619TGadget::LButtonUp(uint /*modKeys*/, const TPoint&)
620{
621 if (TrackMouse)
622 Window->GadgetReleaseCapture(*this);
623}
624
625//
626//
627//
628void
629TGadget::RButtonDown(uint /*modKeys*/, const TPoint&)
630{
631 // TGadget does nothing with right mouse messages.
632 // However, a derived gadgets may catch this event
633}
634
635//
636//
637//
638void
639TGadget::RButtonUp(uint /*modKeys*/, const TPoint&)
640{
641 // TGadget does nothing with right mouse messages.
642 // However, a derived gadgets may catch this event
643}
644
645//----------------------------------------------------------------------------
646const int DefaultGripSize = 6;
647
648
649//
650/// Used for both the width and the height of the separator, the default size is
651/// TUIMetric::CxSizeFrame times two. id is the ID of the TGadget object.
652//
654:
655 TGadget(id),
656 ShowSeparator(showsep)
657{
658 ShrinkWrapWidth = ShrinkWrapHeight = false;
659 SetEnabled(false);
660 SetVisible(false);
661
662 // Default size to a sysMetric based value
663 //
664 if (!size)
665 size = TUIMetric::CxSizeFrame * 2;
666 Bounds.right = size;
667 Bounds.bottom = size;
668}
669
670//
671/// This is an overridden virtual, called after a gadget is inserted into a window.
672//
673void
675{
676 BorderStyle = None; // Prohibit our style from being changed
677}
678
679//
680//
681//
682void
684{
685 TGadget::Paint(dc); // Does nothing since BorderStyle is None.
686
688 if (flat && ShowSeparator)
689 {
691
692 // Calculate border.
693 //
695 bool xpstyle = GetGadgetWindow()->IsThemed();
696 if (xpstyle)
698 else
700
701 // Expand the bounds rectangle around the separator so that its
702 // height (horizontal) or width (vertical) matches the gadget window.
703 //
704 TRect bounds = Bounds.MovedTo(0, 0);
706 bounds.Inflate
707 (
708 horizontal ? 0 : (bar.Width() - Bounds.Width())/2 - border.cx,
709 !horizontal ? 0 : (bar.Height() - Bounds.Height())/2 - border.cy
710 );
711
712 // Draw the separator in the active style.
713 //
714 if (xpstyle)
715 {
717 TThemePart part(GetGadgetWindow()->GetHandle(), static_cast<LPCWSTR>(L"TOOLBAR"), part_id, TS_NORMAL);
718 part.DrawBackground(dc, bounds);
719 }
720 else // old flat style
721 {
722 // Narrow the drawing rectangle to 2 pixels in the center.
723 //
724 if (horizontal)
725 {
726 bounds.left = bounds.Width()/2-1;
727 bounds.right = bounds.left+2;
728 }
729 else // vertical
730 {
731 bounds.top = bounds.Height()/2-1;
732 bounds.bottom = bounds.top+2;
733 }
736 }
737 }
738}
739
740//
741//------------------------------------------------------------------------------
742//
744:
745 TSeparatorGadget(TUIMetric::CySizeFrame > TUIMetric::CxSizeFrame ?
746 TUIMetric::CySizeFrame :
747 TUIMetric::CxSizeFrame, id)
748{
749 // Enable gadget so mouse hit testing handler will let cursor change
750 // when user moves over the size grip.
751 //
752 SetEnabled(true);
753}
754
755
756//
757void
759{
761
762 if(GetGadgetWindow()->GetDirection() == TGadgetWindow::Rectangular)
763 size.cx = size.cy = 0;
764 else{
766 for (TGadget* gadg = GetGadgetWindow()->FirstGadget(); gadg; gadg = GetGadgetWindow()->NextGadget(*gadg)){
767 int id = gadg->GetId();
768 if (id != IDG_FLATHANDLE && gadg != this){
769 TSize gsize(0, 0);
770 gadg->GetDesiredSize(gsize);
771 maxsize.cx = std::max(gsize.cx,maxsize.cx);
772 maxsize.cy = std::max(gsize.cy,maxsize.cy);
773 }
774 }
775
776 if (Window->GetDirection()==TGadgetWindow::Horizontal){
777 size.cx = DefaultGripSize;
778 size.cy = maxsize.cy;
779 }
780 else if (Window->GetDirection()==TGadgetWindow::Vertical){
781 size.cx = maxsize.cx;
782 size.cy = DefaultGripSize+1;
783 }
784 }
785}
786
787// Draw the resize gadget.
788//
789void
791{
792 if(Window->GetDirection()==TGadgetWindow::Horizontal){
793 TRect boundsRect = Bounds;
794 dc.DPtoLP((TPoint*)&boundsRect, 2);
795 boundsRect.right = boundsRect.left+3;
796 if(Window->GetFlatStyle()&TGadgetWindow::FlatSingleDiv){
797 boundsRect.Offset(-2,0);
799 }
800 else{
801 boundsRect.Offset(-3,0);
803 boundsRect.Offset(3,0);
805 }
806 }
807 else if(Window->GetDirection()==TGadgetWindow::Vertical){
808 TRect boundsRect = Bounds;
809 dc.DPtoLP((TPoint*)&boundsRect, 2);
810 boundsRect.bottom = boundsRect.top+3;
811 if(Window->GetFlatStyle()&TGadgetWindow::FlatSingleDiv)
813 else{
814 boundsRect.Offset(0,-1);
816 boundsRect.Offset(0,3);
818 }
819 }
820}
821//------------------------------------------------------------------------------
822
823//
824/// Constructs a gadget that can be grabbed to resize the frame.
825//
827:
828 TSeparatorGadget(TUIMetric::CxHScroll > TUIMetric::CyVScroll ?
829 TUIMetric::CxHScroll :
830 TUIMetric::CyVScroll, id)
831{
832 // Enable gadget so mouse hit testing handler will let cursor change
833 // when user moves over the size grip.
834 //
835 SetEnabled(true);
836}
837
838//
839/// Draws the resize gadget.
840//
841void
843{
844 int left = 0;
845 int right = 0;
846 int top = 0;
847 int bottom = 0;
848 GetOuterSizes(left, right, top, bottom);
849
851 innerRect.left = left;
852 innerRect.top = top;
853 innerRect.right = Bounds.Width() + 1;
854 innerRect.bottom = Bounds.Height() + 1;
855
856///TH ::DrawFrameControl(dc, &innerRect, DFC_SCROLL, DFCS_SCROLLSIZEGRIP);
859}
860
861} // OWL namespace
862/* ========================================================================== */
863
#define PRECONDITION(condition)
Definition checks.h:227
The GDI Brush class is derived from TGdiObject.
Definition gdiobjec.h:180
static const TColor SysWindowFrame
The symbolic system color value for the frame around each window.
Definition color.h:330
TDC is the root class for GDI DC wrappers.
Definition dc.h:64
bool DPtoLP(TPoint *points, int count=1) const
Converts each of the count points in the points array from device points to logical points.
Definition dc.h:1406
void RestoreBrush()
Restores the original GDI brush object to this DC.
Definition dc.cpp:233
void OWLFastWindowFrame(TBrush &brush, TRect &r, int xWidth, int yWidth, uint32 rop=PATCOPY)
Draws a frame of the specified size and thickness with the given brush.
Definition dc.cpp:331
TFlatHandleGadget(int id=IDG_FLATHANDLE)
Definition gadget.cpp:743
virtual void Paint(TDC &dc)
Definition gadget.cpp:790
virtual void GetDesiredSize(TSize &size)
Definition gadget.cpp:758
TGadget is the base class for the following derived gadget classes:
Definition gadget.h:120
virtual void RButtonUp(uint modKeys, const TPoint &point)
Definition gadget.cpp:639
virtual void LButtonDown(uint modKeys, const TPoint &point)
Captures the mouse if TrackMouse is set.
Definition gadget.cpp:608
virtual void RButtonDown(uint modKeys, const TPoint &point)
Definition gadget.cpp:629
virtual void MouseMove(uint modKeys, const TPoint &point)
Mouse is moving over this gadget.
Definition gadget.cpp:557
void GetOuterSizes(int &left, int &right, int &top, int &bottom)
Get the four total outer sizes in pixels which consists of the margins plus the borders.
Definition gadget.cpp:496
virtual void MouseEnter(uint modKeys, const TPoint &point)
Mouse is entering this gadget.
Definition gadget.cpp:542
void SetBorders(const TBorders &borders)
Sets the borders for the gadget.
Definition gadget.cpp:224
virtual void Paint(TDC &dc)
Calls PaintBorder() to paint the indicated device context.
Definition gadget.cpp:462
void SetSize(const TSize &size)
Alters the size of the gadget and then calls TGadgetWindow::GadgetChangedSize() for the size change t...
Definition gadget.cpp:179
void Invalidate(bool erase=true)
Used to invalidate the active (usually nonborder) portion of the gadget, Invalidate calls InvalidateR...
Definition gadget.cpp:408
void GetInnerRect(TRect &rect)
Computes the area of the gadget's rectangle excluding the borders and margins.
Definition gadget.cpp:514
virtual bool IdleAction(long idleCount)
Called during idle time to allow the gadget to perform any idle actions.
Definition gadget.cpp:120
bool IsWindowVisible() const
check to see if the button's created
Definition gadget.cpp:149
virtual void MouseLeave(uint modKeys, const TPoint &point)
Mouse is leaving this gadget.
Definition gadget.cpp:566
TGadget(int id=0, TBorderStyle borderStyle=None)
Construct a gadget with a given id and border style.
Definition gadget.cpp:88
void SetMargins(const TMargins &margins)
Sets the margins of the gadget.
Definition gadget.cpp:237
virtual bool PtIn(const TPoint &point)
Default behavior returns true if the point is within the receiver's bounding rect.
Definition gadget.cpp:289
virtual void CommandEnable()
Provided so that the gadget can perform command enabling (so it can handle an incoming message if it'...
Definition gadget.cpp:132
void InvalidateRect(const TRect &rect, bool erase=true)
Invalidate a rectangle in our containing window.
Definition gadget.cpp:392
bool IsVisible() const
Returns true if the gadget is visible.
Definition gadget.h:477
TGadgetWindow * GetGadgetWindow()
Return a pointer to the owning or parent window for the gadget.
Definition gadget.h:536
virtual void Moved()
This is the virtual called when a gadget is relocated.
Definition gadget.cpp:357
virtual void SetBounds(const TRect &rect)
Called by the gadget window to inform the gadget of a change in its bounding rectangle.
Definition gadget.cpp:211
virtual void Created()
This is the virtual called after the window holding a gadget has been created.
Definition gadget.cpp:300
void SetShrinkWrap(bool shrinkWrapWidth, bool shrinkWrapHeight)
Simple set accessor to set whether shrinkwrapping is performed horizontally and/or vertically.
Definition gadget.cpp:165
virtual void Removed()
Virtual called after a gadget is removed from a window.
Definition gadget.cpp:333
virtual void Inserted()
Called after a gadget is inserted into a window.
Definition gadget.cpp:325
virtual void SysColorChange()
Called when the system colors have been changed so that gadgets can rebuild and repaint,...
Definition gadget.cpp:141
TBorderStyle
Gadget border styles.
Definition gadget.h:127
@ Embossed
Painted with an embossed border.
Definition gadget.h:132
@ WndRecessed
Input field and other window are recessed.
Definition gadget.h:137
@ Recessed
Recessed into the window.
Definition gadget.h:131
@ None
No border painted at all.
Definition gadget.h:128
@ WndRaised
Inner and outer edge of the window are raised.
Definition gadget.h:136
@ ButtonUp
Button in up position.
Definition gadget.h:134
@ Plain
Plain window frame.
Definition gadget.h:129
@ Grooved
Grouping groove.
Definition gadget.h:133
@ Raised
Raised above the gadget window.
Definition gadget.h:130
@ ButtonDn
Button in down position.
Definition gadget.h:135
virtual void SetEnabled(bool enabled)
Enables or disables keyboard and mouse input for the gadget.
Definition gadget.cpp:194
virtual void SetVisible(bool visible)
Changes the visibility of the gadget.
Definition gadget.h:466
void Update()
Paint now if possible.
Definition gadget.cpp:417
virtual void GetDesiredSize(TSize &size)
Request by the gadget window to query the gadget's desired size.
Definition gadget.cpp:479
virtual void PaintBorder(TDC &dc)
Self sent by method Paint().
Definition gadget.cpp:432
virtual void LButtonUp(uint modKeys, const TPoint &point)
Releases the mouse capture if TrackMouse is set.
Definition gadget.cpp:619
virtual ~TGadget()
Destroys a TGadget interface object and removes it from its associated window.
Definition gadget.cpp:107
void SetBorderStyle(TBorderStyle bs)
Set the border style used by this gadget.
Definition gadget.cpp:250
TGadget * NextGadget(TGadget &gadget) const
Returns the next gadget in the list relative to a given gadget.
Definition gadgetwi.h:407
static uint GetFlatStyle()
Returns the flat style.
Definition gadgetwi.h:459
@ FlatSingleDiv
Adds single divider ala IE 4.01.
Definition gadgetwi.h:197
@ FlatStandard
Flat style IE 3.0 - base style.
Definition gadgetwi.h:194
void GadgetChangedSize(TGadget &gadget)
Used to notify the gadget window that a gadget has changed its size, GadgetChangedSize calls LayoutSe...
auto Remove(TGadget &) -> TGadget *override
Removes a gadget from the gadget window.
TMargins & GetMargins()
Definition gadgetwi.h:481
bool GadgetSetCapture(TGadget &gadget)
Called by a gadget that wants to capture the mouse.
Definition gadgetwi.cpp:268
auto GetTooltip() const -> TTooltip *override
Returns Tooltip.
Definition gadgetwi.h:430
bool IsThemed() const
Definition gadgetwi.cpp:505
@ Vertical
Arrange gadgets in a column.
Definition gadgetwi.h:132
@ Rectangular
Arrange gadgets in rows and columns (2-D grid)
Definition gadgetwi.h:133
@ Horizontal
Arrange gadgets in a row.
Definition gadgetwi.h:131
TTileDirection GetDirection() const
Returns the direction of tiling for this gadget window.
Definition gadgetwi.h:416
void GadgetReleaseCapture(TGadget &gadget)
Releases the capture so that other windows can receive mouse messages.
Definition gadgetwi.cpp:286
TPoint is a support class, derived from tagPOINT.
Definition geometry.h:87
TRect is a mathematical class derived from tagRect.
Definition geometry.h:308
int Height() const
Returns the height of this rectangle (bottom - top).
Definition geometry.h:1048
int Width() const
Returns the width of this rectangle (right - left).
Definition geometry.h:1039
TSeparatorGadget is a simple class you can use to create a separator between gadgets.
Definition gadget.h:354
void Paint(TDC &dc)
Definition gadget.cpp:683
TSeparatorGadget(int size=0, int id=0, bool showseparator=true)
Used for both the width and the height of the separator, the default size is TUIMetric::CxSizeFrame t...
Definition gadget.cpp:653
void Inserted()
This is an overridden virtual, called after a gadget is inserted into a window.
Definition gadget.cpp:674
void Paint(TDC &dc)
Draws the resize gadget.
Definition gadget.cpp:842
TSizeGripGadget(int id=IDG_SIZEGRIP)
Constructs a gadget that can be grabbed to resize the frame.
Definition gadget.cpp:826
The tagSIZE struct is defined as.
Definition geometry.h:234
Encapsulates a themed part.
Definition theme.h:126
TToolInfo contains information about a particular tool (a tool is either a window or an application-d...
Definition tooltip.h:35
TTooltip encapsulates a tooltip window - i.e.
Definition tooltip.h:175
Assists in drawing borders of many styles.
Definition uihelper.h:270
@ RaisedInner
Raised inner edge only.
Definition uihelper.h:318
@ SunkenOuter
Sunken outer edge only.
Definition uihelper.h:317
void Paint(TDC &dc) const
Paints this UIBorder object onto a given device context.
Definition uiborder.cpp:112
TStyle
Enumeration describing hilevel border styles.
Definition uihelper.h:296
@ Recessed
Status field style recessed.
Definition uihelper.h:300
@ Embossed
Grouping raised emboss bead.
Definition uihelper.h:301
static bool DrawEdge(TDC &dc, const TRect &frame, uint edge, uint flags)
This is a static function that performs the actual drawing of edges for a UIBorder or an external cli...
Definition uiborder.cpp:127
TUIMetric encapsulates the GetSystemMetric() API.
Definition uimetric.h:32
static const TUIMetric CyBorder
Definition uimetric.h:40
static const TUIMetric CxBorder
Definition uimetric.h:39
static const TUIMetric CySizeFrame
Definition uimetric.h:67
static const TUIMetric CxSizeFrame
Definition uimetric.h:66
Encapsulates the DrawFrameControl 32-bit API.
Definition uihelper.h:448
@ ScrollSizeGrip
Size grip in bottom-right corner of window.
Definition uihelper.h:489
@ uiScroll
Draw a scroll bar glyph.
Definition uihelper.h:459
virtual void InvalidateRect(const TRect &rect, bool erase=true)
Invalidates a specified client area.
Definition window.h:2834
void UpdateWindow()
Updates the client area of the specified window by immediately sending a WM_PAINT message.
Definition window.h:2901
bool IsWindowVisible() const
Returns true if the window is visible.
Definition window.h:2605
void GetClientRect(TRect &rect) const
Gets the coordinates of the window's client area and then copies them into the object referred to by ...
Definition window.cpp:3624
HWND GetHandle() const
Returns the handle of the window.
Definition window.h:2020
Definition of class TFrameWindow.
Base class TGadget and simple derived TSeparatorGadget.
#define IDG_LAST
last predefined gadget ID
Definition gadget.h:28
#define IDG_FLATHANDLE
The ID for a flat bar handle.
Definition gadget.h:37
#define IDG_FIRST
first predefined gadget ID
Definition gadget.h:27
Definition of TGadgetList, TGadgetWindow & TGadgetWindowFont A list holding gadgets,...
Object Windows Library (OWLNext Core)
Definition animctrl.h:22
uint32 MkUint32(uint16 lo, uint16 hi)
Definition defs.h:261
const int DefaultGripSize
Definition gadget.cpp:646
bool ToBool(const T &t)
Definition defs.h:291
OWL_DIAGINFO
Definition animctrl.cpp:14
unsigned int uint
Definition number.h:25
General definitions used by all ObjectWindows programs.
Border dimensions.
Definition gadget.h:149
Used by the TGadgetWindow and TGadget classes, TMargins contains the measurements of the margins for ...
Definition gadget.h:54
void GetPixels(int &left, int &right, int &top, int &bottom, int fontHeight) const
Definition gadget.cpp:55
TUnits Units
Definition gadget.h:57
Microsoft UxTheme Library Encapsulation.
Definition of the TTooltip class and helper objects.
Definition of the UI Helper Classes: TUIHandle, TUIBorder, TUIFace, TUIPart.
Definition of TUIMetric, a UI metrics provider class.