OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
buttonga.cpp
Go to the documentation of this file.
1//----------------------------------------------------------------------------
2// ObjectWindows
3// Copyright (c) 1992, 1996 by Borland International, All Rights Reserved
4//
5// Revised by Yura Bidus 11/23/1998
6/// \file
7/// Implementation of class TButtonGadget.
8//----------------------------------------------------------------------------
9#include <owl/pch.h>
10#include <owl/buttonga.h>
11#include <owl/gadgetwi.h>
12#include <owl/celarray.h>
13#include <owl/uihelper.h>
14#include <owl/uimetric.h>
15#include <owl/system.h>
16#include <owl/theme.h>
17
18namespace owl {
19
22
23# if defined(BI_COMP_BORLANDC)
24# pragma warn -inl
25# endif
26
27/// \addtogroup enabler
28/// @{
29//
30/// Command enabler for button gadgets
31//
32/// Derived from TCommandEnabler, TButtonGadgetEnabler serves as a command enabler
33/// for button gadgets. The functions in this class modify the text, check state,
34/// and appearance of a button gadget.
35//
36class /*_OWLCLASS*/ TButtonGadgetEnabler : public TCommandEnabler {
37 public:
38/// Constructs a TButtonGadgetEnabler for the specified gadget. hReceiver is the
39/// window receiving the message.
40 TButtonGadgetEnabler(TWindow::THandle hReceiver, TButtonGadget* g)
41 :
43 Gadget(g)
44 {
45 }
46
47 // Override TCommandEnabler virtuals
48 //
49 void Enable(bool);
50 void SetText(LPCTSTR);
51 void SetCheck(int);
52
53 protected:
54/// The button gadget being enabled or disabled.
55 TButtonGadget* Gadget;
56};
57/// @}
58
59# if defined(BI_COMP_BORLANDC)
60# pragma warn .inl
61# endif
62
63//
64/// Overrides TCommandEnable::Enable. Enables or disables the keyboard, mouse input,
65/// and appearance of the corresponding button gadget.
66//
67void
68TButtonGadgetEnabler::Enable(bool enable)
69{
71 Gadget->SetEnabled(enable);
72}
73
74//
75/// Handle the SetText request for a button gadget. Currently does nothing.
76//
77void
78TButtonGadgetEnabler::SetText(LPCTSTR)
79{
80//# pragma warn -ccc
81//# pragma warn -rch
82// CHECK(true);
83//# pragma warn .rch
84//# pragma warn .ccc
85}
86
87//
88// Set the check-state for the button gadget
89//
90void
91TButtonGadgetEnabler::SetCheck(int state)
92{
94}
95
96//----------------------------------------------------------------------------
97
98//
99/// Construct a button gadget that loads its own bitmap resource
100//
101/// Constructs a TButtonGadget object using the specified bitmap ID, button gadget
102/// ID, and type, with enabled set to false and in a button-up state. The button
103/// isn't enabled - its initial state before command enabling occurs. sharedGlyph
104/// should be set true if the glyph is being held by the window instead of being
105/// loaded from a resource.
106//
108 int id,
109 TType type,
110 bool enabled,
111 TState state,
112 bool sharedGlyph)
113:
114 TGadget(id, ButtonUp),
115 SharingGlyph(sharedGlyph)
116{
117 // If we are sharing the glyph held by our window, then we won't need to load
118 // the resource
119 //
120 if (sharedGlyph) {
121 ResId = 0;
122 GlyphIndex = glyphResIdOrIndex.GetInt();
123 GlyphCount = 1;
124 }
125 else {
126 ResId = glyphResIdOrIndex.IsString() ?
128 GlyphIndex = -1; // Need to get during BuildCelArray
129 GlyphCount = 4;
130 }
131
132 CelArray = nullptr;
133 BitmapOrigin.x = BitmapOrigin.y = 0;
134 Type = type;
135// Repeat = repeat;
136 SetTrackMouse(true);
137 State = state;
138 NotchCorners = true;
139 Pressed = false;
141 SetAntialiasEdges(true);
142
143 TRACEX(OwlGadget, OWL_CDLEVEL, "TButtonGadget constructed @" << (void*)this);
144}
145
146//
147/// Destruct this button gadget, freeing up allocated resources
148//
150{
151 delete CelArray;
152 if (ResId.IsString())
153 delete[] (LPSTR)(LPCTSTR)ResId;
154
155 TRACEX(OwlGadget, OWL_CDLEVEL, "TButtonGadget destructed @" << (void*)this);
156}
157
158//
159/// Initiate a command enable for this button gadget
160//
161/// Enables the button gadget to capture messages. Calls SendMessage to send a
162/// WM_COMMAND_ENABLE message to the gadget window's parent, passing a
163/// TCommandEnable: EvCommandEnable message for this button.
164//
165void
167{
168 PRECONDITION(Window);
169
170 // Must send, not post here, since a ptr to a temp is passed
171 //
172 // This might be called during idle processing before the
173 // HWND has created. Therefore, confirm handle exists.
174 //
175 if (GetGadgetWindow()->GetHandle()) {
176 TButtonGadgetEnabler ge(*GetGadgetWindow(), this);
178 }
179}
180
181//
182/// SysColorChange responds to an EvSysColorChange message forwarded by the owning
183/// TGadgetWindow by setting the dither brush to zero. If a user-interface bitmap
184/// exists, SysColorchange deletes and rebuilds it to get the new button colors.
185//
186void
188{
190 delete CelArray;
191 CelArray = 0;
193}
194
195//
196/// Perform an exclusive checking of this gadget by unchecking the neighboring
197/// exclusive button gadgets
198//
199void
201{
202 PRECONDITION(Window);
203#if defined(BI_COMP_GNUC)
204 TState state = State;
205 if (state != Down) {
206#else
207 if (static_cast<TState>(State) != Down) {
208#endif
209 if (GetGadgetWindow()) {
210 TButtonGadget* first = 0;
211 TButtonGadget* last = this;
212
213 // Look for the start of the group in which this button is located
214 //
215 for (TGadget* g = GetGadgetWindow()->FirstGadget(); g && g != this;
216 g = GetGadgetWindow()->NextGadget(*g)) {
217
219
220 if (!bg || (bg->Type != Exclusive && bg->Type != SemiExclusive))
221 first = nullptr;
222 else if (!first)
223 first = bg;
224 }
225
226 if (!first)
227 first = this;
228
229 // Look for the end of the group in which this button is located
230 //
231 while (GetGadgetWindow()->NextGadget(*last)) {
233
234 if (!bg || (bg->Type != Exclusive && bg->Type != SemiExclusive))
235 break;
236 else
237 last = bg;
238 }
239
240 // Walk all the gadget between first and last (inclusive) and pop them up
241 // if they are down
242 //
243 while (true) {
244#if defined(BI_COMP_GNUC)
245 TState state = first->State;
246 if (state == Down) {
247#else
248 if (first->State == Down) {
249#endif
250 first->State = Up;
251 first->Invalidate();
252 first->Update();
253 }
254
255 if (first == last) // All done
256 break;
257
258 first = TYPESAFE_DOWNCAST(first->NextGadget(), TButtonGadget);
259 }
260 }
261
262 State = Down;
263 }
264}
265
266//
267/// Set the state of a button. Handles setting down on an exclusive button to
268/// pop out the neighbors
269//
270void
272{
273#if defined(BI_COMP_GNUC)
274 TState state = State;
275 if (newState != state) {
276#else
277 if (newState != static_cast<TState>(State)) {
278#endif
279 if ((Type == Exclusive || Type == SemiExclusive) && newState == Down)
281 else
282 State = newState;
283 Invalidate();
284 Update();
285 }
286}
287
288//
289/// Gets the size of the bitmap, calls TGadget::SetBounds to set the boundary of the
290/// rectangle, and centers the bitmap within the button's rectangle.
291//
292void
294{
296 TRACEX(OwlGadget, 1, _T("TButtonGadget::SetBounds() enter @") << this <<
297 _T(" bounds ") << bounds);
298
300
301 // Center the glyph within the inner bounds
302 //
305
306 TSize bitmapSize = CelArray ? CelArray->CelSize() : GetGadgetWindow()->GetCelArray().CelSize();
307 BitmapOrigin.x = innerRect.left + (innerRect.Width() - bitmapSize.cx) / 2;
308 BitmapOrigin.y = innerRect.top + (innerRect.Height() - bitmapSize.cy) / 2;
309 TRACEX(OwlGadget, 1, _T("TButtonGadget::SetBounds() leave @") << this <<
310 _T(" bounds ") << bounds);
311}
312
313//
314/// Find out how big this button gadget wants to be. Calculated using the base
315/// size to get the borders, etc. plus the glyph size.
316//
317/// Stores the width and height (measured in pixels) of the button gadget in size.
318/// Calls TGadget::GetDesiredSize to calculate the relationship between one
319/// rectangle and another.
320//
321void
323{
325 TRACEX(OwlGadget, 1, _T("TButtonGadget::GetDesiredSize() enter @") << this <<
326 _T(" size ") << size);
327
329
330 // Build our CelArray or CelArray entry if not done already
331 //
332 if (!CelArray && GlyphIndex < 0)
334
335 size += CelArray ? CelArray->CelSize() : GetGadgetWindow()->GetCelArray().CelSize();
336 TRACEX(OwlGadget, 1, _T("TButtonGadget::GetDesiredSize() leave @") << this <<
337 _T(" size ") << size);
338}
339
340
341//
342/// Virtual function responsible for supplying the dib for the glyph. Can be
343/// overriden to get dib from elsewhere, cache it, map colors differently, etc.
344//
345/// Returns 0 if no resource was specified for this button
346//
347TDib*
349{
351
352 if (ResId) {
353 TDib* glyph = new TDib(*GetGadgetWindow()->GetModule(), ResId);
356 return glyph;
357 }
358 return 0;
359}
360
361//
362/// Virtual function responsible for releasing glyph dib as needed based on how
363/// GetGlyphDib() got it (if different from new/delete).
364//
365void
370
371//
372/// Build the CelArray member using the resource bitmap as the base glyph
373/// CelArray may contain an existing cel array that should be deleted if
374/// replaced.
375//
376/// The CelArray and glyph painting can work in one of the following ways:
377/// - 1. ResId ctor is used, ...., glyph states are cached in this CelArray
378/// - 2. ResId ctor is used, CelArray holds single glyph and paints state on
379/// the fly
380/// - 3. ResId ctor is used, glyph is added to Window's CelArray and paints
381/// state on the fly
382/// - 4. glyphIndex ctor is used, uses Window's CelArray glyph and paints state
383/// on the fly
384///
385void
387{
388 //PRECONDITION(GetGadgetWindow());
389
391
392 // Case 4, no resource of our own--using a cel in our Window's CelArray
393 //
394 if (!glyph)
395 return;
396
397 // Case 3, add (or replace old) our glyph to our Window's CelArray
398 //
399
400 bool case2 = true;
401 if (SharingGlyph)
402 {
403 CHECK(Window);
404 TSize glyphSize(glyph->Width(), glyph->Height());
405 TCelArray& celArray = GetGadgetWindow()->GetCelArray(glyph->Width(), glyph->Height());
406
407 if (glyphSize == TSize(celArray.CelSize().cx,celArray.CelSize().cy*celArray.NumRows()))
408 {
409 case2 = false;
410 if (GlyphIndex >= 0)
411 celArray.Replace(GlyphIndex, *glyph);
412 else
413 GlyphIndex = celArray.Add(*glyph);
414 }
415 }
416
417 if (case2)
418 {
419 // Case 2, build a CelArray containing only the normal glyph state
420 //
421 delete CelArray;
422 CelArray = new TCelArray(*glyph, 1);
423 GlyphIndex = 0;
424 SharingGlyph = false;
425 }
426
428
429 // Case 1, for compatibility for now...
430 //
431}
432
433//
434//
435//
436void
438{
439 if(SharingGlyph)
440 GlyphIndex = index;
441}
442
443//
444/// Perform all of the painting for this button gadget
445//
446/// Gets the width and height of the window frame (in pixels), calls GetImageSize to
447/// retrieve the size of the bitmap, and sets the inner rectangle to the specified
448/// dimensions. Calls TGadget::PaintBorder to perform the actual painting of the
449/// border of the control. Before painting the control, Paint determines whether the
450/// corners of the control are notched, and then calls GetSysColor to see if
451/// highlighting or shadow colors are used. Paint assumes the border style is plain.
452/// Then, Paint draws the top, left, right, and bottom of the control, adjusts the
453/// position of the bitmap, and finishes drawing the control using the specified
454/// embossing, fading, and dithering.
455//
456void
458{
459 PRECONDITION(Window);
460
461 PaintBorder(dc);
462
463 // Get the inner rect to use as the button face
464 //
467
468 PaintFace(dc, faceRect);
469}
470
471void
473{
474 // Paint the button frame depending on the active styles.
475 //
477 if (flat)
478 {
479 // Calculate state and border/background style.
480 //
481 bool ok = GetEnabled();
482 bool down = ok && (Pressed || State == Down);
483 bool hover = ok && (IsHaveMouse() || GetGadgetWindow()->GadgetGetCaptured() == this);
485
486 bool xpstyle = GetGadgetWindow()->IsThemed();
487 if (xpstyle)
488 {
489 // Draw themed background. This ignores all our border styles.
490 //
491 int state = down ? TS_PRESSED : hover ? TS_HOT : 0;
492 TThemePart part(GetGadgetWindow()->GetHandle(), static_cast<LPCWSTR>(L"TOOLBAR"), TP_BUTTON, state);
493 TRect rect(0, 0, GetBounds().Width(), GetBounds().Height());
494 part.DrawBackground(dc, rect);
495 }
496 else
497 {
498 // Themes are not available. Draw old flat style.
499 //
501 }
502 }
503 else // !flat
504 {
505 ChangeBorderStyle((Pressed || State == Down) ? ButtonDn : ButtonUp);
507 }
508}
509
510//
511/// Paints the face of the button.
512//
513void
515{
516 // Determine which CelArray to paint from: ours or our Window's
517 //
518 TCelArray& celArray = CelArray ? *CelArray : GetGadgetWindow()->GetCelArray();
519
520 // set Current Row if enabled style FlatGrayButtons
522 if(IsHaveMouse())
523 celArray.SetCurRow(0);// normal
524 else if(celArray.NumRows()>1)
525 celArray.SetCurRow(1); // set gray row
526 }
527
528 // Calc the source rect from the celarray. The dest point of the glyph is
529 // relative to the face rect.
530 //
531 TRect srcRect(celArray.CelRect(GlyphIndex));
532 TPoint dstPt(BitmapOrigin - rect.TopLeft());
533
534 // Create a UI Face object for this button & let it paint the button face
535 //
539 bool pressed = false;
540 if (GetEnabled()) switch (State)
541 {
542 case Indeterminate:
543 state = TUIFace::Indeterm;
544 pressed = Pressed;
545 break;
546
547 case Down:
548 if (flat)
549 {
550 bool hover = !IsHaveMouse() && GetGadgetWindow()->GadgetGetCaptured() != this;
552 pressed = hover ? true : Pressed;
553 }
554 else
555 {
556 state = Pressed ? TUIFace::Down : TUIFace::Normal;
557 pressed = Pressed;
558 }
559 break;
560
561 default:
562 state = TUIFace::Normal;
563 pressed = Pressed;
564 }
565 face.Paint(dc, srcRect, dstPt, state, pressed, false); // no fill (transparent)
566}
567
568//
569/// Begin button pressed state, repaint & enter menuselect state
570//
571/// When the mouse button is pressed, BeginPressed sets Pressed to true, paints the
572/// pressed button, and sends menu messages to the gadget window's parent.
573void
575{
576 Pressed = true;
577 SetInMouse(true);
578 Invalidate();
579 Update();
580 if (GetGadgetWindow()->GetHintMode() == TGadgetWindow::PressHints)
582}
583
584//
585/// Cancel pressed state, repaint & end menuselect state
586//
587/// When the mouse button is released, CancelPressed sets Pressed to false, paints
588/// the button, and sends menu messages to the gadget window's parent. Sets InMouse
589/// to mstate.
590//
591void
593{
594 Pressed = false;
596 Invalidate(true);
597 Update();
598 if (GetGadgetWindow()->GetHintMode() == TGadgetWindow::PressHints)
600}
601
602//
603/// The action method called on a completed 'click', generates WM_COMMAND
604//
605/// Invoked by mouse-up event inside the Gadget. Sets member data "Pressed"
606/// to false, changes state for attribute buttons, and paints the button
607/// in its current state.
608//
609/// Command buttons just send the command
610/// Exclusive buttons check themselves and uncheck neighbors.
611/// NonExclusive buttons toggle their check state.
612/// SemiExclusive uncheck neighbors on press, but can also be unpressed.
613//
614/// Invoked when the mouse is in the "up" state, Activate sets Pressed to false,
615/// changes the state for attribute buttons, and paints the button in its current
616/// state. To do this, it calls CancelPressed(), posts a WM_COMMAND message to the
617/// gadget window's parent, and sends menu messages to the gadget window's parent.
618//
619void
621{
622#if defined(BI_COMP_GNUC)
623 TState state = State;
624 TType type = Type;
625#endif
626
627 switch (Type) {
628 case Exclusive:
629#if defined(BI_COMP_GNUC)
630 if (state != Down)
631#else
632 if (static_cast<TState>(State) != Down)
633#endif
635 break;
636
637 case NonExclusive:
638#if defined(BI_COMP_GNUC)
639 State = state == Up ? Down : Up;
640#else
641 State = State == Up ? Down : Up;
642#endif
643 break;
644
645 case SemiExclusive:
646#if defined(BI_COMP_GNUC)
647 if (state != Down)
648#else
649 if (static_cast<TState>(State) != Down)
650#endif
652 else
653 State = Up;
654 break;
655 default:
656 case Command:
657 case RepeatCmd:
658 break;
659 }
660
661 // Unpress the button
662 //
663 CancelPressed(pt, true);
664
665
666 // Send the associated command for all enabled buttons except for exclusive
667 // buttons that are being poped up
668 //
669#if defined(BI_COMP_GNUC)
670 if (!((type == Exclusive || type == SemiExclusive) && state != Down) &&
671#else
672 if (!((Type == Exclusive || Type == SemiExclusive) && static_cast<TState>(State) != Down) &&
673#endif
674 GetEnabled())
675 GetGadgetWindow()->PostMessage(WM_COMMAND, GetId());
676}
677
678//
679/// Overrides TGadget member function and responds to a left mouse button click by
680/// calling BeginPressed.
681//
682void
688
689//
690/// Mouse has entered this button, (not pressed). Show hints if that style
691/// is enabled
692//
693/// Called when the mouse enters the boundary of the button gadget. modKeys
694/// indicates the virtual key information and can be any combination of the
695/// following values: MK_CONTROL, MK_LBUTTON, MK_MBUTTON, MK_RBUTTON, or MK_SHIFT.
696/// p indicates where the mouse entered the button gadget.
697//
698void
705
706//
707/// Mouse has moved (back) into this gadget. Push or pull the button up & down
708/// as needed.
709//
710/// Calls TGadget::MouseMove in response to the mouse being dragged. If the mouse
711/// moves off the button, MouseMove calls CancelPressed(). If the mouse moves back
712/// onto the button, MouseMove calls BeginPressed().
713///
714void
716{
718
719 bool hit = PtIn(pt);
720 if (Pressed) {
721 if (!hit)
722 CancelPressed(pt, false);
723 }
724 else if (hit)
726}
727
728//
729/// Mouse has left this button, (not pressed). Hide hints if that style
730/// is enabled
731//
732/// Called when the mouse leaves the boundary of the button gadget. modKeys
733/// indicates the virtual key information and can be any combination of the
734/// following values: MK_CONTROL, MK_LBUTTON, MK_MBUTTON, MK_RBUTTON, or MK_SHIFT.
735/// p indicates the place where the mouse left the button gadget.
736//
737void
744
745//
746/// Handle the mouse left button up & leave the pressed state. If the mouse is
747/// still on this button, i.e. it is still pressed, then perform the button
748/// action.
749//
750/// Overrides TGadget member functions and responds to a release of the left mouse
751/// button by calling Activate.
752//
753void
755{
757 if (Pressed)
758 Activate(pt);
759 else if(GetGadgetWindow()->GetFlatStyle()&TGadgetWindow::FlatStandard)
760 Invalidate();
761}
762
763} // OWL namespace
764
765//==============================================================================
766
Definition of class TButtonGadget.
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
Derived from TGadget, TButtonGadget represent buttons that you can click on or off.
Definition buttonga.h:65
TState
TState enumerates the three button positions during which the button can be pressed: up (0),...
Definition buttonga.h:80
@ Down
Button is down, i.e. checked.
Definition buttonga.h:82
@ Up
Current state of this button.
Definition buttonga.h:81
@ Indeterminate
Button is neither checked nor unchecked.
Definition buttonga.h:83
~TButtonGadget() override
Destruct this button gadget, freeing up allocated resources.
Definition buttonga.cpp:149
virtual void ReleaseGlyphDib(TDib *glyph)
Virtual function responsible for releasing glyph dib as needed based on how GetGlyphDib() got it (if ...
Definition buttonga.cpp:366
TType
Enumerates the types of button gadgets.
Definition buttonga.h:69
@ NonExclusive
Toggles its state when pressed and ignores other buttons.
Definition buttonga.h:72
@ SemiExclusive
Same as exclusive, except that it also pops back up if pressed while it is down.
Definition buttonga.h:73
@ Exclusive
Stays down when pressed and causes other buttons in the group to pop back up.
Definition buttonga.h:71
@ Command
Basic type of this button.
Definition buttonga.h:70
@ RepeatCmd
Auto-repeating command button.
Definition buttonga.h:74
virtual void BuildCelArray()
Build the CelArray member using the resource bitmap as the base glyph CelArray may contain an existin...
Definition buttonga.cpp:386
void MouseEnter(uint modKeys, const TPoint &p) override
Mouse has entered this button, (not pressed).
Definition buttonga.cpp:699
virtual void Activate(const TPoint &p)
The action method called on a completed 'click', generates WM_COMMAND.
Definition buttonga.cpp:620
void Paint(TDC &dc) override
Perform all of the painting for this button gadget.
Definition buttonga.cpp:457
void LButtonUp(uint modKeys, const TPoint &p) override
Handle the mouse left button up & leave the pressed state.
Definition buttonga.cpp:754
void CommandEnable() override
Initiate a command enable for this button gadget.
Definition buttonga.cpp:166
void MouseMove(uint modKeys, const TPoint &p) override
Mouse has moved (back) into this gadget.
Definition buttonga.cpp:715
void PaintBorder(TDC &dc) override
Definition buttonga.cpp:472
void GetDesiredSize(TSize &size) override
Find out how big this button gadget wants to be.
Definition buttonga.cpp:322
void SysColorChange() override
SysColorChange responds to an EvSysColorChange message forwarded by the owning TGadgetWindow by setti...
Definition buttonga.cpp:187
void SetBounds(const TRect &r) override
Gets the size of the bitmap, calls TGadget::SetBounds to set the boundary of the rectangle,...
Definition buttonga.cpp:293
TButtonGadget(TResId glyphResIdOrIndex, int id, TType type=Command, bool enabled=false, TState state=Up, bool sharedGlyph=false)
Construct a button gadget that loads its own bitmap resource.
Definition buttonga.cpp:107
virtual void CancelPressed(const TPoint &p, bool mstate=false)
Cancel pressed state, repaint & end menuselect state.
Definition buttonga.cpp:592
void SetGlyphIndex(int index)
Definition buttonga.cpp:437
virtual void PaintFace(TDC &dc, const TRect &rect)
Paints the face of the button.
Definition buttonga.cpp:514
void MouseLeave(uint modKeys, const TPoint &p) override
Mouse has left this button, (not pressed).
Definition buttonga.cpp:738
void CheckExclusively()
Perform an exclusive checking of this gadget by unchecking the neighboring exclusive button gadgets.
Definition buttonga.cpp:200
virtual TDib * GetGlyphDib()
Virtual function responsible for supplying the dib for the glyph.
Definition buttonga.cpp:348
void LButtonDown(uint modKeys, const TPoint &p) override
Overrides TGadget member function and responds to a left mouse button click by calling BeginPressed.
Definition buttonga.cpp:683
void SetButtonState(TState newState)
Set the state of a button.
Definition buttonga.cpp:271
virtual void BeginPressed(const TPoint &p)
Begin button pressed state, repaint & enter menuselect state.
Definition buttonga.cpp:574
void SetAntialiasEdges(bool anti=true)
Turns the antialiasing of the button bevels on or off.
Definition buttonga.h:292
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
static const TColor Sys3dFace
The symbolic system color value for the face color of 3-dimensional display elements.
Definition color.h:339
uint GetId() const
Retrieves the id of the command.
Definition window.h:1695
virtual void Enable(bool enable=true)
Enables or disables the command sender.
Definition window.cpp:301
TCommandEnabler(uint id, HWND hWndReceiver=0)
Constructs the TCommandEnabler object with the specified command ID.
Definition window.cpp:288
TDC is the root class for GDI DC wrappers.
Definition dc.h:64
Pseudo-GDI object Device Independent Bitmap (DIB) class.
Definition gdiobjec.h:795
@ MapHighlight
Definition gdiobjec.h:913
TGadget is the base class for the following derived gadget classes:
Definition gadget.h:120
bool IsHaveMouse() const
Return true if mouse inside gadget.
Definition gadget.h:485
TRect & GetBounds()
Returns the boundary rectangle for the gadget.
Definition gadget.h:440
virtual void LButtonDown(uint modKeys, const TPoint &point)
Captures the mouse if TrackMouse is set.
Definition gadget.cpp:608
virtual void MouseMove(uint modKeys, const TPoint &point)
Mouse is moving over this gadget.
Definition gadget.cpp:557
virtual void MouseEnter(uint modKeys, const TPoint &point)
Mouse is entering this gadget.
Definition gadget.cpp:542
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 void MouseLeave(uint modKeys, const TPoint &point)
Mouse is leaving this gadget.
Definition gadget.cpp:566
virtual bool PtIn(const TPoint &point)
Default behavior returns true if the point is within the receiver's bounding rect.
Definition gadget.cpp:289
void SetInMouse(bool state)
Sets if mouse inside gadget or not.
Definition gadget.h:491
void ChangeBorderStyle(TBorderStyle bs)
Simply changes the border style without recalculating the gadget size.
Definition gadget.h:562
TGadgetWindow * GetGadgetWindow()
Return a pointer to the owning or parent window for the gadget.
Definition gadget.h:536
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
bool GetEnabled() const
Determines whether keyboard and mouse input have been enabled for the specified gadget.
Definition gadget.h:458
virtual void SysColorChange()
Called when the system colors have been changed so that gadgets can rebuild and repaint,...
Definition gadget.cpp:141
void SetTrackMouse(bool track)
Definition gadget.h:501
@ Recessed
Recessed into the window.
Definition gadget.h:131
@ None
No border painted at all.
Definition gadget.h:128
@ ButtonUp
Button in up position.
Definition gadget.h:134
@ 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
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
TGadget * NextGadget()
Returns the next gadget in the list of gadgets.
Definition gadget.h:530
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
int GetId() const
Gets the ID for the gadget.
Definition gadget.h:406
TGadget * NextGadget(TGadget &gadget) const
Returns the next gadget in the list relative to a given gadget.
Definition gadgetwi.h:407
TGadget * GadgetGetCaptured()
Retrieves gadget with capture.
Definition gadgetwi.h:476
void SetHintCommand(int id)
(id <= 0) to clear
Definition gadgetwi.cpp:299
static uint GetFlatStyle()
Returns the flat style.
Definition gadgetwi.h:459
@ FlatGrayButtons
Adds Gray buttons effect to FlatStandard.
Definition gadgetwi.h:195
@ FlatStandard
Flat style IE 3.0 - base style.
Definition gadgetwi.h:194
virtual TCelArray & GetCelArray(int minX=0, int minY=0)
Gets the Shared CelArray for this gadget window.
bool IsThemed() const
Definition gadgetwi.cpp:505
@ EnterHints
Hints when the mouse passes over a gadget.
Definition gadgetwi.h:185
@ PressHints
Hints when a button is pressed.
Definition gadgetwi.h:184
TPoint is a support class, derived from tagPOINT.
Definition geometry.h:87
TRect is a mathematical class derived from tagRect.
Definition geometry.h:308
bool IsString() const
Returns true if this resource identifier encodes a string pointer.
Definition wsyscls.h:86
The tagSIZE struct is defined as.
Definition geometry.h:234
Encapsulates a themed part.
Definition theme.h:126
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
@ Indeterm
Indeterminant, or mixed-value state.
Definition uihelper.h:375
@ Down
Down or Option set state (hilit background, +1,+1)
Definition uihelper.h:374
@ Normal
Normal state.
Definition uihelper.h:373
TResult HandleMessage(TMsgId, TParam1=0, TParam2=0)
Dispatches the given message using the response table.
Definition window.cpp:1392
HWND THandle
TWindow encapsulates an HWND.
Definition window.h:418
#define _T(x)
Definition cygwin.h:51
#define WM_COMMAND_ENABLE
Definition dispatch.h:4103
Definition of TGadgetList, TGadgetWindow & TGadgetWindowFont A list holding gadgets,...
char * strnewdup(const char *s, size_t minAllocSize=0)
Definition memory.cpp:25
Object Windows Library (OWLNext Core)
Definition animctrl.h:22
LPARAM TParam2
Second parameter type.
Definition dispatch.h:55
OWL_DIAGINFO
Definition animctrl.cpp:14
unsigned int uint
Definition number.h:25
#define OWL_CDLEVEL
Definition defs.h:171
#define TYPESAFE_DOWNCAST(object, toClass)
Definition defs.h:269
Definition of TSystem, a system information provider class.
Microsoft UxTheme Library Encapsulation.
Definition of the UI Helper Classes: TUIHandle, TUIBorder, TUIFace, TUIPart.
Definition of TUIMetric, a UI metrics provider class.