#ifndef _COMMON_SCREENBUFFERINFO_HPP_ #define _COMMON_SCREENBUFFERINFO_HPP_ #ifndef _COMMON_WINDOWS_HPP_ #include #endif #ifndef _COMMON_COORD_HPP_ #include #endif #ifndef _COMMON_SMALLRECT_HPP_ #include #endif class ConsoleScreenBufferInfo : private CONSOLE_SCREEN_BUFFER_INFO { public: ConsoleScreenBufferInfo(void); ConsoleScreenBufferInfo(const ConsoleScreenBufferInfo &someConsoleScreenBufferInfo); virtual ~ConsoleScreenBufferInfo(); Coord size(void)const; void size(const Coord &size); Coord cursorPos(void)const; void cursorPos(const Coord &cursorPos); WORD attributes(void)const; void attributes(WORD attributes); SmallRect winRect(void)const; void winRect(const SmallRect &winRect); Coord maxWinRect(void)const; void maxWinRect(const Coord &maxWinRect); private: void setZero(void); }; inline ConsoleScreenBufferInfo::ConsoleScreenBufferInfo(void) { } inline ConsoleScreenBufferInfo::ConsoleScreenBufferInfo(const ConsoleScreenBufferInfo &someConsoleScreenBufferInfo) { *this=someConsoleScreenBufferInfo; } inline ConsoleScreenBufferInfo::~ConsoleScreenBufferInfo() { } inline Coord ConsoleScreenBufferInfo::size(void)const { return Coord(CONSOLE_SCREEN_BUFFER_INFO::dwSize.X,CONSOLE_SCREEN_BUFFER_INFO::dwSize.Y); } inline void ConsoleScreenBufferInfo::size(const Coord &size) { CONSOLE_SCREEN_BUFFER_INFO::dwSize.X=size.x(); CONSOLE_SCREEN_BUFFER_INFO::dwSize.Y=size.y(); } inline Coord ConsoleScreenBufferInfo::cursorPos(void)const { return Coord(CONSOLE_SCREEN_BUFFER_INFO::dwCursorPosition.X,CONSOLE_SCREEN_BUFFER_INFO::dwCursorPosition.Y); } inline void ConsoleScreenBufferInfo::cursorPos(const Coord &cursorPos) { CONSOLE_SCREEN_BUFFER_INFO::dwCursorPosition.X=cursorPos.x(); CONSOLE_SCREEN_BUFFER_INFO::dwCursorPosition.Y=cursorPos.y(); } inline WORD ConsoleScreenBufferInfo::attributes(void)const { return CONSOLE_SCREEN_BUFFER_INFO::wAttributes; } inline void ConsoleScreenBufferInfo::attributes(WORD attributes) { CONSOLE_SCREEN_BUFFER_INFO::wAttributes=attributes; } inline SmallRect ConsoleScreenBufferInfo::winRect(void)const { return SmallRect(CONSOLE_SCREEN_BUFFER_INFO::srWindow.Left, CONSOLE_SCREEN_BUFFER_INFO::srWindow.Top, CONSOLE_SCREEN_BUFFER_INFO::srWindow.Right, CONSOLE_SCREEN_BUFFER_INFO::srWindow.Bottom); } inline void ConsoleScreenBufferInfo::winRect(const SmallRect &winRect) { CONSOLE_SCREEN_BUFFER_INFO::srWindow.Left=winRect.left(); CONSOLE_SCREEN_BUFFER_INFO::srWindow.Top=winRect.top(); CONSOLE_SCREEN_BUFFER_INFO::srWindow.Right=winRect.right(); CONSOLE_SCREEN_BUFFER_INFO::srWindow.Bottom=winRect.bottom(); } inline Coord ConsoleScreenBufferInfo::maxWinRect(void)const { return Coord(CONSOLE_SCREEN_BUFFER_INFO::dwMaximumWindowSize.X,CONSOLE_SCREEN_BUFFER_INFO::dwMaximumWindowSize.Y); } inline void ConsoleScreenBufferInfo::maxWinRect(const Coord &maxWinRect) { CONSOLE_SCREEN_BUFFER_INFO::dwMaximumWindowSize.X=maxWinRect.x(); CONSOLE_SCREEN_BUFFER_INFO::dwMaximumWindowSize.Y=maxWinRect.y(); } inline void ConsoleScreenBufferInfo::setZero(void) { CONSOLE_SCREEN_BUFFER_INFO::dwSize.X=0; CONSOLE_SCREEN_BUFFER_INFO::dwSize.Y=0; CONSOLE_SCREEN_BUFFER_INFO::dwCursorPosition.X=0; CONSOLE_SCREEN_BUFFER_INFO::dwCursorPosition.Y=0; CONSOLE_SCREEN_BUFFER_INFO::wAttributes=0; CONSOLE_SCREEN_BUFFER_INFO::srWindow.Left=0; CONSOLE_SCREEN_BUFFER_INFO::srWindow.Top=0; CONSOLE_SCREEN_BUFFER_INFO::srWindow.Right=0; CONSOLE_SCREEN_BUFFER_INFO::srWindow.Bottom=0; CONSOLE_SCREEN_BUFFER_INFO::dwMaximumWindowSize.X=0; CONSOLE_SCREEN_BUFFER_INFO::dwMaximumWindowSize.Y=0; } #endif