OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
glyphbtn.cpp
Go to the documentation of this file.
1//----------------------------------------------------------------------------
2// ObjectWindows
3// Copyright (c) 1995, 1996 by Borland International, All Rights Reserved
4//
5/// \file
6/// Implementation of TGlyphButton
7//----------------------------------------------------------------------------
8#include <owl/pch.h>
9
10#include <owl/glyphbtn.h>
11#include <owl/uihelper.h>
12#include <owl/celarray.h>
13#include <owl/gdiobjec.h>
14#include <owl/color.h>
15#include <owl/system.h>
16#include <owl/theme.h>
17#include <owl/commctrl.h>
18#include <owl/glyphbtn.rh>
19
20#if defined(__BORLANDC__)
21# pragma option -w-ccc // Disable "Condition is always true/false"
22#endif
23
24namespace owl {
25
26const int LayoutMargin = 4;
28const int BUTTONSTATE_PUSHED = 0x0004;
29const int BUTTONSTATE_FOCUS = 0x0008;
30const int BUTTONSTATE_HOT = 0x0010;
31const uint32 BUTTONSTYLE_MASK = 0x000000FFL;
32const long RopDSPDxax = 0x00E20746L;
33
34//
35// Helper function - extracts the button style bits.
36//
37static inline uint32
38ButtonStyle(uint32 style)
39{
40 return style & BUTTONSTYLE_MASK;
41}
42
43
44
46DIAG_DECLARE_GROUP(OwlControl); // General Controls diagnostic group
47
48
49//
50/// Loads the specified bitmap and updates the face color, if necessary.
51/// If not specified, the default face color is assumed to be TColor::LtGray.
52//
61
62
63//
64/// Aliases the specified bitmap handle and updates the face color, if necessary.
65/// If not specified, the default face color is assumed to be TColor::LtGray.
66//
75
76
77//
78/// Updates the face color of the associated bitmap to the current system setting.
79/// Does nothing if the current face color already matches the system color.
80//
81void
83{
85 TBitmap copy(*this);
87 dstDC.SelectObject(*this);
88 srcDC.SelectObject(copy);
90 dstDC.RestoreBitmap();
91 srcDC.RestoreBitmap();
93 }
94}
95
96
97//
98/// Helper routine used to map the face color of the underlying bitmap.
99//
100void
102 const TColor& fromColor, int width, int height)
103{
104 // Create a monochrome mask
105 //
107 TBitmap hMask(width, height);
108 hMemDC.SelectObject(hMask);
109
110 // Build a mask where the source color is zeroed
111 //
112 TColor crBack = srcDC.SetBkColor(fromColor);
113 hMemDC.BitBlt(0, 0, width, height, srcDC, 0, 0, SRCCOPY);
114 srcDC.SetBkColor(crBack);
115
116 // Make a brush out of the destination color
117 //
120
121 // Copy the mask to the destination
122 //
123 dc.BitBlt(0, 0, width, height, srcDC, 0, 0, SRCCOPY);
124
125 // Copy the source bitmap to the destination by applying the
126 // brush where pixels are zeroed
127 //
128 dc.BitBlt(0, 0, width, height, hMemDC, 0, 0, RopDSPDxax);
129 dc.RestoreBrush();
130}
131
132
133namespace
134{
135
136 //
137 // Returns `true` if themes are enabled for this application and
138 // themed Common Controls (version 6 or later) are in use.
139 //
140 // Important: This function must be called after the creation of the main
141 // window, otherwise it may always return `false`.
142 //
143 // Note that IsAppThemed will return `false` if either (a) themes have been
144 // disabled for the application by selecting "Disable visual themes" in the
145 // Compatibility tab in the Properties dialog for the executable, or (b)
146 // themes have been deactivated by selecting the Windows Classic style in
147 // the Windows XP/7/Vista Control Panel (not available in Windows 8).
148 // Note that (b) may change at run-time.
149 //
150 // Note we do not have to use IsThemeActive here. This function only reports
151 // the state of the Control Panel setting (Classic vs themed).
152 //
153 bool IsThemed()
154 {
155 static const auto v = GetCommCtrlVersion();
156 return TThemeModule::GetInstance().IsAppThemed() && v >= 0x60000;
157 }
158
159} // namespace
160
161//
162/// Constructor of TGlyphButton - Use this constructor to create a GlyphBtn from
163/// scratch.
164//
166 int X, int Y, int W, int H, TBtnType type,
167 bool isDefault, TModule* module)
168:
169 TButton(parent, id, text, X, Y, W, H, isDefault, module)
170{
171 InitVars();
172 BtnType = type;
173 if(type != btCustom)
174 InitGlyp(type);
175}
176
177//
178/// String-aware overload
179//
181 TWindow* parent,
182 int id,
183 const tstring& text,
184 int X, int Y, int W, int H,
186 bool isDefault,
187 TModule* module
188 )
189 : TButton(parent, id, text, X, Y, W, H, isDefault, module)
190{
191 InitVars();
192 BtnType = type;
193 if(type != btCustom)
194 InitGlyp(type);
195}
196
197
198//
199/// Constructor of TGlyphButton - Use this constructor to alias a glyph button
200/// control specified in a dialog template.
201/// For more information how to use glyph buttons from a resource, see \ref abouttheglyphbuttoncontrol
202//
204 TBtnType type, TModule* module)
205:
206 TButton(parent, resourceId, module)
207{
208 InitVars();
209 BtnType = type;
210 if(type != btCustom)
211 InitGlyp(type);
212}
213
214
215//
216/// Method used to initialized variables used by GlyphButton's implementation.
217//
218void
220{
221 CelArray = 0;
222 BtnFont = 0;
223 xText = yText = -1;
224 xGlyph = yGlyph = -1;
225 LayStyle = lsH_GST;
226 BtnType = btCustom;
228}
229
230//
231/// Destructor - Cleans up resources used by Glyph Button object.
232//
234{
235 delete CelArray;
236 delete BtnFont;
237}
238
239
240//
241//init Glip
242//
244{
245 uint ResIdUp = 0;
246 switch(type){
247 case btOk:
248 case btYes:
249 case btAbort:
251 break;
252 case btCancel:
253 case btClose:
254 case btIgnore:
256 break;
257 case btNo:
259 break;
260 case btHelp:
262 break;
263 case btApply:
265 break;
266 case btBrowse:
268 break;
269 case btRevert:
271 break;
272 case btAdd :
274 break;
275 case btDelete:
277 break;
278 case btEdit:
280 break;
281 case btKey:
283 break;
284 case btSetup:
286 break;
287 case btCustom:
288 default: //JJH added empty default construct
289 break;
290 }
291 if(ResIdUp){
292 delete CelArray;
293 CelArray = new TCelArray(new TBtnBitmap(GetGlobalModule(), ResIdUp, TColor::LtGray), 3); //CelsTotal);
295 }
296 return;
297}
298
299
300//
301// Response Table
302//
325
326//
327// Window proc. of control to handle messages sent before OWL thunks
328//
331{
332 switch(msg) {
333 case WM_GETDLGCODE: {
334 uint32 btnStyle = ButtonStyle(GetWindowLong(hwnd, GWL_STYLE));
337 else
339 }
340 }
341 return DefWindowProc(hwnd, msg, wParam, lParam);
342}
343
344//
345/// Overriden virtual of TWindow - Fills out information about the Window class
346/// associated with a glyph button.
347/// \note The class information is based on the system's "BUTTON" class.
348//
349void
351{
352 // Grab a the attributes of the native "BUTTON" control
353 //
354 if (::GetClassInfo(0, _T("BUTTON"), &wndClass)) {
355 wndClass.hInstance = *GetModule();
356 wndClass.lpszClassName = GetWindowClassName().GetPointerRepresentation();
357 wndClass.lpfnWndProc = BButtonProc;
358 }
359 else {
362 wndClass.hbrBackground = HBRUSH(COLOR_BTNFACE+1);
363 }
364}
365
366//
367/// Returns name of window class associated with a glyph button control.
368//
373
374//
375/// Overriden virtual of TWindow - Updates internal flags based on style of
376/// underlying window.
377//
378void
380{
382
383 // Update state flags based on current style
384 //
385 if (ButtonStyle(GetStyle()) == BS_DEFPUSHBUTTON)
386 Set(biDefault);
387 if (GetStyle() & WS_DISABLED)
389
390 // Get Parent font -> dialog font
391 //
392 delete BtnFont;
394 BtnFont = hFont ? new TFont(hFont) : new TDefaultGuiFont();
395}
396
397//
398/// Sets the bitmap to use for the specified button state (glyph type).
399/// The 'bitmap' parameter can be `nullptr` to reset the glyph for the given state.
400///
401/// \note TColor::Sys3dFace is the 'face color' used to denote transparency.
402/// If you want a different color to denote transparency, you must map the colors of the
403/// bitmap before passing it. TBtnBitmap is made for this purpose.
404//
406{
407 PRECONDITION(!bitmap || bitmap->IsGDIObject());
408 if(!CelArray && bitmap && type != gtCellArray)
410
411 switch (type) {
412 case gtUp:
413 if(bitmap){
414 CelArray->Replace(0, *bitmap);
416 delete bitmap;
417 Set(biGtUp);
418 }
419 else
420 Clear(biGtUp);
421 break;
422
423 case gtDown:
424 if(bitmap){
425 CelArray->Replace(1, *bitmap);
427 delete bitmap;
428 Set(biGtDown);
429 }
430 else
432 break;
433
434 case gtDisabled:
435 if(bitmap){
436 CelArray->Replace(2, *bitmap);
438 delete bitmap;
440 }
441 else
443 break;
444
445 case gtCellArray:
446 if(bitmap){
447 delete CelArray;
448 CelArray = new TCelArray((autoDelete==AutoDelete?
449 bitmap:new TBitmap(*bitmap)),3);
451 }
452 else
454 break;
455
456 default:
457 break;
458 }
459
460 // Update status flag
461 //
462 if (IsSet(biGtUp))
464 else
466}
467
468//
469/// Sets the icon to use for the specified button state (glyph type).
470//
472{
473 const auto createBitmap = [](const TIcon& icon, TColor bkgndColor)
474 {
475 const auto i = icon.GetInfo();
476 auto bmp = i.Color;
477 TMemoryDC dc{bmp};
478 const auto faceBrush = TBrush{bkgndColor};
479 dc.SelectObject(faceBrush);
480 const auto r = TRect{{0, 0}, bmp.Size()};
481 dc.MaskBlt(r, dc, r.TopLeft(), i.Mask, r.TopLeft(), MAKEROP4(PATCOPY, SRCCOPY));
482 dc.RestoreBitmap(); // Needed to commit changes to the bitmap.
483 return bmp;
484 };
487}
488
489//
490/// Sets the bitmap to use for the specified button state (glyph type).
491///
492/// \note TColor::LtGray is the 'face color' used to denote transparency.
493/// If you want a different color to denote transparency, then create a TBtnBitmap and use
494/// the SetGlyph (TBitmap*, ...) overload instead.
495//
502
503//
504/// Sets the bitmap resource to use for the specified button state (glyph type).
505///
506/// \note TColor::LtGray is the 'face color' used to denote transparency.
507/// If you want a different color to denote transparency, then create a TBtnBitmap and use
508/// the SetGlyph (TBitmap*, ...) overload instead.
509//
511{
512 PRECONDITION(module != 0 || GetModule());
513 SetGlyph(new TBtnBitmap(module ? *module : *GetModule(), resId, TColor::LtGray), type,
514 AutoDelete);
515}
516
517//
518// Create CellArray with 3 elements
519//
520void
522{
523 CelArray = new TCelArray(cell->Size(), 0, 3,2);
524 CelArray->Add(*cell);
525 CelArray->Add(*cell);
526 CelArray->Add(*cell);
527}
528
529//
530/// WM_PAINT handler - Invokes 'Paint' method to display glyph and/or text.
531//
532void
534{
535 TPaintDC dc(*this);
536 TRect& rect = *(TRect*)&dc.Ps.rcPaint;
537 Paint(dc, dc.Ps.fErase, rect);
538}
539
540//
541/// Renders the button in a flicker-free manner.
542/// Creates a memory DC into which the button is rendered by calling PaintButton.
543/// The rendered bitmap is then blitted to the given device context.
544//
545void
546TGlyphButton::Paint(TDC& dc, bool /*erase*/, TRect&)
547{
548 const TRect r = GetClientRect();
549 TMemoryDC mdc(dc);
550 TBitmap b(dc, r.Width(), r.Height());
551 mdc.SelectObject(b);
553 dc.BitBlt(r, mdc, r.TopLeft());
554 mdc.RestoreBitmap();
555}
556
557
558//
559/// WM_ERASEBKGND handler - Returns true to prevent background from being erased.
560/// (WM_PAINT handler paints whole client area).
561//
562bool
564{
565 return true;
566}
567
568//
569/// WM_SETFOCUS handler - Updates internal flag and forces button to redraw.
570//
571void
573{
574 Set(biFocus);
575 Invalidate(true);
576}
577
578//
579/// WM_KILLFOCUS handler - Updates internal flag and forces button to redraw.
580//
581void
583{
584 Clear(biFocus);
585 if (IsSet(biPushed))
586 ClearCapture();
587 else
588 Invalidate(true);
589}
590
591//
592/// WM_GETFONT handler - Returns font used by control if one was specified earlier.
593/// Otherwise, returns 0.
594//
595HFONT
597{
598 PRECONDITION(!BtnFont || BtnFont->IsGDIObject());
599 return BtnFont ? HFONT(*BtnFont) : HFONT(0);
600}
601
602//
603/// WM_SETFONT Handler. Deletes any cached font and stores a copy of the new one.
604//
605void
607{
608 delete BtnFont;
609 BtnFont = new TFont(hFont);
610 if (redraw)
611 Invalidate();
612}
613
614//
615/// WM_GETDLGCODE handler. Informs dialog manager of a 'normal' push button or the
616/// default push button according to the style.
617//
618uint
620{
621 if (IsSet(biDefault))
623 else
625}
626
627//
628/// WM_LBUTTONDOWN handler. Grabs focus and updates button's state to be in 'pushed'
629/// mode.
630//
631void
632TGlyphButton::EvLButtonDown(uint /*modKeys*/, const TPoint& /*point*/)
633{
634 SetCapture();
636 if(!IsSet(biFocus))
637 SetFocus();
638}
639
640//
641/// WM_LBUTTONDBLCLK handler. Simply forwards to LBUTTONDOWN handler.
642//
643void
648
649//
650/// WM_LBUTTONUP handler. Restores state of button and notifies parent with a
651/// CLICKED message if necessary.
652//
653void
655{
656 if (GetCapture() == *this) {
658
660
661 TRect rect;
663
664 if (rect.Contains(point)) {
666 }
667 }
668}
669
670//
671/// WM_MOUSEMOVE handler. Updates state of button if it is in 'capture' mode.
672//
673void
675{
676 TRect rect;
678 if (modKeys & MK_LBUTTON && GetCapture() == *this) {
679
680 if (rect.Contains(point))
682 else
684 }
685 else if (IsThemed() && rect.Contains(point))
686 {
687 if (!IsSet(biHot))
688 {
689 SendMessage(BM_SETSTATE, 2); //HOT
690 TrackMouseEvent(TME_LEAVE); // Order the WM_MOUSELEAVE message.
691 }
692 }
693}
694
695//
696/// WM_KEYDOWN handler. Updates the state of the button upon detecting that the user
697/// pressed the space bar.
698//
699void
700TGlyphButton::EvKeyDown(uint key, uint /*repeatCount*/, uint /*flags*/)
701{
702 if (key == VK_SPACE)
704}
705
706//
707/// WM_KEYUP handler. Restores state of button and notify parent.
708//
709void
710TGlyphButton::EvKeyUp(uint key, uint /*repeatCount*/, uint /*flags*/)
711{
712 if (IsSet(biPushed) && key == VK_SPACE) {
714
716 BN_CLICKED, *this);
717 }
718}
719
720//
721/// WM_ENABLE handler. Updates internal flags and invalidates control if necessary.
722//
723void
725{
726 if (enabled) {
728 }
729 else {
730 ClearCapture();
732 }
733 Invalidate(true);
734}
735
736//
737/// WM_CANCELMODE handler. Releases capture if currently in capture mode and
738/// terminates any internal operation on the button.
739//
740void
745
746/// WM_SYSCOLORCHANGE handler – Reloads buttons.
747void
749{
751 if(BtnType != btCustom)
752 InitGlyp(BtnType);
753}
754
755//
756/// Cancels button Hot state.
757//
758void
764
765//
766/// BM_GETSTATE handler. Returns the current state of the window.
767//
770{
771 TResult result = 0;
772 if (IsSet(biPushed))
773 result |= BUTTONSTATE_PUSHED;
774
775 if (IsSet(biFocus))
776 result |= BUTTONSTATE_FOCUS;
777
778 if (IsSet(biHot))
779 result |= BUTTONSTATE_HOT;
780
781 return result;
782}
783
784//
785/// BM_SETSTATE handler. Updates internal state flags based on parameters and
786/// redraws control if necessary.
787//
790{
791 switch (param1)
792 {
793 case 1: // Needs hilight look
794 if (!IsSet(biPushed))
795 {
796 Set(biPushed);
797 PaintNow();
798 }
799 break;
800
801 case 2: //New: Hot state
802 if (!IsSet(biHot))
803 {
804 Set(biHot);
805 PaintNow();
806 }
807 break;
808
809 default: // Needs normal look
810 if (IsSet(biPushed)||IsSet(biHot))
811 {
813 Clear(biHot);
814 PaintNow();
815 }
816 break;
817 }
818 return 0;
819}
820
821//
822/// BM_SETSTYLE handler. Updates internal flags to match specified parameters and
823/// invalidates the window if necessary.
824//
827{
828 struct Local
829 {
831 {
832 using namespace owl; // Circumvents compiler issue.
833
835 uint32 other = b->GetStyle() & ~BUTTONSTYLE_MASK;
836 b->TWindow::SetStyle(bs | other);
837 }
838 };
839
840 // Grab and splice the styles
841 //
842 uint32 btnStyle = ButtonStyle(GetStyle());
843 uint32 newBtnStyle = ButtonStyle(static_cast<uint32>(param1));
844
845 // Check against passed in parameter
846 // NOTE: We only cater to PUSHBUTTON and DEFPUSHBUTTON
847 // The current definition so BS_PUSHBUTTON is 0L
848 //
850 {
851 // Make 'simple' push button
852 //
853 Local::SetButtonStyle(this, newBtnStyle);
855 Invalidate(true);
856 }
858 {
859 // Make 'default' push button
860 //
861 Local::SetButtonStyle(this, newBtnStyle);
862 Set(biDefault);
863 Invalidate(true);
864 }
865
866#if defined(__DEBUG) || defined(__TRACE) || defined(__WARN)
868 TRACEX(OwlControl, 0, "BmSetStyle: Invalid style specified");
869#endif
870
871 return 0;
872}
873
874//
875/// Releases caption if we are in 'capture' mode. Resets internal flags
876/// appropriately.
877//
878void
880{
881 if (GetCapture() == *this)
884 Invalidate(true);
885}
886
887//
888/// Entry point for painting the button to the given device context.
889//
890void
892{
893 TRect rect;
895
896 if (IsThemed())
897 {
898 // Draw themed background. This ignores all our border styles.
899 // PBS_NORMAL = 1, PBS_HOT = 2, PBS_PRESSED = 3, PBS_DISABLED = 4, PBS_DEFAULTED = 5, PBS_DEFAULTED_ANIMATING = 6,
900 int state = IsSet(biDisabled) ? PBS_DISABLED :
902 IsSet(biHot) ? PBS_HOT :
905 TThemePart part(GetHandle(), L"BUTTON", BP_PUSHBUTTON, state);
906 part.DrawTransparentBackground(GetHandle(), dc, rect);
907 }
908 else
909 {
910 // Themes are not available. Draw classic style.
911 //
913 PaintFrame(dc, rect);
914 }
915 PaintFace(dc, rect);
916}
917
918//
919/// Draws the border of the button.
920//
921void
923{
924 // Paint the border
925 //
928 uiBorder.Paint(dc);
929
930 // Shrink the rectangle to leave the face
931 //
932 rect = uiBorder.GetClientRect();
933}
934
935//
936/// Draws a frame around the button if it's a default push button.
937//
938void
940{
941 if (IsSet(biDefault)){
942 if (rect.Width() > 2 && rect.Height() > 2) {
946
947#if 0
948 rect.Inflate(-1, -1);
949 dc.Rectangle(rect);
950#else
951 dc.Rectangle(rect);
952 rect.Inflate(-1, -1);
953#endif
954 dc.RestoreBrush();
955 dc.RestorePen();
956 }
957 }
958}
959
960//
961/// Draws the face of the button [i.e. text and glyph portions].
962//
963void
965{
966 const bool isThemed = IsThemed();
967 if (!isThemed)
968 {
969 // Fill the background with the face color
970 //
972 dc.FillRect(rect, brush);
973 }
974
975 // Grab the glyph and it's size
976 //
977 int index = -1; // index into array
978 TRect glyphRect; // Size of glyph. (default constructor now zerroed all members) !!!!!!!!!1
979 if(IsSet(biShowGlyph)){
980
981 // Start with the up bitmap
982 index = 0;
983
984 // Switch to more appropriate bitmap if applicable
985 //
986 if (IsSet(biPushed) && IsSet(biGtDown))
987 index = 1;
988 else if (IsSet(biDisabled) && IsSet(biGtDisabled))
989 index = 2;
990
991 CHECK(CelArray);
992 TSize cell = CelArray->CelSize();
993 glyphRect.Set(0, 0, cell.cx, cell.cy);
994 }
995
996 // Grab some information about the text/caption
997 //
998 int len = 0; // Length of Caption
999 TRect textRect; // Size of text (default constructor now zerroed all members) !!!!!!
1000 TAPointer<tchar> text; // Pointer to caption dynamic buffer
1001 TPointer<TFont> tmpFnt; // Object wrapping font handle
1002 TColor textColor; // Color used for button's text
1003
1004 if (IsSet(biShowText)) {
1006 if (len){
1007
1008 // Select the font
1009 //
1010 if (!BtnFont)
1011 {
1012 HFONT parentFont = reinterpret_cast<HFONT>(::SendMessage(GetParentH(), WM_GETFONT, 0, 0));
1013 tmpFnt = parentFont ? new TFont(parentFont) : static_cast<TFont*>(new TDefaultGuiFont());
1014 }
1015 const TFont& f = BtnFont ? *BtnFont : *tmpFnt;
1016 CHECK(f.IsGDIObject());
1017 dc.SelectObject(f);
1018
1019 text = new tchar[len+1];
1021 textRect.Set(0, 0, rect.Width() - glyphRect.Width(), SHRT_MAX);
1022
1025 }
1026 }
1027
1028 // If we have text and/or glyph, lay them out and paint them
1029 //
1030 if (!textRect.IsNull() || !glyphRect.IsNull()) {
1031
1033
1034 // Offset things to the lower right if we're in down
1035 //
1036 if (IsSet(biPushed)) {
1037 if (!glyphRect.IsNull() && index != 1)
1038 glyphRect.Offset(1, 1);
1039 if (!textRect.IsNull())
1040 textRect.Offset(1, 1);
1041 }
1042
1043 // Paint the components of the button
1044 //
1045 if (!glyphRect.IsNull()) {
1046 PRECONDITION(CelArray);
1047
1048 // Create a UI Face object for this button & let it paint the button face.
1049 //
1050 if (isThemed) {
1051 TRect srcRect(CelArray->CelRect(index));
1052 TUIFace face(rect, *CelArray);
1053 const TPoint dstPt = glyphRect.TopLeft();
1054 const TUIFace::TState state = TUIFace::Normal;
1055 const bool pressed = false;
1056 face.Paint(dc, srcRect, dstPt, state, pressed, false); // no fill (transparent)
1057 }
1058 else {
1059 // If not themed, painting like above will not center oversized images properly.
1060 // Hence we use the original non-themed code here.
1061 //
1062 CelArray->BitBlt(index, dc, glyphRect.left, glyphRect.top);
1063 }
1064 }
1065 if (!textRect.IsNull()) {
1066 // Paint disabled text in 3d style
1067 if (IsSet(biDisabled)) {
1070 TUIFace::Disabled, false, false);
1071 }
1072 else{
1073 int mode = dc.SetBkMode(TRANSPARENT);
1077 dc.SetBkMode(mode);
1078 }
1079 }
1080 }
1081
1082 // Paint the focus rect [if necessary]
1083 //
1084 if (IsSet(biFocus))
1085 {
1086 if (isThemed || textRect.IsNull())
1087 PaintFocusRect(dc, rect.InflatedBy(-LayoutMargin, -LayoutMargin));
1088 else
1090 }
1091
1092 // Restore font
1093 //
1094 if (len && (BtnFont || tmpFnt))
1095 dc.RestoreFont();
1096}
1097
1098//
1099/// Virtual routine invoked to retrieve the placement of text and glyph when drawing
1100/// the button.
1101///
1102/// Override this routine to customize the layout logic and support
1103/// custom layout styles.
1104//
1105void
1108{
1109 // Must have either text or a glyph
1110 //
1111 PRECONDITION(!textRect.IsNull() || !glyphRect.IsNull());
1112
1113 // First check for lsNone and, if so, use specified coordinates.
1114 //
1115 if (LayStyle == lsNone)
1116 {
1117 if (!textRect.IsNull() && xText >= 0 && yText >= 0)
1118 textRect.Offset(xText, yText);
1119 if (!glyphRect.IsNull() && xGlyph >= 0 && yGlyph >= 0)
1120 glyphRect.Offset(xGlyph, yGlyph);
1121 }
1122
1123 // Now check for the case where we've got either
1124 // text or glyph - but not both
1125 //
1126 else if (textRect.IsNull() || glyphRect.IsNull())
1127 {
1128 TRect& centerRect = textRect.IsNull() ? glyphRect : textRect;
1129
1130 centerRect.Offset(faceRect.left, faceRect.top);
1131 if (centerRect.Width() < faceRect.Width())
1132 centerRect.Offset((faceRect.Width() - centerRect.Width())/2, 0);
1133 else
1134 centerRect.right = faceRect.right;
1135 if (centerRect.Height() < faceRect.Height())
1136 centerRect.Offset(0, (faceRect.Height() - centerRect.Height())/2);
1137 else
1138 centerRect.bottom = faceRect.bottom;
1139 }
1140
1141 // Here we attempt to layout both the glyph and text
1142 //
1143 else {
1144 // Align upper left corners of face, text and glyph rectangles
1145 //
1146 glyphRect.Offset(faceRect.left, faceRect.top);
1147 textRect.Offset(faceRect.left, faceRect.top);
1148
1149 // Compute amount of 'extra' space, if any, and how to partition it
1150 // between the two items
1151 //
1152 int hspace = faceRect.Width() - glyphRect.Width()- textRect.Width() -
1153 LayoutMargin*2;
1154 int vspace = faceRect.Height() - glyphRect.Height()- textRect.Height() -
1155 LayoutMargin*2;
1156 int gDelta=0;
1157 int tDelta=0;
1158
1159 switch (LayStyle) {
1160 case lsH_SGST: {
1161 gDelta = hspace >= 0 ? LayoutMargin + hspace/3 :
1162 LayoutMargin + hspace/2;
1163 tDelta = hspace >= 0 ? gDelta + glyphRect.Width() + hspace/3 :
1164 gDelta + glyphRect.Width();
1165 }
1166 break;
1167 case lsH_GST: {
1169 tDelta = hspace >= 0 ? gDelta + glyphRect.Width() + hspace/2 :
1170 gDelta + glyphRect.Width();
1171 }
1172 break;
1173 case lsH_STSG: {
1174 tDelta = hspace >= 0 ? LayoutMargin + hspace/3 :
1175 LayoutMargin + hspace/2;
1176 gDelta = hspace >= 0 ? tDelta + textRect.Width() + hspace/3 :
1177 tDelta + textRect.Width();
1178 }
1179 break;
1180 case lsH_TSGS: {
1181 tDelta = 0;
1182 gDelta = hspace >= 0 ? textRect.Width() + hspace/3 : textRect.Width();
1183 if(IsSet(biDefault))
1184 tDelta--;
1185 }
1186 break;
1187 case lsV_SGST: {
1188 gDelta = vspace >= 0 ? LayoutMargin + vspace/3 :
1189 LayoutMargin + vspace/2;
1190 tDelta = vspace >= 0 ? gDelta + glyphRect.Height() + vspace/3 :
1191 gDelta + glyphRect.Height();
1192 }
1193 break;
1194 case lsV_GST: {
1196 tDelta = vspace >= 0 ? gDelta + glyphRect.Height() + vspace/2 :
1197 gDelta + glyphRect.Height();
1198 }
1199 break;
1200 case lsV_STSG: {
1201 tDelta = vspace >= 0 ? LayoutMargin + vspace/3 :
1202 LayoutMargin + vspace/2;
1203 gDelta = vspace >= 0 ? tDelta + textRect.Height() + vspace/3 :
1204 tDelta + textRect.Height();
1205 }
1206 break;
1207 case lsV_TSGS: {
1208 tDelta = 0;
1209 gDelta = vspace >= 0 ? textRect.Height() + vspace/3 : textRect.Height();
1210 if(IsSet(biDefault))
1211 tDelta--;
1212 }
1213 break;
1214 default:
1215 break;
1216 }
1217
1218 int gx=0,gy=0;
1219 if (LayStyle == lsH_SGST || LayStyle == lsH_GST ||
1220 LayStyle == lsH_STSG || LayStyle == lsH_TSGS ) {
1221
1222 // Center vertically
1223 //
1224 if (textRect.Height() < faceRect.Height())
1225 textRect.Offset(0, (faceRect.Height() - textRect.Height())/2);
1226 if (glyphRect.Height() < faceRect.Height()){
1227 gy = (faceRect.Height() - glyphRect.Height())/2;
1228 if(IsSet(biDefault)){
1229 gx--;
1230 if(LayStyle == lsH_STSG || LayStyle == lsH_TSGS)
1231 gx+=2;
1232 }
1233 }
1234 else{
1235 gy = (faceRect.Height() - glyphRect.Height())/2;
1236 if(IsSet(biDefault))
1237 gx--,gy--;
1238 }
1239
1240 // Layout horizontally
1241 //
1242 glyphRect.Offset(gx+gDelta, gy);
1243 textRect.Offset(tDelta, 0);
1244 }
1245 else if (LayStyle == lsV_SGST || LayStyle == lsV_GST ||
1246 LayStyle == lsV_STSG || LayStyle == lsV_TSGS ) {
1247
1248 // Or center horizontally
1249 if (textRect.Width() < faceRect.Width())
1250 textRect.Offset((faceRect.Width() - textRect.Width())/2, 0);
1251 if (glyphRect.Width() < faceRect.Width()){
1252 gx += (faceRect.Width() - glyphRect.Width())/2;
1253 if(IsSet(biDefault)){
1254 gy--;
1255 if(LayStyle == lsV_STSG || LayStyle == lsV_TSGS)
1256 gy+=2;
1257 }
1258 }
1259 else{
1260 gy = (faceRect.Height() - glyphRect.Height())/2;
1261 if(IsSet(biDefault))
1262 gx--,gy--;
1263 }
1264 // Layout vertically
1265 glyphRect.Offset(gx, gy+gDelta);
1266 textRect.Offset(0, tDelta);
1267 }
1268 }
1269}
1270
1271//
1272/// Specifies a 'style' describing how text and glyph should be laid out.
1273/// Invalidates the window if necessary.
1274//
1275void
1277{
1278 if (style != LayStyle) {
1279 LayStyle = style;
1280 if (GetHandle())
1281 Invalidate();
1282 }
1283}
1284
1285
1286//
1287/// Sets text coordinates and invalidates window if necessary.
1288//
1289void
1291{
1292 if (x != xText || y != yText) {
1293 xText = x;
1294 yText = y;
1295 if (GetHandle())
1296 Invalidate();
1297 }
1298}
1299
1300
1301//
1302/// Sets the upper left corner of glyphs and invalidates window if necessary.
1303//
1304void
1306{
1307 if (x != xGlyph || y != yGlyph) {
1308 xGlyph = x;
1309 yGlyph = y;
1310 if (GetHandle())
1311 Invalidate();
1312 }
1313}
1314
1315
1316//
1317/// Displays a focus rectangle.
1318//
1319void
1327
1328//
1329/// Repaints window right away by retrieving a client DC and invoking the 'Paint'
1330/// method.
1331//
1332void
1334{
1335 TRect rect;
1337 TClientDC dc(*this);
1338 Paint(dc, false, rect);
1339}
1340
1341} // OWL namespace
1342/* ========================================================================== */
1343
Definition of a bitmap Cel array class.
#define CHECK(condition)
Definition checks.h:239
#define PRECONDITION(condition)
Definition checks.h:227
#define DIAG_DECLARE_GROUP(group)
Definition checks.h:404
#define TRACEX(group, level, message)
Definition checks.h:263
TBitmap is the GDI bitmap class derived from TGdiObject.
Definition gdiobjec.h:510
int Width() const
Returns the width of this bitmap using GDI's GetObject.
Definition bitmap.cpp:278
int Height() const
Returns the height of this bitmap using GDI's GetObject.
Definition bitmap.cpp:289
The GDI Brush class is derived from TGdiObject.
Definition gdiobjec.h:180
TBtnBitmap is an enhanced version of TBitmap with the ability to update the face color of a bitmap to...
Definition glyphbtn.h:49
static void MapColor(TDC &dc, TDC &srcDC, const TColor &toColor, const TColor &fromColor, int width, int height)
Helper routine used to map the face color of the underlying bitmap.
Definition glyphbtn.cpp:101
TBtnBitmap(HINSTANCE hInstance, TResId resId, const TColor &faceColor=TColor::LtGray)
Loads the specified bitmap and updates the face color, if necessary.
Definition glyphbtn.cpp:53
void UpdateFaceColor()
Updates the face color of the associated bitmap to the current system setting.
Definition glyphbtn.cpp:82
TColor FaceColor
Current face color of bitmap.
Definition glyphbtn.h:62
TButton is an interface class derived from TControl that represents a pushbutton interface element.
Definition button.h:41
void SetupWindow() override
Overrides TWindow's SetupWindow function.
Definition button.cpp:132
TCelArray is a horizontal array of cels (a unit of animation) created by slicing a portion of or an e...
Definition celarray.h:35
TSize CelSize() const
Return the size of the celarray.
Definition celarray.h:133
bool BitBlt(int index, TDC &dc, int x, int y, uint32 rop=SRCCOPY)
Draws the cel at index onto the DC at position x and y.
Definition celarray.cpp:290
bool Replace(int index, const TBitmap &image)
Replace a cel in this CelArray.
Definition celarray.cpp:259
int Add(const TBitmap &image)
Add new cel(s) to the CelArray - return index of new addition.
Definition celarray.cpp:186
TRect CelRect(int cel) const
Returns the upper left and lower right corner of a given cell from the current row,...
Definition celarray.h:149
A device context class derived from TWindowDC, TClientDC provides access to the client area owned by ...
Definition dc.h:640
Class wrapper for management of color values.
Definition color.h:245
static const TColor SysBtnText
The symbolic system color value for the text on buttons.
Definition color.h:342
static const TColor SysWindowFrame
The symbolic system color value for the frame around each window.
Definition color.h:330
static const TColor LtGray
Static TColor object with fixed Value set by RGB(192, 192, 192).
Definition color.h:306
static const TColor Sys3dShadow
The symbolic system color value for the shadow regions of 3-dimensional display elements (for edges f...
Definition color.h:340
static const TColor Sys3dFace
The symbolic system color value for the face color of 3-dimensional display elements.
Definition color.h:339
TDC is the root class for GDI DC wrappers.
Definition dc.h:64
void SelectObject(const TBrush &brush)
Selects the given GDI brush object into this DC.
Definition dc.cpp:113
bool FillRect(int x1, int y1, int x2, int y2, const TBrush &brush)
Fills the given rectangle on this DC using the specified brush.
Definition dc.h:1802
void RestorePen()
Restores the original GDI pen object to this DC.
Definition dc.cpp:220
bool DrawFocusRect(int x1, int y1, int x2, int y2)
Draws the given rectangle on this DC in the style used to indicate focus.
Definition dc.h:1854
bool Rectangle(int x1, int y1, int x2, int y2)
Draws and fills a rectangle of the given size on this DC with the current pen and brush objects.
Definition dc.h:2298
void RestoreBrush()
Restores the original GDI brush object to this DC.
Definition dc.cpp:233
virtual void RestoreFont()
Restores the original GDI font object to this DC.
Definition dc.cpp:246
virtual void SelectStockObject(int index)
Selects into the DC a predefined stock pen, brush, font, or palette.
Definition dc.cpp:206
bool BitBlt(int dstX, int dstY, int w, int h, const TDC &srcDC, int srcX, int srcY, uint32 rop=SRCCOPY)
Performs a bit-block transfer from srcDc (the given source DC) to this DC (the destination DC).
Definition dc.h:2421
virtual TColor SetTextColor(const TColor &color)
Sets the current text color of this DC to the given color value.
Definition dc.cpp:417
int SetBkMode(int mode)
Sets the background mode to the given mode argument, which can be either OPAQUE or TRANSPARENT.
Definition dc.h:1116
int DrawText(const tstring &str, int count, const TRect &, uint16 format=0)
Overload for const TRect& For obvious reasons, this overload does not support the DT_CALCRECT format ...
Definition dc.cpp:653
Encapsulates the system font used for a specific GUI element, e.g. icon, caption, menu,...
Definition gdiobjec.h:380
TFont derived from TGdiObject provides constructors for creating font objects from explicit informati...
Definition gdiobjec.h:296
bool IsGDIObject() const
Returns true if this represents a real GDI object.
Definition gdiobjec.h:1071
TGlyphButton encapsulates a control which is capable of displaying a bitmap (or glyph) and/or text.
Definition glyphbtn.h:73
void EvLButtonUp(uint modKeys, const TPoint &point)
WM_LBUTTONUP handler.
Definition glyphbtn.cpp:654
void EvLButtonDblClk(uint modKeys, const TPoint &point)
WM_LBUTTONDBLCLK handler. Simply forwards to LBUTTONDOWN handler.
Definition glyphbtn.cpp:644
void EvKillFocus(THandle hWndGetFocus)
WM_KILLFOCUS handler - Updates internal flag and forces button to redraw.
Definition glyphbtn.cpp:582
void EvSetFont(HFONT hFont, bool redraw)
WM_SETFONT Handler. Deletes any cached font and stores a copy of the new one.
Definition glyphbtn.cpp:606
virtual void PaintDefaultRect(TDC &dc, TRect &rect)
Draws a frame around the button if it's a default push button.
Definition glyphbtn.cpp:939
HFONT EvGetFont()
WM_GETFONT handler - Returns font used by control if one was specified earlier.
Definition glyphbtn.cpp:596
int Clear(int t)
Clear flags about the state of the control.
Definition glyphbtn.h:269
void InitVars()
Method used to initialized variables used by GlyphButton's implementation.
Definition glyphbtn.cpp:219
uint EvGetDlgCode(const MSG *msg)
WM_GETDLGCODE handler.
Definition glyphbtn.cpp:619
@ biShowGlyph
Button should draw its glyph.
Definition glyphbtn.h:191
@ biDefault
Button is a 'DefaultPushButton'.
Definition glyphbtn.h:188
@ biPushed
Button is currently depressed.
Definition glyphbtn.h:186
@ biGtUp
Was Set Up Glyph.
Definition glyphbtn.h:193
@ biGtDown
Was Set Down Glyph.
Definition glyphbtn.h:194
@ biFocus
Button has focus.
Definition glyphbtn.h:187
@ biDisabled
Button is disabled.
Definition glyphbtn.h:189
@ biShowText
Button should display its caption.
Definition glyphbtn.h:190
@ biGtDisabled
Was Set Disabled Glyph.
Definition glyphbtn.h:195
void PaintButton(TDC &dc)
Entry point for painting the button to the given device context.
Definition glyphbtn.cpp:891
void EvSysColorChange()
WM_SYSCOLORCHANGE handler – Reloads buttons.
Definition glyphbtn.cpp:748
TGlyphType
Enumeration describing the state when a particular bitmap should be displayed.
Definition glyphbtn.h:120
@ gtDisabled
Bitmap for when button is disabled.
Definition glyphbtn.h:122
@ gtUp
Bitmap for when button is up.
Definition glyphbtn.h:121
@ gtDown
Bitmap for when button is depressed.
Definition glyphbtn.h:123
void EvMouseLeave()
Cancels button Hot state.
Definition glyphbtn.cpp:759
bool EvEraseBkgnd(HDC)
WM_ERASEBKGND handler - Returns true to prevent background from being erased.
Definition glyphbtn.cpp:563
void SetGlyphOrigin(int x, int y)
Sets the upper left corner of glyphs and invalidates window if necessary.
void EvSetFocus(THandle hWndLostFocus)
WM_SETFOCUS handler - Updates internal flag and forces button to redraw.
Definition glyphbtn.cpp:572
void EvLButtonDown(uint modKeys, const TPoint &point)
WM_LBUTTONDOWN handler.
Definition glyphbtn.cpp:632
auto GetWindowClassName() -> TWindowClassName override
Returns name of window class associated with a glyph button control.
Definition glyphbtn.cpp:369
void EvKeyUp(uint key, uint repeatCount, uint flags)
WM_KEYUP handler. Restores state of button and notify parent.
Definition glyphbtn.cpp:710
void ClearCapture()
Releases caption if we are in 'capture' mode.
Definition glyphbtn.cpp:879
void SetGlyph(TBitmap *bitmap, TGlyphType=gtUp, TAutoDelete autoDelete=AutoDelete)
Sets the bitmap to use for the specified button state (glyph type).
Definition glyphbtn.cpp:405
virtual void BuildCelArray(const TBitmap *cell)
Definition glyphbtn.cpp:521
void PaintNow()
Repaints window right away by retrieving a client DC and invoking the 'Paint' method.
TLayoutStyle
Enumeration describing how to position the text and glyph of the button.
Definition glyphbtn.h:140
@ lsH_TSGS
Text Space Glyph Space (Horizontal)
Definition glyphbtn.h:148
@ lsH_GST
Glyph Space Text (Horizontal)
Definition glyphbtn.h:146
@ lsV_STSG
Space Text Space Glyph (Vertical)
Definition glyphbtn.h:153
@ lsV_GST
Glyph Space Text (Vertical)
Definition glyphbtn.h:152
@ lsV_TSGS
Text Space Glyph Space (Vertical)
Definition glyphbtn.h:154
@ lsH_SGST
Space Glyph Space Text (Horizontal)
Definition glyphbtn.h:145
@ lsNone
Use specified coordinates.
Definition glyphbtn.h:141
@ lsV_SGST
Space Glyph Space Text (Vertical)
Definition glyphbtn.h:151
@ lsH_STSG
Space Text Space Glyph (Horizontal)
Definition glyphbtn.h:147
virtual void LayoutTextGlyph(const TRect &faceRect, TRect &textRect, TRect &glyphRect)
Virtual routine invoked to retrieve the placement of text and glyph when drawing the button.
int Set(int t)
Set flags about the state of the control.
Definition glyphbtn.h:278
void InitGlyp(TBtnType type)
Init glip.
Definition glyphbtn.cpp:243
TResult BmSetStyle(TParam1, TParam2)
BM_SETSTYLE handler.
Definition glyphbtn.cpp:826
void EvPaint()
WM_PAINT handler - Invokes 'Paint' method to display glyph and/or text.
Definition glyphbtn.cpp:533
virtual void PaintFocusRect(TDC &dc, const TRect &faceRect)
Displays a focus rectangle.
void EvEnable(bool enabled)
WM_ENABLE handler. Updates internal flags and invalidates control if necessary.
Definition glyphbtn.cpp:724
TResult BmSetState(TParam1, TParam2)
BM_SETSTATE handler.
Definition glyphbtn.cpp:789
void SetupWindow() override
Overriden virtual of TWindow - Updates internal flags based on style of underlying window.
Definition glyphbtn.cpp:379
virtual void PaintFrame(TDC &dc, TRect &rect)
Draws the border of the button.
Definition glyphbtn.cpp:922
TResult BmGetState(TParam1, TParam2)
BM_GETSTATE handler. Returns the current state of the window.
Definition glyphbtn.cpp:769
~TGlyphButton()
Destructor - Cleans up resources used by Glyph Button object.
Definition glyphbtn.cpp:233
bool IsSet(int t) const
Query flags about the state of the control.
Definition glyphbtn.h:287
void SetLayoutStyle(TLayoutStyle style)
Specifies a 'style' describing how text and glyph should be laid out.
void Paint(TDC &, bool erase, TRect &) override
Renders the button in a flicker-free manner.
Definition glyphbtn.cpp:546
void SetTextOrigin(int x, int y)
Sets text coordinates and invalidates window if necessary.
void EvMouseMove(uint modKeys, const TPoint &point)
WM_MOUSEMOVE handler. Updates state of button if it is in 'capture' mode.
Definition glyphbtn.cpp:674
virtual void PaintFace(TDC &dc, const TRect &rect)
Draws the face of the button [i.e. text and glyph portions].
Definition glyphbtn.cpp:964
void GetWindowClass(WNDCLASS &) override
Overriden virtual of TWindow - Fills out information about the Window class associated with a glyph b...
Definition glyphbtn.cpp:350
void EvCancelMode()
WM_CANCELMODE handler.
Definition glyphbtn.cpp:741
TGlyphButton(TWindow *parent, int id, LPCTSTR text, int X, int Y, int W, int H, TBtnType type=btCustom, bool isDefault=false, TModule *module=0)
Constructor of TGlyphButton - Use this constructor to create a GlyphBtn from scratch.
Definition glyphbtn.cpp:165
@ btAdd
'Add' button
Definition glyphbtn.h:87
@ btClose
'Close' button
Definition glyphbtn.h:80
@ btYes
'Yes' button
Definition glyphbtn.h:78
@ btApply
'Apply' button
Definition glyphbtn.h:84
@ btOk
'Ok' button
Definition glyphbtn.h:76
@ btHelp
'Help' button
Definition glyphbtn.h:83
@ btSetup
'Setup' button
Definition glyphbtn.h:91
@ btNo
'No' button
Definition glyphbtn.h:79
@ btDelete
'Delete' button
Definition glyphbtn.h:88
@ btCustom
Custom button.
Definition glyphbtn.h:92
@ btAbort
'Abort' button
Definition glyphbtn.h:81
@ btRevert
'Revert' button
Definition glyphbtn.h:86
@ btBrowse
'Browse' button
Definition glyphbtn.h:85
@ btCancel
'Cancel' button
Definition glyphbtn.h:77
@ btEdit
'Edit' button
Definition glyphbtn.h:89
@ btKey
'Key' button
Definition glyphbtn.h:90
@ btIgnore
'Ignore' button
Definition glyphbtn.h:82
void EvKeyDown(uint key, uint repeatCount, uint flags)
WM_KEYDOWN handler.
Definition glyphbtn.cpp:700
TIcon, derived from TGdiObject, represents the GDI object icon class.
Definition gdiobjec.h:670
A device context (DC) class derived from TCreatedDC, TMemoryDC provides access to a memory DC.
Definition dc.h:784
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
Definition module.h:75
A DC class that wraps begin and end paint calls for use in an WM_PAINT response function.
Definition dc.h:671
PAINTSTRUCT Ps
The paint structure associated with this TPaintDC object.
Definition dc.h:677
TPen is derived from TGdiObject.
Definition gdiobjec.h:138
TPoint is a support class, derived from tagPOINT.
Definition geometry.h:87
TRect is a mathematical class derived from tagRect.
Definition geometry.h:308
The tagSIZE struct is defined as.
Definition geometry.h:234
static TThemeModule & GetInstance()
Returns the module instance.
Definition theme.cpp:91
Encapsulates a themed part.
Definition theme.h:126
Assists in drawing borders of many styles.
Definition uihelper.h:270
@ ButtonDn
Button in down position.
Definition uihelper.h:304
@ ButtonUp
Button in up position.
Definition uihelper.h:303
TUIFace assists in painting UI elements in various states.
Definition uihelper.h:367
TState
Enumeration describing the state of the bitmap to be drawn.
Definition uihelper.h:372
@ Disabled
Disabled or Unavailable state (embossed 3d no color)
Definition uihelper.h:376
@ Normal
Normal state.
Definition uihelper.h:373
void Paint(TDC &dc, const TPoint &dstPt, TState state, bool pressed, bool fillFace=true)
Paint the face of a button onto a DC.
Definition uiface.cpp:431
Type-safe encapsulation of a Windows class name, a union between ATOM and LPCTSTR.
Definition module.h:47
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
Definition window.h:414
HWND GetParentH() const
Return the handle of the parent.
Definition window.h:1999
HWND SetFocus()
Sets the keyboard focus to current window and activates the window that receives the focus by sending...
Definition window.h:2151
HWND SetCapture()
Sets the mouse capture to the current window.
Definition window.h:2121
static HWND GetCapture()
Returns the handle of the window that has captured the mouse.
Definition window.h:2112
tstring GetWindowText() const
String-aware overload.
Definition window.cpp:4415
virtual void GetWindowClass(WNDCLASS &wndClass)
Redefined by derived classes, GetWindowClass fills the supplied MS-Windows registration class structu...
Definition window.cpp:2247
TWindow * GetParent() const
Retrieves the OWL object of the parent window. If none exists, returns 0.
Definition window.h:2013
TWindow * GetParentO() const
Return the OWL's parent for this window.
Definition window.h:2006
static void ReleaseCapture()
Releases the mouse capture from this window.
Definition window.h:2130
TModule * GetModule() const
Returns a pointer to the module object.
Definition window.h:1841
bool TrackMouseEvent(uint flags=TME_HOVER|TME_LEAVE, int hoverTime=HOVER_DEFAULT)
Posts messages when the mouse pointer leaves a window or hovers over a window for a specified amount ...
Definition window.cpp:3357
uint32 GetStyle() const
Gets the style bits of the underlying window or the 'Style' member of the attribute structure associa...
Definition window.cpp:3558
TRect GetClientRect() const
Gets the coordinates of the window's client area (the area in a window you can use for drawing).
Definition window.h:2217
int GetDlgCtrlID() const
Returns the ID of the control.
Definition window.h:3097
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...
Definition window.h:2055
void EvSysColorChange()
Respond to WM_SYSCOLORCHANGE by broadcasting it to all children.
Definition window.cpp:696
HFONT GetWindowFont()
Gets the font the control uses to draw text.
Definition window.h:3489
TResult SendMessage(TMsgId, TParam1=0, TParam2=0) const
Sends a message (msg) to a specified window or windows.
Definition window.cpp:3288
HWND THandle
TWindow encapsulates an HWND.
Definition window.h:418
virtual void Invalidate(bool erase=true)
Invalidates (mark for painting) the entire client area of a window.
Definition window.h:2822
HWND GetHandle() const
Returns the handle of the window.
Definition window.h:2020
int GetWindowTextLength() const
Returns the length, in characters, of the specified window's title.
Definition window.h:2641
Definition of windowing system color classes.
Definition of classes for CommonControl encapsulation.
#define _T(x)
Definition cygwin.h:51
#define DEFINE_RESPONSE_TABLE1(cls, base)
Macro to define a response table for a class with one base.
Definition eventhan.h:492
Definition of abstract GDI object class and derived classes.
Definition of class TGlyphButton.
#define OWL_GLYPHBTN
Definition glyphbtn.h:23
TAutoDelete
Flag for Handle ctors to control Handle deletion in dtor.
Definition gdibase.h:70
@ AutoDelete
Definition gdibase.h:70
@ NoAutoDelete
Definition gdibase.h:70
Object Windows Library (OWLNext Core)
Definition animctrl.h:22
EV_WM_ENABLE
Definition glyphbtn.cpp:317
EV_WM_GETFONT
Definition glyphbtn.cpp:308
const int BUTTONSTATE_PUSHED
Definition glyphbtn.cpp:28
const int FaceToFocusRectDelta
Definition glyphbtn.cpp:27
EV_WM_LBUTTONUP
Definition docking.cpp:2056
EV_WM_MOUSELEAVE
Definition glyphbtn.cpp:323
const int BUTTONSTATE_FOCUS
Definition glyphbtn.cpp:29
const uint32 BUTTONSTYLE_MASK
Definition glyphbtn.cpp:31
EV_WM_CANCELMODE
Definition glyphbtn.cpp:318
EV_WM_LBUTTONDBLCLK
Definition docking.cpp:962
EV_WM_PAINT
Definition control.cpp:28
EV_WM_MOUSEMOVE
Definition docking.cpp:2054
EV_WM_KILLFOCUS
Definition edit.cpp:85
EV_WM_KEYDOWN
Definition edit.cpp:82
const long RopDSPDxax
Definition glyphbtn.cpp:32
unsigned long uint32
Definition number.h:34
LPARAM TParam2
Second parameter type.
Definition dispatch.h:55
EV_WM_SETFONT
Definition glyphbtn.cpp:309
const int BUTTONSTATE_HOT
Definition glyphbtn.cpp:30
auto GetCommCtrlVersion() -> DWORD
Returns the version number of the Common Control library (ComCtl32.dll).
Definition commctrl.cpp:26
WPARAM TParam1
First parameter type.
Definition dispatch.h:54
LRESULT CALLBACK BButtonProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition glyphbtn.cpp:330
OWL_DIAGINFO
Definition animctrl.cpp:14
EV_WM_SETFOCUS
Definition edit.cpp:84
END_RESPONSE_TABLE
Definition button.cpp:26
LRESULT TResult
Result type.
Definition dispatch.h:52
const int LayoutMargin
Definition glyphbtn.cpp:26
std::string tstring
Definition defs.h:79
EV_WM_GETDLGCODE
Definition button.cpp:24
EV_WM_KEYUP
Definition glyphbtn.cpp:316
unsigned int uint
Definition number.h:25
TModule & GetGlobalModule()
Definition global.cpp:48
EV_WM_LBUTTONDOWN
Definition checklst.cpp:195
EV_WM_SYSCOLORCHANGE
Definition gadgetwi.cpp:53
EV_WM_ERASEBKGND
Definition docking.cpp:965
Definition of TSystem, a system information provider class.
Microsoft UxTheme Library Encapsulation.
Definition of the UI Helper Classes: TUIHandle, TUIBorder, TUIFace, TUIPart.
#define EV_MESSAGE(message, method)
Response table entry for raw message handling Uses a dispatcher that just forwards WPARAM and LPARAM.
Definition windowev.h:113