{ fpGUI - Free Pascal GUI Toolkit Copyright (C) 2006 - 2014 See the file AUTHORS.txt, included in this distribution, for details of the copyright. See the file COPYING.modifiedLGPL, included in this distribution, for details about redistributing fpGUI. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Description: This unit implements a Windows 8 (I think) look-alike style Author: Graeme Geldenhuys } unit fpg_style_win8; {$mode objfpc}{$H+} { *********************************************************** ********** This is still under development! *********** *********************************************************** It needs lots of testing and debugging. } interface uses Classes, fpg_main, fpg_base; type TfpgWin8Style = class(TfpgStyle) private FImages: TfpgImages; procedure LoadThemeImages; public constructor Create; override; destructor Destroy; override; { General } procedure DrawControlFrame(ACanvas: TfpgCanvas; x, y, w, h: TfpgCoord); override; overload; function GetControlFrameBorders: TRect; override; { Buttons } procedure DrawButtonFace(ACanvas: TfpgCanvas; x, y, w, h: TfpgCoord; AFlags: TfpgButtonFlags); override; overload; function GetButtonBorders: TRect; override; { Combobox } procedure DrawStaticComboBox(ACanvas: TfpgCanvas; r: TfpgRect; const IsEnabled: Boolean; const IsFocused: Boolean; const IsReadOnly: Boolean; const ABackgroundColor: TfpgColor; const AInternalBtnRect: TfpgRect; const ABtnPressed: Boolean); override; { Checkbox } procedure DrawCheckbox(ACanvas: TfpgCanvas; x, y: TfpgCoord; ix, iy: TfpgCoord); override; end; implementation uses fpg_stylemanager ; const Win8BaseColors: array [0..16] of TfpgColor = ( $FFF0F0F0, $FF606060, $FFABADB3, $FF202020, $FF474747, $FFC0C0C0, $FF3399FF, $FF3399FF, $FFFFFFFF, $FF2D2D2D, $FF494949, $FF24617A, $FF353535, $FF434343, $FF313131, $FF27546A, $FFE5E5E5); {%region 'Byte arrays of images' -fold} const win8_checkboxes: array[0..2601] of byte = ( 66, 77, 42, 10, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0, 0, 65, 0, 0, 0, 13, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0, 244, 9, 0, 0,196, 14, 0, 0,196, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,112,112,112,112,112,112,112,112,112,112,112,112,112,112, 112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112, 112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112, 112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112, 112,112,112,112,112,112,112,112,112,112,112,112,112,188,188,188,188, 188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188, 188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188, 188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188, 188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188, 188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188, 188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188, 188,188,188,188,188,188,188,188,188,188,188, 0,112,112,112,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,112,112,112, 112,112,112,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,112,112,112,188,188,188,230,230,230,230,230,230,230,230,230, 230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230, 230,230,230,230,230,230,230,188,188,188,188,188,188,230,230,230,230, 230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230, 230,230,230,230,230,230,230,230,230,230,230,230,188,188,188,188,188, 188,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230, 230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230, 188,188,188, 0,112,112,112,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,112,112,112,112,112,112,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,207,207,207,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,112,112,112,188,188,188, 230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230, 230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,188, 188,188,188,188,188,230,230,230,230,230,230,230,230,230,230,230,230, 230,230,230,208,208,208,230,230,230,230,230,230,230,230,230,230,230, 230,230,230,230,188,188,188,188,188,188,230,230,230,230,230,230,230, 230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230, 230,230,230,230,230,230,230,230,230,188,188,188, 0,112,112,112,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,112,112, 112,112,112,112,255,255,255,255,255,255,255,255,255,255,255,255, 95, 95, 95, 0, 0, 0,207,207,207,255,255,255,255,255,255,255,255,255, 255,255,255,112,112,112,188,188,188,230,230,230,230,230,230,230,230, 230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230, 230,230,230,230,230,230,230,230,188,188,188,188,188,188,230,230,230, 230,230,230,230,230,230,230,230,230,156,156,156,112,112,112,208,208, 208,230,230,230,230,230,230,230,230,230,230,230,230,188,188,188,188, 188,188,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230, 230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230, 230,188,188,188, 0,112,112,112,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,112,112,112,112,112,112,255,255,255,255, 255,255,239,239,239, 63, 63, 63, 0, 0, 0, 0, 0, 0, 47, 47, 47, 255,255,255,255,255,255,255,255,255,255,255,255,112,112,112,188,188, 188,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230, 230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230, 188,188,188,188,188,188,230,230,230,230,230,230,223,223,223,141,141, 141,112,112,112,112,112,112,134,134,134,230,230,230,230,230,230,230, 230,230,230,230,230,188,188,188,188,188,188,230,230,230,230,230,230, 230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230, 230,230,230,230,230,230,230,230,230,230,188,188,188, 0,112,112,112, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,112, 112,112,112,112,112,255,255,255,239,239,239, 47, 47, 47, 0, 0, 0, 0, 0, 0, 15, 15, 15, 0, 0, 0,127,127,127,255,255,255,255,255, 255,255,255,255,112,112,112,188,188,188,230,230,230,230,230,230,230, 230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230, 230,230,230,230,230,230,230,230,230,188,188,188,188,188,188,230,230, 230,223,223,223,134,134,134,112,112,112,112,112,112,119,119,119,112, 112,112,171,171,171,230,230,230,230,230,230,230,230,230,188,188,188, 188,188,188,230,230,230,230,230,230,230,230,230,230,230,230,230,230, 230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230, 230,230,188,188,188, 0,112,112,112,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,112,112,112,112,112,112,255,255,255, 159,159,159, 0, 0, 0, 15, 15, 15,207,207,207,175,175,175, 0, 0, 0, 0, 0, 0,207,207,207,255,255,255,255,255,255,112,112,112,188, 188,188,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230, 230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230, 230,188,188,188,188,188,188,230,230,230,186,186,186,112,112,112,119, 119,119,208,208,208,193,193,193,112,112,112,112,112,112,208,208,208, 230,230,230,230,230,230,188,188,188,188,188,188,230,230,230,230,230, 230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230, 230,230,230,230,230,230,230,230,230,230,230,188,188,188, 0,112,112, 112,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 112,112,112,112,112,112,255,255,255,255,255,255,127,127,127,207,207, 207,255,255,255,255,255,255, 79, 79, 79, 0, 0, 0, 47, 47, 47,255, 255,255,255,255,255,112,112,112,188,188,188,230,230,230,230,230,230, 230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230, 230,230,230,230,230,230,230,230,230,230,188,188,188,188,188,188,230, 230,230,230,230,230,171,171,171,208,208,208,230,230,230,230,230,230, 149,149,149,112,112,112,134,134,134,230,230,230,230,230,230,188,188, 188,188,188,188,230,230,230,230,230,230,230,230,230,230,230,230,230, 230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230, 230,230,230,188,188,188, 0,112,112,112,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,112,112,112,112,112,112,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,239, 239,239, 15, 15, 15, 0, 0, 0,127,127,127,255,255,255,112,112,112, 188,188,188,230,230,230,230,230,230,230,230,230,230,230,230,230,230, 230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230, 230,230,188,188,188,188,188,188,230,230,230,230,230,230,230,230,230, 230,230,230,230,230,230,230,230,230,223,223,223,119,119,119,112,112, 112,171,171,171,230,230,230,188,188,188,188,188,188,230,230,230,230, 230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230, 230,230,230,230,230,230,230,230,230,230,230,230,188,188,188, 0,112, 112,112,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,112,112,112,112,112,112,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,175,175,175, 0, 0, 0, 15, 15, 15,255,255,255,112,112,112,188,188,188,230,230,230,230,230, 230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230, 230,230,230,230,230,230,230,230,230,230,230,188,188,188,188,188,188, 230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230, 230,230,230,230,193,193,193,112,112,112,119,119,119,230,230,230,188, 188,188,188,188,188,230,230,230,230,230,230,230,230,230,230,230,230, 230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230, 230,230,230,230,188,188,188, 0,112,112,112,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,112,112,112,112,112,112,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,127,127,127,223,223,223,255,255,255,112,112, 112,188,188,188,230,230,230,230,230,230,230,230,230,230,230,230,230, 230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230, 230,230,230,188,188,188,188,188,188,230,230,230,230,230,230,230,230, 230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,171, 171,171,215,215,215,230,230,230,188,188,188,188,188,188,230,230,230, 230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230, 230,230,230,230,230,230,230,230,230,230,230,230,230,188,188,188, 0, 112,112,112,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,112,112,112,112,112,112,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,112,112,112,188,188,188,230,230,230,230, 230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230, 230,230,230,230,230,230,230,230,230,230,230,230,188,188,188,188,188, 188,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230, 230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230, 188,188,188,188,188,188,230,230,230,230,230,230,230,230,230,230,230, 230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230, 230,230,230,230,230,188,188,188, 0,112,112,112,112,112,112,112,112, 112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112, 112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112, 112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112, 112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112, 112,112,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188, 188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188, 188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188, 188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188, 188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188, 188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188, 188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188,188, 0); const win8_radiobuttons: array[0..2601] of byte = ( 66, 77, 42, 10, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0, 0, 65, 0, 0, 0, 13, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0, 244, 9, 0, 0,196, 14, 0, 0,196, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,255,255,255,255,255,255,255,255,255,209,209,209,168,168, 168,134,134,134,115,115,115,134,134,134,168,168,168,209,209,209,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 209,209,209,168,168,168,134,134,134,115,115,115,134,134,134,168,168, 168,209,209,209,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,233,233,233,214,214,214,199,199,199,189,189,189, 199,199,199,214,214,214,233,233,233,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,233,233,233,214,214,214,199, 199,199,189,189,189,199,199,199,214,214,214,233,233,233,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,233,233, 233,214,214,214,199,199,199,189,189,189,199,199,199,214,214,214,233, 233,233,255,255,255,255,255,255,255,255,255, 0,255,255,255,242,242, 242,177,177,177,114,114,114,199,199,199,233,233,233,252,252,252,233, 233,233,199,199,199,114,114,114,177,177,177,242,242,242,255,255,255, 255,255,255,242,242,242,177,177,177,114,114,114,199,199,199,233,233, 233,252,252,252,233,233,233,199,199,199,114,114,114,177,177,177,242, 242,242,255,255,255,255,255,255,249,249,249,218,218,218,189,189,189, 214,214,214,223,223,223,229,229,229,223,223,223,214,214,214,189,189, 189,218,218,218,249,249,249,255,255,255,255,255,255,249,249,249,218, 218,218,189,189,189,214,214,214,223,223,223,229,229,229,223,223,223, 214,214,214,189,189,189,218,218,218,249,249,249,255,255,255,255,255, 255,249,249,249,218,218,218,189,189,189,214,214,214,223,223,223,229, 229,229,223,223,223,214,214,214,189,189,189,218,218,218,249,249,249, 255,255,255, 0,255,255,255,177,177,177,184,184,184,249,249,249,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,249,249,249, 184,184,184,177,177,177,255,255,255,255,255,255,177,177,177,184,184, 184,249,249,249,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,249,249,249,184,184,184,177,177,177,255,255,255,255,255,255, 218,218,218,209,209,209,228,228,228,230,230,230,230,230,230,230,230, 230,230,230,230,230,230,230,228,228,228,209,209,209,218,218,218,255, 255,255,255,255,255,218,218,218,209,209,209,228,228,228,230,230,230, 230,230,230,230,230,230,230,230,230,230,230,230,228,228,228,209,209, 209,218,218,218,255,255,255,255,255,255,218,218,218,209,209,209,228, 228,228,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230, 228,228,228,209,209,209,218,218,218,255,255,255, 0,209,209,209,114, 114,114,249,249,249,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,249,249,249,114,114,114,209,209, 209,209,209,209,114,114,114,249,249,249,255,255,255,171,171,171, 95, 95, 95, 42, 42, 42, 95, 95, 95,171,171,171,255,255,255,249,249,249, 114,114,114,209,209,209,233,233,233,189,189,189,228,228,228,230,230, 230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230, 230,230,228,228,228,189,189,189,233,233,233,233,233,233,189,189,189, 228,228,228,230,230,230,186,186,186,145,145,145,117,117,117,145,145, 145,186,186,186,230,230,230,228,228,228,189,189,189,233,233,233,233, 233,233,189,189,189,228,228,228,230,230,230,230,230,230,230,230,230, 230,230,230,230,230,230,230,230,230,230,230,230,228,228,228,189,189, 189,233,233,233, 0,168,168,168,199,199,199,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,199,199,199,168,168,168,168,168,168,199,199,199,255, 255,255,171,171,171, 39, 39, 39, 33, 33, 33, 33, 33, 33, 33, 33, 33, 39, 39, 39,171,171,171,255,255,255,199,199,199,168,168,168,214,214, 214,214,214,214,230,230,230,230,230,230,230,230,230,230,230,230,230, 230,230,230,230,230,230,230,230,230,230,230,230,230,230,214,214,214, 214,214,214,214,214,214,214,214,214,230,230,230,186,186,186,115,115, 115,112,112,112,112,112,112,112,112,112,115,115,115,186,186,186,230, 230,230,214,214,214,214,214,214,214,214,214,214,214,214,230,230,230, 230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230, 230,230,230,230,230,230,230,214,214,214,214,214,214, 0,134,134,134, 233,233,233,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,233,233,233,134, 134,134,134,134,134,233,233,233,255,255,255, 95, 95, 95, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 95, 95, 95,255,255, 255,233,233,233,134,134,134,199,199,199,223,223,223,230,230,230,230, 230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230, 230,230,230,230,230,230,223,223,223,199,199,199,199,199,199,223,223, 223,230,230,230,145,145,145,112,112,112,112,112,112,112,112,112,112, 112,112,112,112,112,145,145,145,230,230,230,223,223,223,199,199,199, 199,199,199,223,223,223,230,230,230,230,230,230,230,230,230,230,230, 230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,223, 223,223,199,199,199, 0,115,115,115,252,252,252,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,252,252,252,115,115,115,115,115,115,252,252,252, 255,255,255, 42, 42, 42, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 42, 42, 42,255,255,255,252,252,252,115,115,115,189, 189,189,229,229,229,230,230,230,230,230,230,230,230,230,230,230,230, 230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,229,229, 229,189,189,189,189,189,189,229,229,229,230,230,230,117,117,117,112, 112,112,112,112,112,112,112,112,112,112,112,112,112,112,117,117,117, 230,230,230,229,229,229,189,189,189,189,189,189,229,229,229,230,230, 230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230, 230,230,230,230,230,230,230,230,229,229,229,189,189,189, 0,134,134, 134,233,233,233,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,233,233,233, 134,134,134,134,134,134,233,233,233,255,255,255, 95, 95, 95, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 95, 95, 95,255, 255,255,233,233,233,134,134,134,199,199,199,223,223,223,230,230,230, 230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230, 230,230,230,230,230,230,230,223,223,223,199,199,199,199,199,199,223, 223,223,230,230,230,145,145,145,112,112,112,112,112,112,112,112,112, 112,112,112,112,112,112,145,145,145,230,230,230,223,223,223,199,199, 199,199,199,199,223,223,223,230,230,230,230,230,230,230,230,230,230, 230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230, 223,223,223,199,199,199, 0,168,168,168,199,199,199,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,199,199,199,168,168,168,168,168,168,199,199, 199,255,255,255,171,171,171, 39, 39, 39, 33, 33, 33, 33, 33, 33, 33, 33, 33, 39, 39, 39,171,171,171,255,255,255,199,199,199,168,168,168, 214,214,214,214,214,214,230,230,230,230,230,230,230,230,230,230,230, 230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,214, 214,214,214,214,214,214,214,214,214,214,214,230,230,230,186,186,186, 115,115,115,112,112,112,112,112,112,112,112,112,115,115,115,186,186, 186,230,230,230,214,214,214,214,214,214,214,214,214,214,214,214,230, 230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230, 230,230,230,230,230,230,230,230,230,214,214,214,214,214,214, 0,209, 209,209,114,114,114,249,249,249,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,249,249,249,114,114, 114,209,209,209,209,209,209,114,114,114,249,249,249,255,255,255,171, 171,171, 95, 95, 95, 42, 42, 42, 95, 95, 95,171,171,171,255,255,255, 249,249,249,114,114,114,209,209,209,233,233,233,189,189,189,228,228, 228,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230, 230,230,230,230,230,228,228,228,189,189,189,233,233,233,233,233,233, 189,189,189,228,228,228,230,230,230,186,186,186,145,145,145,117,117, 117,145,145,145,186,186,186,230,230,230,228,228,228,189,189,189,233, 233,233,233,233,233,189,189,189,228,228,228,230,230,230,230,230,230, 230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,228,228, 228,189,189,189,233,233,233, 0,255,255,255,177,177,177,184,184,184, 249,249,249,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,249,249,249,184,184,184,177,177,177,255,255,255,255,255,255,177, 177,177,184,184,184,249,249,249,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,249,249,249,184,184,184,177,177,177,255,255, 255,255,255,255,218,218,218,209,209,209,228,228,228,230,230,230,230, 230,230,230,230,230,230,230,230,230,230,230,228,228,228,209,209,209, 218,218,218,255,255,255,255,255,255,218,218,218,209,209,209,228,228, 228,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,228, 228,228,209,209,209,218,218,218,255,255,255,255,255,255,218,218,218, 209,209,209,228,228,228,230,230,230,230,230,230,230,230,230,230,230, 230,230,230,230,228,228,228,209,209,209,218,218,218,255,255,255, 0, 255,255,255,242,242,242,177,177,177,114,114,114,199,199,199,233,233, 233,252,252,252,233,233,233,199,199,199,114,114,114,177,177,177,242, 242,242,255,255,255,255,255,255,242,242,242,177,177,177,114,114,114, 199,199,199,233,233,233,252,252,252,233,233,233,199,199,199,114,114, 114,177,177,177,242,242,242,255,255,255,255,255,255,249,249,249,218, 218,218,189,189,189,214,214,214,223,223,223,229,229,229,223,223,223, 214,214,214,189,189,189,218,218,218,249,249,249,255,255,255,255,255, 255,249,249,249,218,218,218,189,189,189,214,214,214,223,223,223,229, 229,229,223,223,223,214,214,214,189,189,189,218,218,218,249,249,249, 255,255,255,255,255,255,249,249,249,218,218,218,189,189,189,214,214, 214,223,223,223,229,229,229,223,223,223,214,214,214,189,189,189,218, 218,218,249,249,249,255,255,255, 0,255,255,255,255,255,255,255,255, 255,209,209,209,168,168,168,134,134,134,115,115,115,134,134,134,168, 168,168,209,209,209,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,209,209,209,168,168,168,134,134,134,115,115, 115,134,134,134,168,168,168,209,209,209,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,233,233,233,214,214,214, 199,199,199,189,189,189,199,199,199,214,214,214,233,233,233,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,233, 233,233,214,214,214,199,199,199,189,189,189,199,199,199,214,214,214, 233,233,233,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,233,233,233,214,214,214,199,199,199,189,189,189,199, 199,199,214,214,214,233,233,233,255,255,255,255,255,255,255,255,255, 0); {%endregion} { TfpgWin8Style } procedure TfpgWin8Style.LoadThemeImages; begin //FImages.AddMaskedBMP( // 65x13 in total. 5 images of 13x13 each. // 'win8.radiobuttons', // @stdimg_radiobuttons, // sizeof(stdimg_radiobuttons), 0,0); FImages.AddBMP( // 65x13 pixels. 5 images of 13x13 each. 'win8.radiobuttons', @win8_radiobuttons, sizeof(win8_radiobuttons)); FImages.AddBMP( // 65x13 pixels. 5 images of 13x13 each. 'win8.checkboxes', @win8_checkboxes, sizeof(win8_checkboxes)); end; constructor TfpgWin8Style.Create; begin inherited Create; FImages := TfpgImages.Create; LoadThemeImages; fpgSetNamedColor(clWindowBackground, Win8BaseColors[0]); //fpgSetNamedColor(clBoxColor, Win8BaseColors[1]); fpgSetNamedColor(clShadow1, Win8BaseColors[2]); fpgSetNamedColor(clShadow2, Win8BaseColors[1]); //fpgSetNamedColor(clHilite1, Win8BaseColors[3]); //fpgSetNamedColor(clHilite2, Win8BaseColors[4]); //fpgSetNamedColor(clText1, Win8BaseColors[5]); //fpgSetNamedColor(clText4, Win8BaseColors[6]); fpgSetNamedColor(clSelection, Win8BaseColors[7]); fpgSetNamedColor(clSelectionText, Win8BaseColors[8]); //fpgSetNamedColor(clInactiveSel, Win8BaseColors[7]); //fpgSetNamedColor(clInactiveSelText, Win8BaseColors[8]); //fpgSetNamedColor(clScrollBar, Win8BaseColors[9]); //fpgSetNamedColor(clButtonFace, Win8BaseColors[0]); //fpgSetNamedColor(clListBox, Win8BaseColors[1]); //fpgSetNamedColor(clGridLines, Win8BaseColors[2]); //fpgSetNamedColor(clGridHeader, Win8BaseColors[0]); fpgSetNamedColor(clWidgetFrame, Win8BaseColors[2]); //fpgSetNamedColor(clInactiveWgFrame, Win8BaseColors[10]); //fpgSetNamedColor(clUnset, Win8BaseColors[11]); //fpgSetNamedColor(clMenuText, Win8BaseColors[5]); //fpgSetNamedColor(clMenuDisabled, Win8BaseColors[0]); //fpgSetNamedColor(clHintWindow, Win8BaseColors[0]); //fpgSetNamedColor(clGridSelection, Win8BaseColors[7]); //fpgSetNamedColor(clGridSelectionText, Win8BaseColors[8]); //fpgSetNamedColor(clGridInactiveSel, Win8BaseColors[7]); //fpgSetNamedColor(clGridInactiveSelText, Win8BaseColors[8]); //fpgSetNamedColor(clSplitterGrabBar, Win8BaseColors[7]); fpgSetNamedColor(clChoiceListBox, Win8BaseColors[16]); end; destructor TfpgWin8Style.Destroy; begin FImages.Free; inherited Destroy; end; procedure TfpgWin8Style.DrawControlFrame(ACanvas: TfpgCanvas; x, y, w, h: TfpgCoord); var r: TfpgRect; begin r.SetRect(x, y, w, h); ACanvas.SetLineStyle(1, lsSolid); ACanvas.SetColor(clWidgetFrame); ACanvas.DrawRectangle(r); end; function TfpgWin8Style.GetControlFrameBorders: TRect; begin Result := Rect(1, 1, 1, 1); end; procedure TfpgWin8Style.DrawButtonFace(ACanvas: TfpgCanvas; x, y, w, h: TfpgCoord; AFlags: TfpgButtonFlags); var r: TfpgRect; begin r.SetRect(x, y, w, h); ACanvas.SetLineStyle(1, lsSolid); if btfDisabled in AFlags then ACanvas.SetColor(TfpgColor($ffd9d9d9)) else begin if btfIsDefault in AFlags then ACanvas.SetColor(clSelection) else ACanvas.SetColor(TfpgColor($ffacacac)); end; ACanvas.DrawRectangle(r); InflateRect(r, -1, -1); if btfDisabled in AFlags then begin ACanvas.SetColor(TfpgColor($ffefefef)); ACanvas.FillRectangle(r); end else ACanvas.GradientFill(r, clWindowBackground, TfpgColor($ffe5e5e5), gdVertical); end; function TfpgWin8Style.GetButtonBorders: TRect; begin Result := Rect(2, 2, 2, 2); end; procedure TfpgWin8Style.DrawStaticComboBox(ACanvas: TfpgCanvas; r: TfpgRect; const IsEnabled: Boolean; const IsFocused: Boolean; const IsReadOnly: Boolean; const ABackgroundColor: TfpgColor; const AInternalBtnRect: TfpgRect; const ABtnPressed: Boolean); var ar: TfpgRect; begin //if IsEnabled then // ACanvas.SetColor(TfpgColor($ffacacac)) //else // ACanvas.SetColor(TfpgColor($ffacacac)); ACanvas.GradientFill(r, clWindowBackground, clChoiceListBox, gdVertical); // paint arrow ACanvas.SetColor(clShadow2); ar := AInternalBtnRect; { The bounding rectangle for the arrow } ar.Width := 8; ar.Height := 6; ar.Left := AInternalBtnRect.Left + ((AInternalBtnRect.Width-ar.Width) div 2); ar.Top := AInternalBtnRect.Top + ((AInternalBtnRect.Height-ar.Height) div 2); DrawDirectionArrow(ACanvas, ar.Left, ar.Top, ar.Width, ar.Height, adDown); end; procedure TfpgWin8Style.DrawCheckbox(ACanvas: TfpgCanvas; x, y: TfpgCoord; ix, iy: TfpgCoord); var img: TfpgImage; size: integer; begin img := FImages.GetImage('win8.checkboxes'); // Do NOT localize - return value is a reference only size := GetCheckBoxSize; ACanvas.DrawImagePart(x, y, img, ix, iy, size, size); end; initialization fpgStyleManager.RegisterClass('win8', TfpgWin8Style); end.