📄 frame.h
字号:
//// Copyright (c) 2005 by Istv醤 V醨adi//// This file is part of dxr3Player, a DVD player written specifically // for the DXR3 (aka Hollywood+) decoder card.// This program is free software; you can redistribute it and/or modify// it under the terms of the GNU General Public License as published by// the Free Software Foundation; either version 2 of the License, or// (at your option) any later version.//// 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. See the// GNU General Public License for more details.//// You should have received a copy of the GNU General Public License// along with this program; if not, write to the Free Software// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA#ifndef OUTPUT_UNICHROME_OSD_FRAME_H#define OUTPUT_UNICHROME_OSD_FRAME_H//------------------------------------------------------------------------------#include "RoundedField.h"#include "unichrome/PhysicalWindow.h"#include "unichrome/UpdateableWindow.h"#include "unichrome/Unichrome.h"#include "sched/BasicTimeout.h"//------------------------------------------------------------------------------namespace unichrome {class Font;}//------------------------------------------------------------------------------namespace output { namespace unichrome { namespace osd {//------------------------------------------------------------------------------/** * This is a bordered frame used for OSD windows. Each frame has a * title */class Frame : public ::unichrome::UpdateableWindow, public sched::BasicTimeout{public: /** * A frame configuration. */ class Config { public: /** * The border color. */ static const uint32_t borderColor = 0x005cb3ff; /** * The title color. */ static const uint32_t titleColor = 0x00ffffff; /** * The border thickness. */ static const size_t borderThickness = 5; /** * The corner radius */ static const size_t cornerRadius = 13; /** * The margin before/after the title */ static const size_t titleMargin = 8; /** * The margin above below the title. */ static const size_t titleVerticalMargin = 2; /** * The unichrome device we are using. */ ::unichrome::Unichrome& videoDevice; /** * The title font. */ ::unichrome::Font& titleFont; /** * The alpha. */ uint8_t alpha; /** * Construct the frame configuration. */ Config(::unichrome::Unichrome& videoDevice, ::unichrome::Font& titleFont, uint8_t alpha = 0x80); };private: /** * The window the frame should be displayed on. */ ::unichrome::Window& displayWindow; /** * The position within the display window. */ size_t displayX, displayY; /** * The memory block this frame belongs to. */ ::unichrome::MemoryBlock* memoryBlock; /** * The physical window occupied by this frame. */ ::unichrome::PhysicalWindow physicalWindow; /** * Indicate if the frame is visible or not. */ bool visible; protected: /** * The configuration. */ const Config& config; /** * The inner window, i.e. the area that can be used to draw into * the frame */ ::unichrome::LogicalWindow* innerWindow;public: /** * Construct the frame with the given configuration. */ Frame(const Config& config, ::unichrome::Window& displayWindow, size_t width, size_t height, const char* title, uint32_t bgColor); /** * Destroy the frame. */ ~Frame(); /** * Determine if the frame is visible or not. */ bool isVisible() const; /** * Set the position of the frame. If visible, it will first be * hidden and the redisplayed. */ void setDisplayPosition(size_t x, size_t y); /** * Get the X-coordinate of the display position */ size_t getDisplayX() const; /** * Get the Y-coordinate of the display position */ size_t getDisplayY() const; /** * Show the frame. If already visible, only the updated parts will * be displayed. */ void show(); /** * Hide the frame. If already visible, only the updated parts will * be displayed. */ void hide();private: /** * Perform the operation at a timeout. This is the change of the * visible state. */ virtual void handleTimeout(); /** * Draw the given border line. */ void drawBorderLine(::unichrome::LogicalWindow& window, const Config& config, bool horizontal, bool leftTop); /** * Draw the given corner. */ void drawCorner(::unichrome::LogicalWindow& window, const Config& config, bool top, bool left); /** * Draw the border into the given border window. */ void drawBorder(::unichrome::LogicalWindow& window, const Config& config); /** * Draw the title into the window. */ void drawTitle(const Config& config, const Field::Config& titleFieldConfig, const char* title); };//------------------------------------------------------------------------------// Inline definitions//------------------------------------------------------------------------------inline bool Frame::isVisible() const{ return visible;}//------------------------------------------------------------------------------inline size_t Frame::getDisplayX() const{ return displayX;}//------------------------------------------------------------------------------inline size_t Frame::getDisplayY() const{ return displayY;}//------------------------------------------------------------------------------} /* namespace output::unichrome::osd */ } /* namespace output::unichrome */ } /* namespace output *///------------------------------------------------------------------------------#endif // OUTPUT_UNICHROME_OSD_FRAME_H// Local variables:// mode: c++// End:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -