⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 layout.hpp

📁 一个WinCE6。0下的IP phone的源代码
💻 HPP
字号:
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this sample source code is subject to the terms of the Microsoft
// license agreement under which you licensed this sample source code. If
// you did not accept the terms of the license agreement, you are not
// authorized to use this sample source code. For the terms of the license,
// please see the license agreement between you and Microsoft or, if applicable,
// see the LICENSE.RTF on your install media or the root of your tools installation.
// THE SAMPLE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES.
//
#pragma once

#ifndef __LAYOUT_HPP__
#define __LAYOUT_HPP__

#include <windows.h>
#include "Common.hpp"


class Layout_t
{
public:
    static
    HRESULT
    InitializeRCData(
        void
        );

    #define DECLARE_METRIC(MetricName) \
        static int MetricName()

    #define DECLARE_MARGINS(MetricName) \
        static int MetricName##LeftMargin();\
        static int MetricName##TopMargin();\
        static int MetricName##RightMargin();\
        static int MetricName##BottomMargin()

    #define DECLARE_TILE_MARGINS(MetricName) \
        static int MetricName##TileLeft();\
        static int MetricName##TileTop();\
        static int MetricName##TileRight();\
        static int MetricName##TileBottom()

    DECLARE_METRIC(ButtonWidth);
    DECLARE_METRIC(ButtonHeight);
    DECLARE_TILE_MARGINS(Button);
    DECLARE_METRIC(ButtonConnectorLine);

    DECLARE_METRIC(PopupItemWidth);
    DECLARE_METRIC(PopupItemHeight);
    DECLARE_METRIC(PopupTextMargin);
    DECLARE_METRIC(PopupRightArrowTopMargin);
    DECLARE_METRIC(PopupRightArrowRightMargin);
    DECLARE_METRIC(PopupUpArrowTopMargin);
    DECLARE_METRIC(PopupUpArrowRightMargin);

    DECLARE_METRIC(MenuBarHeight);
    DECLARE_METRIC(MenuBarTop);
    DECLARE_METRIC(MenuBarRight);

    DECLARE_METRIC(ListBoxDefaultItemHeight);

    DECLARE_METRIC(LogoTopMargin);
    DECLARE_METRIC(LogoRightMargin);

    DECLARE_METRIC(DialogScreenTitleHeight);
    DECLARE_MARGINS(DialogScreenTitle);
    DECLARE_METRIC(DialogScreenTitleTextHorzMargin);
    DECLARE_TILE_MARGINS(DialogScreenTitle);
    DECLARE_METRIC(DialogScreenScrollArrowWidth);
    DECLARE_METRIC(DialogScreenScrollArrowHeight);
    DECLARE_MARGINS(DialogScreenScrollArrow);

    DECLARE_METRIC(MessageBoxHeight);
    DECLARE_METRIC(MessageBoxTextMargin);
    DECLARE_METRIC(MessageBoxIconWidth);
    DECLARE_METRIC(MessageBoxIconHeight);
    DECLARE_METRIC(MessageBoxTitleHeight);
    DECLARE_METRIC(MessageBoxTitleToDividerMargin);
    DECLARE_METRIC(MessageBoxTitleToIconMargin);
    DECLARE_METRIC(MessageBoxTitleToTextMargin);

    DECLARE_METRIC(StatusHeaderTextMargin);
    DECLARE_TILE_MARGINS(StatusHeader);

    DECLARE_METRIC(ToolTipTextMargin);
    DECLARE_METRIC(ToolTipItemDelta);

    DECLARE_TILE_MARGINS(TrackbarThumb);
    DECLARE_TILE_MARGINS(TrackbarChannel);

    // Display Items
    DECLARE_METRIC(TextItemHeight);
    DECLARE_METRIC(TextItemHorzMargin);
    DECLARE_METRIC(TextItemVerMargin);

    DECLARE_METRIC(LabeledItemToControlMargin);
    DECLARE_METRIC(LabeledItemHorzMargin);
    DECLARE_METRIC(LabeledItemVerMargin);

private:
    struct Margins_t
    {
        short m_LeftMargin;
        short m_TopMargin;
        short m_RightMargin;
        short m_BottomMargin;
    };

    struct MetricsRCData_t
    {
        //Button
        short m_ButtonWidth;
        short m_ButtonHeight;
        Margins_t m_ButtonTileMargins;
        short m_ButtonConnectorLine;

        //Popup Item
        short m_PopupItemWidth;
        short m_PopupItemHeight;
        short m_PopupTextMargin;
        short m_PopupRightArrowTopMargin;
        short m_PopupRightArrowRightMargin;
        short m_PopupUpArrowTopMargin;
        short m_PopupUpArrowRightMargin;

        //Menu Bar
        short m_MenuBarHeight;
        short m_MenuBarTop;
        short m_MenuBarRight;

        //List Box
        short m_ListBoxDefaultItemHeight;

        //Small Logo (top-right corner of client)
        short m_LogoTopMargin;
        short m_LogoRightMargin;

        //Dialog Screen Title
        short m_DialogScreenTitleHeight;
        Margins_t m_DialogScreenTitleMargins;
        short m_DialogScreenTitleTextHorzMargin;
        Margins_t m_DialogScreenTitleTileMargins;

        //Dialog Screen Scroll Arrow
        short m_DialogScreenScrollArrowWidth;
        short m_DialogScreenScrollArrowHeight;
        Margins_t m_DialogScreenScrollArrowMargins;

