mirror of
https://github.com/lc-soft/LCUI.git
synced 2026-11-30 16:48:21 +01:00
添加widget类的部分代码
This commit is contained in:
@@ -43,6 +43,108 @@
|
||||
#define __LCUI_WIDGET_HPP__
|
||||
|
||||
#ifdef __cplusplus
|
||||
class LCUIWidget
|
||||
{
|
||||
public:
|
||||
LCUIWidget( const char* widget_type );
|
||||
~LCUIWidget(void);
|
||||
|
||||
LCUI_Widget *getWidget( void );
|
||||
LCUI_Size getSize( void );
|
||||
int getHeight( void );
|
||||
int getWidth( void );
|
||||
LCUI_Rect getRect( void );
|
||||
LCUI_Pos getPos( void );
|
||||
void *getPrivateData( void );
|
||||
int InvalidateArea( LCUI_Rect );
|
||||
void show( LCUI_BOOL );
|
||||
void enable( LCUI_BOOL );
|
||||
void modal( LCUI_BOOL );
|
||||
void move( LCUI_Pos );
|
||||
void resize( LCUI_Size );
|
||||
void dock( DOCK_TYPE );
|
||||
protected:
|
||||
LCUI_Widget *widget;
|
||||
};
|
||||
|
||||
LCUIWidget::LCUIWidget( const char *widget_type )
|
||||
{
|
||||
widget = Widget_New( widget_type );
|
||||
}
|
||||
|
||||
LCUIWidget::~LCUIWidget(void)
|
||||
{
|
||||
Widget_Destroy( widget );
|
||||
}
|
||||
|
||||
LCUI_Widget *LCUIWidget::getWidget( void )
|
||||
{
|
||||
return widget;
|
||||
}
|
||||
|
||||
LCUI_Size LCUIWidget::getSize( void )
|
||||
{
|
||||
return Widget_GetSize( widget );
|
||||
}
|
||||
|
||||
int LCUIWidget::getHeight( void )
|
||||
{
|
||||
return Widget_GetHeight( widget );
|
||||
}
|
||||
|
||||
int LCUIWidget::getWidth( void )
|
||||
{
|
||||
return Widget_GetWidth( widget );
|
||||
}
|
||||
|
||||
LCUI_Rect LCUIWidget::getRect( void )
|
||||
{
|
||||
return Widget_GetRect( widget );
|
||||
}
|
||||
|
||||
LCUI_Pos LCUIWidget::getPos( void )
|
||||
{
|
||||
return Widget_GetPos( widget );
|
||||
}
|
||||
|
||||
void *LCUIWidget::getPrivateData( void )
|
||||
{
|
||||
return Widget_GetPrivData( widget );
|
||||
}
|
||||
|
||||
int LCUIWidget::InvalidateArea( LCUI_Rect area )
|
||||
{
|
||||
return Widget_InvalidArea( widget, area );
|
||||
}
|
||||
|
||||
void LCUIWidget::show( LCUI_BOOL need_show )
|
||||
{
|
||||
if(need_show) {
|
||||
Widget_Show( widget );
|
||||
} else {
|
||||
Widget_Hide( widget );
|
||||
}
|
||||
}
|
||||
|
||||
void LCUIWidget::modal( LCUI_BOOL is_modal )
|
||||
{
|
||||
Widget_SetModal( widget, is_modal );
|
||||
}
|
||||
|
||||
void LCUIWidget::dock( DOCK_TYPE dock_type )
|
||||
{
|
||||
Widget_SetDock( widget, dock_type );
|
||||
}
|
||||
|
||||
void LCUIWidget::move( LCUI_Pos new_pos )
|
||||
{
|
||||
Widget_Move( widget, new_pos );
|
||||
}
|
||||
|
||||
void LCUIWidget::resize( LCUI_Size new_size )
|
||||
{
|
||||
Widget_Resize( widget, new_size );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* ***************************************************************************
|
||||
/* ***************************************************************************
|
||||
* window.h -- C++ class and function for window widget
|
||||
*
|
||||
* Copyright (C) 2013 by
|
||||
@@ -21,29 +21,52 @@
|
||||
* ****************************************************************************/
|
||||
|
||||
/* ****************************************************************************
|
||||
* window.h -- 窗口部件的C++类和函数
|
||||
* window.h -- 窗口部件的C++类和函数
|
||||
*
|
||||
* 版权所有 (C) 2013 归属于
|
||||
* 刘超
|
||||
* 版权所有 (C) 2013 归属于
|
||||
* 刘超
|
||||
*
|
||||
* 这个文件是LCUI项目的一部分,并且只可以根据GPLv2许可协议来使用、更改和发布。
|
||||
* 这个文件是LCUI项目的一部分,并且只可以根据GPLv2许可协议来使用、更改和发布。
|
||||
*
|
||||
* (GPLv2 是 GNU通用公共许可证第二版 的英文缩写)
|
||||
* (GPLv2 是 GNU通用公共许可证第二版 的英文缩写)
|
||||
*
|
||||
* 继续使用、修改或发布本文件,表明您已经阅读并完全理解和接受这个许可协议。
|
||||
* 继续使用、修改或发布本文件,表明您已经阅读并完全理解和接受这个许可协议。
|
||||
*
|
||||
* LCUI 项目是基于使用目的而加以散布的,但不负任何担保责任,甚至没有适销性或特
|
||||
* 定用途的隐含担保,详情请参照GPLv2许可协议。
|
||||
* LCUI 项目是基于使用目的而加以散布的,但不负任何担保责任,甚至没有适销性或特
|
||||
* 定用途的隐含担保,详情请参照GPLv2许可协议。
|
||||
*
|
||||
* 您应已收到附随于本文件的GPLv2许可协议的副本,它通常在LICENSE.TXT文件中,如果
|
||||
* 没有,请查看:<http://www.gnu.org/licenses/>.
|
||||
* 您应已收到附随于本文件的GPLv2许可协议的副本,它通常在LICENSE.TXT文件中,如果
|
||||
* 没有,请查看:<http://www.gnu.org/licenses/>.
|
||||
* ****************************************************************************/
|
||||
#ifndef __LCUI_WINDOW_HPP_
|
||||
#define __LCUI_WINDOW_HPP_
|
||||
|
||||
/* LCUIWindow类继承自LCUIWidget类 */
|
||||
class LCUIWindow:public LCUIWidget
|
||||
{
|
||||
public:
|
||||
LCUIWindow(void):LCUIWidget("window"){;};
|
||||
void setTitleIcon( LCUI_Graph* );
|
||||
//void setTitleIcon( LCUIGraph & );
|
||||
void setTitleText( const char* );
|
||||
void setTitleTextW( const wchar_t *);
|
||||
void addToTitleBar( LCUIWidget& );
|
||||
void addToClientArea( LCUIWidget& );
|
||||
};
|
||||
|
||||
void LCUIWindow::setTitleIcon( LCUI_Graph *icon )
|
||||
{
|
||||
Window_SetTitleIcon( widget, icon );
|
||||
}
|
||||
|
||||
void LCUIWindow::setTitleText( const char *text )
|
||||
{
|
||||
Window_SetTitleText( widget, text );
|
||||
}
|
||||
|
||||
void LCUIWindow::setTitleTextW( const wchar_t *text )
|
||||
{
|
||||
Window_SetTitleTextW( widget, text );
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user