📄 themesrv.pas
字号:
unit ThemeSrv;
//----------------------------------------------------------------------------------------------------------------------
// Windows XP Theme Manager is freeware. You may freely use it in any software, including commercial software, provided
// you accept the following conditions:
//
// 1) The software may not be included into component collections and similar compilations which are sold. If you want
// to distribute this software for money then contact me first and ask for my permission.
// 2) My copyright notices in the source code may not be removed or modified.
// 3) If you modify and/or distribute the code to any third party then you must not veil the original author. It must
// always be clearly identifiable that I, Mike Lischke, am the original author.
// Although it is not required it would be a nice move to recognize my work by adding a citation to the application's
// about box or a similar place.
//
// The original code is ThemeSrv.pas, released 03. February 2002.
//
// The initial developer of the original code is:
// Mike Lischke (public@soft-gems.net, www.soft-gems.net).
//
// Portions created by Mike Lischke are
// (C) 2001-2005 Mike Lischke. All Rights Reserved.
//----------------------------------------------------------------------------------------------------------------------
//
// This unit contains the implementation of TThemeServices which is a designed to manage all necessary aspects of
// the Windows XP (and up) theme APIs. The component is responsible for loading and unloading of the theme DLL
// and offers properties and methods to test for various aspects of the theme APIs and to ease painting of themed
// window content.
//
// The TThemeServices class is designed to work for controls which need XP paint stuff. It does not manipulate
// any VCL class (for this task TThemeManager is responsible) and can be used standalone (also as general support
// tool in an application). Using the global ThemeServices function you can implicitely create and use a single
// instance of the class. Theme Manager uses the same approach.
//----------------------------------------------------------------------------------------------------------------------
// For version information and history see ThemeMgr.pas source file.
//----------------------------------------------------------------------------------------------------------------------
interface
uses
Windows, Classes, Messages, Graphics, Controls,
UxTheme, TmSchema;
{$I Compilers.inc}
type
// These are all elements which can be themed.
TThemedElement = (
teButton,
teClock,
teComboBox,
teEdit,
teExplorerBar,
teHeader,
teListView,
teMenu,
tePage,
teProgress,
teRebar,
teScrollBar,
teSpin,
teStartPanel,
teStatus,
teTab,
teTaskBand,
teTaskBar,
teToolBar,
teToolTip,
teTrackBar,
teTrayNotify,
teTreeview,
teWindow
);
// 'Button' theme data
TThemedButton = (
tbButtonDontCare,
tbButtonRoot, // The root part of each element is sometimes used for special painting and does not
// belong to a certain state.
tbPushButtonNormal, tbPushButtonHot, tbPushButtonPressed, tbPushButtonDisabled, tbPushButtonDefaulted,
tbRadioButtonUncheckedNormal, tbRadioButtonUncheckedHot, tbRadioButtonUncheckedPressed, tbRadioButtonUncheckedDisabled,
tbRadioButtonCheckedNormal, tbRadioButtonCheckedHot, tbRadioButtonCheckedPressed, tbRadioButtonCheckedDisabled,
tbCheckBoxUncheckedNormal, tbCheckBoxUncheckedHot, tbCheckBoxUncheckedPressed, tbCheckBoxUncheckedDisabled,
tbCheckBoxCheckedNormal, tbCheckBoxCheckedHot, tbCheckBoxCheckedPressed, tbCheckBoxCheckedDisabled,
tbCheckBoxMixedNormal, tbCheckBoxMixedHot, tbCheckBoxMixedPressed, tbCheckBoxMixedDisabled,
tbGroupBoxNormal, tbGroupBoxDisabled,
tbUserButton
);
// 'Clock' theme data
TThemedClock = (
tcClockDontCare,
tcClockRoot,
tcTimeNormal
);
// 'ComboBox' theme data
TThemedComboBox = (
tcComboBoxDontCare,
tcComboBoxRoot,
tcDropDownButtonNormal, tcDropDownButtonHot, tcDropDownButtonPressed, tcDropDownButtonDisabled
);
// 'Edit' theme data
TThemedEdit = (
teEditDontCare,
teEditRoot,
teEditTextNormal, teEditTextHot, teEditTextSelected, teEditTextDisabled, teEditTextFocused, teEditTextReadOnly, teEditTextAssist,
teEditCaret
);
// 'ExplorerBar' theme data
TThemedExplorerBar = (
tebExplorerBarDontCare,
tebExplorerBarRoot,
tebHeaderBackgroundNormal, tebHeaderBackgroundHot, tebHeaderBackgroundPressed,
tebHeaderCloseNormal, tebHeaderCloseHot, tebHeaderClosePressed,
tebHeaderPinNormal, tebHeaderPinHot, tebHeaderPinPressed,
tebHeaderPinSelectedNormal, tebHeaderPinSelectedHot, tebHeaderPinSelectedPressed,
tebIEBarMenuNormal, tebIEBarMenuHot, tebIEBarMenuPressed,
tebNormalGroupBackground,
tebNormalGroupCollapseNormal, tebNormalGroupCollapseHot, tebNormalGroupCollapsePressed,
tebNormalGroupExpandNormal, tebNormalGroupExpandHot, tebNormalGroupExpandPressed,
tebNormalGroupHead,
tebSpecialGroupBackground,
tebSpecialGroupCollapseSpecial, tebSpecialGroupCollapseHot, tebSpecialGroupCollapsePressed,
tebSpecialGroupExpandSpecial, tebSpecialGroupExpandHot, tebSpecialGroupExpandPressed,
tebSpecialGroupHead
);
// 'Header' theme data
TThemedHeader = (
thHeaderDontCare,
thHeaderRoot,
thHeaderItemNormal, thHeaderItemHot, thHeaderItemPressed,
thHeaderItemLeftNormal, thHeaderItemLeftHot, thHeaderItemLeftPressed,
thHeaderItemRightNormal, thHeaderItemRightHot, thHeaderItemRightPressed,
thHeaderSortArrowSortedUp, thHeaderSortArrowSortedDown
);
// 'ListView' theme data
TThemedListview = (
tlListviewDontCare,
tlListviewRoot,
tlListItemNormal, tlListItemHot, tlListItemSelected, tlListItemDisabled, tlListItemSelectedNotFocus,
tlListGroup,
tlListDetail,
tlListSortDetail,
tlEmptyText
);
// 'Menu' theme data
TThemedMenu = (
tmMenuDontCare,
tmMenuRoot,
tmMenuItemNormal, tmMenuItemSelected, tmMenuItemDemoted,
tmMenuDropDown,
tmMenuBarItem,
tmMenuBarDropDown,
tmChevron,
tmSeparator
);
// 'Page' theme data
TThemedPage = (
tpPageDontCare,
tpPageRoot,
tpUpNormal, tpUpHot, tpUpPressed, tpUpDisabled,
tpDownNormal, tpDownHot, tpDownPressed, tpDownDisabled,
tpUpHorzNormal, tpUpHorzHot, tpUpHorzPressed, tpUpHorzDisabled,
tpDownHorzNormal, tpDownHorzHot, tpDownHorzPressed, tpDownHorzDisabled
);
// 'Progress' theme data
TThemedProgress = (
tpProgressDontCare,
tpProgressRoot,
tpBar,
tpBarVert,
tpChunk,
tpChunkVert
);
// 'Rebar' theme data
TThemedRebar = (
trRebarDontCare,
trRebarRoot,
trGripper,
trGripperVert,
trBandNormal, trBandHot, trBandPressed, trBandDisabled, trBandChecked, trBandHotChecked,
trChevronNormal, trChevronHot, trChevronPressed, trChevronDisabled,
trChevronVertNormal, trChevronVertHot, trChevronVertPressed, trChevronVertDisabled
);
// 'ScrollBar' theme data
TThemedScrollBar = (
tsScrollBarDontCare,
tsScrollBarRoot,
tsArrowBtnUpNormal, tsArrowBtnUpHot, tsArrowBtnUpPressed, tsArrowBtnUpDisabled,
tsArrowBtnDownNormal, tsArrowBtnDownHot, tsArrowBtnDownPressed, tsArrowBtnDownDisabled,
tsArrowBtnLeftNormal, tsArrowBtnLeftHot, tsArrowBtnLeftPressed, tsArrowBtnLeftDisabled,
tsArrowBtnRightNormal, tsArrowBtnRightHot, tsArrowBtnRightPressed, tsArrowBtnRightDisabled,
tsThumbBtnHorzNormal, tsThumbBtnHorzHot, tsThumbBtnHorzPressed, tsThumbBtnHorzDisabled,
tsThumbBtnVertNormal, tsThumbBtnVertHot, tsThumbBtnVertPressed, tsThumbBtnVertDisabled,
tsLowerTrackHorzNormal, tsLowerTrackHorzHot, tsLowerTrackHorzPressed, tsLowerTrackHorzDisabled,
tsUpperTrackHorzNormal, tsUpperTrackHorzHot, tsUpperTrackHorzPressed, tsUpperTrackHorzDisabled,
tsLowerTrackVertNormal, tsLowerTrackVertHot, tsLowerTrackVertPressed, tsLowerTrackVertDisabled,
tsUpperTrackVertNormal, tsUpperTrackVertHot, tsUpperTrackVertPressed, tsUpperTrackVertDisabled,
tsGripperHorzNormal, tsGripperHorzHot, tsGripperHorzPressed, tsGripperHorzDisabled,
tsGripperVertNormal, tsGripperVertHot, tsGripperVertPressed, tsGripperVertDisabled,
tsSizeBoxRightAlign, tsSizeBoxLeftAlign
);
// 'Spin' theme data
TThemedSpin = (
tsSpinDontCare,
tsSpinRoot,
tsUpNormal, tsUpHot, tsUpPressed, tsUpDisabled,
tsDownNormal, tsDownHot, tsDownPressed, tsDownDisabled,
tsUpHorzNormal, tsUpHorzHot, tsUpHorzPressed, tsUpHorzDisabled,
tsDownHorzNormal, tsDownHorzHot, tsDownHorzPressed, tsDownHorzDisabled
);
// 'StartPanel' theme data
TThemedStartPanel = (
tspStartPanelDontCare,
tspStartPanelRoot,
tspUserPane,
tspMorePrograms,
tspMoreProgramsArrowNormal, tspMoreProgramsArrowHot, tspMoreProgramsArrowPressed,
tspProgList,
tspProgListSeparator,
tspPlacesList,
tspPlacesListSeparator,
tspLogOff,
tspLogOffButtonsNormal, tspLogOffButtonsHot, tspLogOffButtonsPressed,
tspUserPicture,
tspPreview
);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -