Code: Select all
#include "FiveWin.ch"
#define LAYOUT_TOP 1
#define LAYOUT_LEFT 2
static oDlg
//----------------------------------------------------------------------------//
function Main()
Local oPanelScroll
Local oFont1,oFontG
Local oSay
Local oGet
local cFind := ""
local cPrompt := "Setup of Windows ( FWH BtnBmp Demo )"
DEFINE FONT oFont1 NAME "Segoe UI Light" SIZE 0,-24
DEFINE FONT oFontG NAME "Segoe UI" SIZE 0,-18
DEFINE DIALOG oDlg SIZE 880,600 ;
PIXEL TRUEPIXEL RESIZABLE //FONT oFont
oDlg:setcolor(CLR_BLACK,CLR_WHITE)
@ 20, 160 SAY oSay PROMPT cPrompt OF oDlg PIXEL FONT oFont1 SIZE 420, 40
@ 70, 170 GET oGet VAR cFind OF oDlg PIXEL FONT oFontG SIZE 400, 36
* CUEBANNER "Find a setting"
oSay:lTransparent:=.t.
oDlg:bResized := <||
local oRect := oDlg:GetCliRect()
WndResize( oPanelScroll,oSay,oGet,oRect)
RETURN nil
>
oDlg:nWidth := 850
oDlg:nHeight := 800
ACTIVATE DIALOG oDlg CENTERED ;
ON INIT( oPanelScroll := CreatePanel( oDlg,oGet ),;
oPanelScroll:CheckResize(),;
eval(oDlg:bResized) ) //, )
return nil
//----------------------------------------------------------------------------//
function CreatePanel( oDlg,oGet )
local oPanel
local oBold
local aGrad := { { 1, RGB( 216, 230, 238 ), RGB( 103, 154, 194 ) } }
local aBtns := { ;
{ "System" + CRLF + "Screen, notifications," + CRLF + "power", 0xE770, { || Dummy() } }, ;
{ "Devices" + CRLF + "Bluetooth, printers," + CRLF + "mouse", 0xE772, { || Dummy() } }, ;
{ "Mobile" + CRLF + "Link your Android, iPhone" + CRLF, 0xE1C9, { || Dummy() } }, ;
{ "Network && Internet" + CRLF + "WIFI, flight mode" + CRLF + "VPN", 0xE12b, { || Dummy() } }, ;
{ "Personalization" + CRLF + "Background, lock screen" + CRLF, 0xE771, { || Dummy() } }, ;
{ "Apps" + CRLF + "Uninstall defaults" + CRLF + "Optional Features", 0xE179, { || Dummy() } }, ;
{ "Account" + CRLF + "Your account, email sync" + CRLF + "Work family", 0xE77B, { || Dummy() } }, ;
{ "Time and language" + CRLF + "Voice, region, date" + CRLF, 0xE775, { || Dummy() } }, ;
{ "Games" + CRLF + "Game bar, DVR," + CRLF + "retransmission and game mode", 0xE909, { || Dummy() } }, ;
{ "Accessibility" + CRLF + "Narrator, magnifying glass," + CRLF + "high contrast", 0xE776, { || Dummy() } }, ;
{ "Cortana" + CRLF + "Language of Cortana," + CRLF + "permissions, notifications", 0xECCA, { || Dummy() } }, ;
{ "Privacy" + CRLF + "Location Camera" + CRLF, 0xE1F6, { || Dummy() } }, ;
{ "Update && Security" + CRLF + "Windows Update" + CRLF + "Recovery", 0xE777, { || Dummy() } } ;
}
local nRow := 10
local nCol := 10
local nClrBack := CLR_WHITE
local nW := 200
local nH := 140
local nCBorder := 0xC38B2B
local nClrText := CLR_BLACK
local nClrBorder := 0xE6E6E6
DEFINE FONT oFont NAME "Segoe UI" SIZE 0,-14
DEFINE FONT oBold NAME "Segoe UI" SIZE 0,-14 BOLD
WITH OBJECT oGet
:bAction := { || Dummy() }
:cBmpName := 0xE11A
:lBtnTransparent := .t.
:CreateButton()
END
oPanel := TScrollPanel():New( 135,010,180,550,oDlg, .t. )
oPanel:nRightMargin := 2
oPanel:nBottomMargin := 5
oPanel:WinStyle(WS_BORDER, .f.)
oPanel:setcolor(CLR_WHITE,CLR_WHITE)
For x = 1 to Len( aBtns )
if x > 1
if Mod( x, 5 ) = 1
nRow += 200
nCol := 10
else
nCol += 200
endif
endif
@ nRow, nCol BTNBMP oBtn PROMPT aBtns[ x ][ 1 ] ;
RESOURCE aBtns[ x ][ 2 ] SIZE nW, nH PIXEL OF oPanel FLAT NOBORDER ;
COLOR nClrText, nClrBack
WITH OBJECT oBtn
:bAction := aBtns[ x ][ 3 ]
:nClrBorder := nClrBorder
:bColorMap := { | o | o:lBorder := o:lMOver, nCBorder }
:oFontBold := oBold
:lRound := .F.
END
Next x
oPanel:SetRange()
RELEASE FONT oFont, oBold
return oPanel
//----------------------------------------------------------------------------//
//----------------------------------------------------------------------------//
static function Dummy()
Return nil
//----------------------------------------------------------------------------//
static function WndResize( oWnd,oSay,oGet,oRect1 )
local oRect := oWnd:GetCliRect()
local nMargin, nRow, nCol, nCols, nBtnWidth, nBtns, nBtn, oBtn, n
*for n := 1 to 2
oSay:nLeft := ( oRect1:nWidth - oSay:nWidth ) / 2
oGet:nLeft := ( oRect1:nWidth - oGet:nWidth ) / 2
*next
oSay:lTransparent:=.t.
nBtnWidth := 200
nCols := Min( 5, Int( oRect:nWidth / nBtnWidth ) - 1 )
nMargin := ( oRect:nWidth - nCols * nBtnWidth ) / 2
nBtns := Len( oWnd:aControls )
nRow := 100
nCol := nMargin
if nCols > 2
for nBtn := 1 to nBtns
WITH OBJECT ( oBtn := oWnd:aControls[ nBtn ] )
:cCaption := Trim( oBtn:cCaption )
:nTop := nRow
:nLeft := nCol
:nWidth := 200
:nHeight := 140
:nLayOut := LAYOUT_TOP
END
if nBtn % nCols == 0
nRow += 200
nCol := nMargin
else
nCol += nBtnWidth
endif
next
else
for nBtn := 1 to nBtns
WITH OBJECT ( oBtn := oWnd:aControls[ nBtn ] )
:cCaption += " "
:nTop := nRow
:nLeft := 30
:nWidth := oRect:nWidth - 60
:nHeight := 80
:nLayOut := LAYOUT_LEFT
END
nRow += 100
next
endif
oWnd:refresh(.t.)
return nil
//----------------------------------------------------------------------------//