        //Message Box
        short m_MessageBoxHeight;
        short m_MessageBoxTextMargin;
        short m_MessageBoxIconWidth;
        short m_MessageBoxIconHeight;
        short m_MessageBoxTitleHeight;
        short m_MessageBoxTitleToDividerMargin;
        short m_MessageBoxTitleToIconMargin;
        short m_MessageBoxTitleToTextMargin;

        //Status Header
        short m_StatusHeaderTextMargin;
        Margins_t m_StatusHeaderTileMargins;

        //Tool Tip
        short m_ToolTipTextMargin;
        short m_ToolTipItemDelta;

        //Track Bar
        Margins_t m_TrackbarThumbTileMargins;
        Margins_t m_TrackbarChannelTileMargins;

        //Text Display Item
        short m_TextItemHeight;
        short m_TextItemHorzMargin;
        short m_TextItemVerMargin;

        //Labeled-Edit Display Item
        short m_LabeledItemToControlMargin;
        short m_LabeledItemHorzMargin;
        short m_LabeledItemVerMargin;
    };

    static const MetricsRCData_t* s_pMetrics;
};

class Colors_t
{
public:
    static
    HRESULT
    InitializeRCData(
        void
        );

    #define DECLARE_COLOR(ColorName) \
        static int ColorName()

    DECLARE_COLOR(DefaultTransparentColor);
    DECLARE_COLOR(DefaultBackgroundColor);
    DECLARE_COLOR(DefaultTextColor);

    DECLARE_COLOR(GradientTopBackgroundColor);
    DECLARE_COLOR(GradientBottomBackgroundColor);

    DECLARE_COLOR(MenuButtonDownTextColor);
    DECLARE_COLOR(MenuButtonUpTextColor);
    DECLARE_COLOR(ButtonDownConnectorLineColor);
    DECLARE_COLOR(ButtonUpConnectorLineColor);

    DECLARE_COLOR(PopupMenuItemBackgroundColor);
    DECLARE_COLOR(PopupMenuItemSelectedBackgroundColor);
    DECLARE_COLOR(PopupMenuItemBorderColor);
    DECLARE_COLOR(PopupMenuItemSelectedBorderColor);
    DECLARE_COLOR(PopupMenuItemTextColor);
    DECLARE_COLOR(PopupMenuItemSelectedTextColor);
    DECLARE_COLOR(PopupMenuItemDisabledTextColor);

    DECLARE_COLOR(DialogScreenTitleTextColor);

    DECLARE_COLOR(ListBoxBackgroundColor);

    DECLARE_COLOR(MessageBoxBackgroundColor);
    DECLARE_COLOR(MessageBoxTextColor);
    DECLARE_COLOR(MessageBoxTitleColor);
    DECLARE_COLOR(MessageBoxBorderColor);
    DECLARE_COLOR(MessageBoxDividerLineColor);

    DECLARE_COLOR(ToolTipBackgroundColor);
    DECLARE_COLOR(ToolTipTextColor);

    DECLARE_COLOR(DisplayItemBackgroundColor);
    DECLARE_COLOR(DisplayItemSelectedBackgroundColor);
    DECLARE_COLOR(DisplayItemTextColor);
    DECLARE_COLOR(DisplayItemSelectedTextColor);
    DECLARE_COLOR(DisplayItemBorderColor);
    DECLARE_COLOR(DisplayItemSelectedBorderColor);

private:
    struct ColorsRCData_t
    {
        int m_DefaultTransparentColor;
        int m_DefaultBackgroundColor;
        int m_DefaultTextColor;

        int m_GradientTopBackgroundColor;
        int m_GradientBottomBackgroundColor;

        int m_MenuButtonDownTextColor;
        int m_MenuButtonUpTextColor;
        int m_ButtonDownConnectorLineColor;
        int m_ButtonUpConnectorLineColor;

        int m_PopupMenuItemBackgroundColor;
        int m_PopupMenuItemSelectedBackgroundColor;
        int m_PopupMenuItemBorderColor;
        int m_PopupMenuItemSelectedBorderColor;
        int m_PopupMenuItemTextColor;
        int m_PopupMenuItemSelectedTextColor;
        int m_PopupMenuItemDisabledTextColor;

        int m_DialogScreenTitleTextColor;

        int m_ListBoxBackgroundColor;

        int m_MessageBoxBackgroundColor;
        int m_MessageBoxTextColor;
        int m_MessageBoxTitleColor;
        int m_MessageBoxBorderColor;
        int m_MessageBoxDividerLineColor;

        int m_ToolTipBackgroundColor;
        int m_ToolTipTextColor;

        int m_DisplayItemBackgroundColor;
        int m_DisplayItemSelectedBackgroundColor;
        int m_DisplayItemTextColor;
        int m_DisplayItemSelectedTextColor;
        int m_DisplayItemBorderColor;
        int m_DisplayItemSelectedBorderColor;
    };

    static const ColorsRCData_t* s_pColors;
};

class Fonts_t
{
public:
    static
    HRESULT
    InitializeRCData(
        void
        );

    #define DECLARE_FONT(FontName) \
        static HFONT FontName()

    DECLARE_FONT(StandardText);
    DECLARE_FONT(StandardTextBold);
    DECLARE_FONT(InformationText);
    DECLARE_FONT(LargeText);
    DECLARE_FONT(BigNumbersText);

private:
    struct FontData_t
    {
        unsigned short m_FontNameId;
        short m_Height;
        short m_Weight;
    };

    struct FontsRCData_t
    {
        FontData_t m_StandardText;
        FontData_t m_StandardTextBold;
        FontData_t m_InformationText;
        FontData_t m_LargeText;
        FontData_t m_BigNumbersText;
    };

    static const FontsRCData_t* s_pFonts;
};

#endif // !defined __LAYOUT_HPP__

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -