Difference between revisions of "ATButton"

From Free Pascal wiki
Jump to navigationJump to search
Line 9: Line 9:
 
* prop Bitmap takes bitmap for button image
 
* prop Bitmap takes bitmap for button image
 
* prop Flat (default False): passive (not under cursor) button don't paint its backgnd and border
 
* prop Flat (default False): passive (not under cursor) button don't paint its backgnd and border
* prop SpecKind: can be set to make button paint as "|", as down-arrow, as "x" cross
+
* prop Kind: button can have several kinds:
 +
** caption
 +
** icon
 +
** icon + caption
 +
** dropdown arrow
 +
** caption + arrow
 +
** separator line
  
 
[[File:atbutton_demo.png]]
 
[[File:atbutton_demo.png]]

Revision as of 09:52, 5 January 2017

About

ATButton is OS-independant button component, flat look. Button as usual has Caption, OnClick.

  • button state can be: usual (default: light gray), mouse-over (light gray), checked (dark gray), disabled (red-gray)
  • buttons have border of 1..n pixels
  • prop Checkable means that click toggles Checked
  • prop Focusable means that button can focus (and paint frame of other color if focused)
  • prop Bitmap takes bitmap for button image
  • prop Flat (default False): passive (not under cursor) button don't paint its backgnd and border
  • prop Kind: button can have several kinds:
    • caption
    • icon
    • icon + caption
    • dropdown arrow
    • caption + arrow
    • separator line

atbutton demo.png

Author: Alexey Torgashin

Theme

Colors/fonts of all buttons defined by global var, of type like this

type
  TATButtonTheme = record
    FontName: string;
    FontSize: integer;
    FontStyles: TFontStyles;
    ColorFont,
    ColorFontDisabled,
    ColorBgPassive,
    ColorBgOver,
    ColorBgChecked,
    ColorBgDisabled,
    ColorArrow,
    ColorBorderPassive,
    ColorBorderOver,
    ColorBorderFocused: TColor;
    MouseoverBorderWidth: integer;
    PressedBorderWidth: integer;
    PressedCaptionShiftY: integer;
    PressedCaptionShiftX: integer;
  end;  
  
var
  ATButtonTheme: TATButtonTheme;

License

MPL 2.0 or LGPL.

Download

Homepage at github is https://github.com/Alexey-T/ATButtons

Requirements

Lazarus: 1.4.0.

Tested on: Win32 (Windows 7), Linux GTK2 or QT (Ubuntu 14.04), macOS (10.8).