From d07428b8d10ebb331a924b143ed752811aef377c Mon Sep 17 00:00:00 2001
From: dsiders
- GetImageIndexAndEffect uses ThemeServiecs to determine if drawing effects are automatically applied to glyph images, and captures the effect in the AEffect output argument. + GetImageIndexAndEffect uses ThemeServices to determine if drawing effects are automatically applied to glyph images, and captures the effect in the AEffect output argument.
GetImageIndexAndEffect determines the image source and the ordinal position for the image used for the button glyph. ExternalImages and ExternalImageIndex are used (when assigned). The next available source is the resource name specified in LCLGlyphResourceName (when specified). Finally, the Images property is used (when assigned). When the image source has been determined, the correct image resolution for the value in APPI is selected and stored in AImageResolution. ImageIndexes is used to get the position for the image with the specified button State.
@@ -2119,6 +2119,7 @@
+ CMButtonPressed is a method used to handle a CM_BUTTONPRESSED control message received for the control. CMButtonPressed ensures that the Down property is set to False when another speed button with the same GroupIndex is pressed. AllowAllUp is updated and the control is redrawn.
+
+ No actions are performed in the method when the control in Message does not have the same GroupIndex value.
+
@@ -2434,43 +2460,83 @@
+ MouseDown is an overridden method in TCustomSpeedButton. It calls the inherited MouseDown method on entry to signal the OnEditingDone event for the active control on the Parent form. It also updates the DragManager coordinates when a drag operation is already active.
+
+ No additional actions are performed in the method at design-time.
+
+ If the Left mouse button was pressed when the control is Enabled, Down is set to True (when needed) and the Action for the control is unchecked. An internal flag for a pending drag operation in MouseMove is set prior to exiting from the method.
+
+ MouseMove calls the inherited method on entry to update the pointer position for the DragManager (when active) and to signal the OnMouseMove event handler (when assigned).
+
+ No additional actions are performed in the method at design-time.
+
+ if a drag operation has been started in MouseDown, the internal TButtonState for the control is updated to reflect the values in AllowAllUp and Down. When the button state has changed, the control is redrawn.
+
+ PaintBackground is a method used to draw the background for the speed button control on its Canvas. When Transparent is True and the theme element has transparent areas, the value in Color is used to fill the drawing area in PaintRect.
+
+ The DrawElement method in ThemeServices is called to render the drawing area to the Canvas for the control. PaintRect is updated following the drawing operation with the reduced content rectangle (the button surface without borders/edges) needed for the control.
+
+ PaintBackground is called when the MeasureDraw method is used to render the control. The adjusted rectangle is later used in the method to calculate the drawing areas for the glyph bitmap and caption text.
+
+ Called from the MeasureDraw method. The return value can be an enumeration value from either TThemedToolBar or TThemedButton depending on the value in the Flat property.
+
+ When Flat is True, one of the following TThemedToolBar values is returned:
+
+ When Flat is False, one of the following TThemedButton values is returned:
+
+ The property value is updated in the MouseEnter and MouseLeave methods when the mouse pointer enters or leaves the control area. The property value is used in the UpdateState method to determine if the button control is drawn using the "up" or "hot" states. It is used in the GetDrawDetails method to selected the theme element detail needed to draw the control in its current state.
+
- ActionChange is overridden in TCustomSpeedButton to ensure that values from the new action instance in Sender are stored to properties in the control. ActionChange is the routine which implements the OnChange event handler for the ActionLink in the control. It is signalled (from TControl) when a new value is assigned to the Action property, or when the control is loaded using LCL component streaming.
+ ActionChange is overridden in TCustomSpeedButton to ensure that values from the new action instance in Sender are stored to properties in the control. ActionChange is the routine which implements the OnChange event handler for the ActionLink in the control. It is signalled (from TControl) when a new value is assigned to the Action property, or when the control is loaded using LCL component streaming.
Sender is the new action instance for the event, or Nil when the value in Action has been removed (set to Nil).
@@ -2684,8 +2812,7 @@
Loaded is called by the LCL streaming system when a root component was completely read from a stream and all properties and references to other objects have been resolved. Descendents of TComponent should override this method to perform additional processing when all published properties have been set from values obtained from the LCL component stream.
- Application programmers should never call Loaded directly; this
- is done automatically by the LCL streaming system.
+ Application programmers should never call Loaded directly; this is done automatically by the LCL streaming system.
+ GetTextSize is a TSize function used to get the dimensions for the Caption text for the control.
+
+ GetTextSize removes Ampersand (&) characters in Caption prior to calculating the dimensions for the text using the TextStyle for the control Canvas. The value in PaintRect is updated with the calculated dimensions. The X and Y members in the return value contain the width and the height for the text using the Font for the control. Both member values are set to 0 when ShowCaption is False or Caption contains an empty string ('').
+
+ GetTextSize is called from the MeasureDraw method.
+
+ Uses the internal TButtonGlyph instance for the control (when assigned) to access its Draw method. The PixelsPerInch setting in Font and the Canvas scaling factor for the control are used to scale the image.
+
+ The return value is a TRect instance with are needed to draw the glyph image on the the specified canvas. Its member values are set to 0 (zero) when a TButtonGlyph instance has not been assigned by setting a Glyph bitmap for the control.
+
+ Alignment is a TAlignment property with the horizontal alignment for the Caption displayed on the button control. Alignment is used (along with UseRightToLeftReading) in the MeasureDraw method to set the text flags needed to measure / draw the Caption> for the control.
+
+ The default value for the property is taCenter, and causes the Caption to be centered in the text area on the control. Use taLeft to left-align the Caption in the text area. Use taRight to right-align the Caption for the control. Changing the value for the property causes the control to be redrawn.
+
+ Set the value in ShowCaption to True to display the Caption for the control.
+
+ Use the Layout property to control the placement of the image relative to the text value displayed on the control.
+
+ Use the Align property to specify the side on the parent control to which the speed button is aligned, or to specify that custom Anchors are used for positioning and sizing.
+
+ AllowAllUp is a Boolean property which indicates whether all speed buttons with the same GroupIndex value can be in the "up" state. The default value for the property is False, and means that one of the grouped speed buttons must have its Down property set to True when GroupIndex has a non-zero value.
+
+ Changing the value for the property causes a button pressed event to be sent to the Parent control (when assigned) and the Down property is toggled and updated for the new property value.
+
+ Set GroupIndex to a value other than 0 (zero) to use AllowAllUp when a mouse button or an accelerator key is handled for the control.
+
- If the color is clDefault , the result will need to be passed through GetDefaultColor to resolve clDefault to a TColor value. Convenience routines which obtain the color by resolving clDefault and ParentColor are also provided in the GetColorResolvingParent and GetRGBColorResolvingParent methods.
+ If the color is clDefault, the result will need to be passed through GetDefaultColor to resolve clDefault to a TColor value. Convenience routines which obtain the color by resolving clDefault and ParentColor are also provided in the GetColorResolvingParent and GetRGBColorResolvingParent methods.
+ Set Flat to True to draw the control without relief, elevation, or a three-dimensional appearance. The default value for the property is False. Changing the value for the property causes the control to be redrawn.
+
+ Flat is used in the GetDrawDetails method to select the theme element details applied to the control for its current state. When set to False, TThemedButton element details are used. When set to True, TThemedToolBar element details are used. See GetDrawDetails for more information about the values used for specific button states.
+
+ Glyph is a TBitmap property with the image drawn for the button control. Read and write access to the property value are redirected to an internal TButtonGlyph instance for the control. This allows a single image to be specified for Glyph, or multiple bitmaps for various button states using the Images property.
+
+ Changing the value for the property cause the control to be redrawn.
+
- GroupIndex is used with AllowAllUp and Down to determine if the button state can be changed within the related group of controls. The default value for the property is 0 (zero).
+ GroupIndex is used with AllowAllUp and Down to determine if the button state can be changed within the related group of controls. All buttons on the Parent control with the same value in GroupIndex are treated as a single group. The default value for the property is 0 (zero), and indicates that an explicit value has not been assigned for the property.
+
+ Set GroupIndex to a positive non-zero value to enable AllowAllUp checking when a mouse button event or an accelerator key is handled for the control.
Provides an alternate way to specify images (individually) as opposed to multiple adjacent bitmaps in Glyph.
+ Use ImageIndex to specify the ordinal position in Images for the glyph bitmap displayed on the control.
+
+ Use Glyph to access an image in the TButtonGlyph assigned to the control.
+
+ A value of -1 centers the content. If Spacing is -1 too then there is the same space on the left, between the glyph and caption, and on the right.
+
+
+
+
+