📄 mginlines.h
字号:
#ifndef _MGINLINES_H_#define _MGINLINES_H_#include <assert.h>#if( _CURRENT_PLATFORM == _PLATFORM_MINIGUI )inline bool MGColor::isValid() const{ return m_name [0] != '\0';}inline void MGColor::setRgb( int r, int g, int b ){ assert( r >= 0 && r < 256 && g >= 0 && g < 256 && b >= 0 && b < 256 ); rgbVal.r = ( BYTE ) r; rgbVal.g = ( BYTE ) g; rgbVal.b = ( BYTE ) b;}inline MGColor& MGColor::operator=( const MGColor& c ){ setRgb( c.rgbVal.r, c.rgbVal.g, c.rgbVal.b ); pixVal = c.pixVal; strncpy( m_name, c.m_name, COLOR_NAME_LEN ); return *this;} inline bool MGColor::operator==( const MGColor& c ) const{ return (isValid () == c.isValid ()) && (pixVal == c.pixVal) && (rgbVal.r == c.rgbVal.r) && (rgbVal.g == c.rgbVal.g) && (rgbVal.b == c.rgbVal.b);}inline bool MGColor::operator!=( const MGColor& c ) const{ return ! operator == (c);}inline int MGColor::red() const{ return rgbVal.r;}inline int MGColor::green() const{ return rgbVal.g;}inline int MGColor::blue() const{ return rgbVal.b;}inline int MGRect::left() const{ return x1;}inline int MGRect::top() const{ return y1;}inline int MGRect::right() const{ return x2;}inline int MGRect::bottom() const{ return y2;}inline int MGRect::x() const{ return x1;}inline int MGRect::y() const{ return y1;}inline int MGRect::width() const{ return x2 - x1 + 1;}inline int MGRect::height() const{ return y2 - y1 + 1;}inline MGSize MGRect::size() const{ return MGSize( x2-x1+1, y2-y1+1 );}inline void MGRect::setWidth( int w ){ x2 = x1 + w - 1;}inline void MGRect::setHeight( int h ){ y2 = y1 + h -1;}inline void MGRect::setLeft( int left ){ x1 = left;}inline void MGRect::setRight( int right ){ x2 = right;}inline void MGRect::setTop( int top ){ y1 = top;}inline void MGRect::setBottom( int bottom ){ y2 = bottom;}inline bool MGRect::isValid() const{ return x1 <= x2 && y1 <= y2;}inline MGSize& MGSize::operator=( const MGSize& s ){ wd = s.wd; ht = s.ht; return *this;}inline bool MGSize::operator==( const MGSize& s ) const{ return wd == s.wd && ht == s.ht;}inline bool MGSize::operator!=( const MGSize& s ) const{ return !operator==( s );}inline int MGSize::width() const{ return wd;}inline int MGSize::height() const{ return ht;}inline void MGSize::setWidth( int w ){ wd = w;}inline void MGSize::setHeight( int h ){ ht = h;}#endif // minigui#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -