uiviewport.h

来自「一个PDA GUI系统的源码」· C头文件 代码 · 共 105 行

H
105
字号
#ifndef _UIVIEWPORT_H
#define _UIVIEWPORT_H

#include <pr2k.h>
#include <typedefine.h>
#include <uigui_cfg.h>
#include <uicontrol.h>

#include <kernel/linklist.h>

/**************************************************************
	Viewport style
**************************************************************/
#define VPORT_DEFAULT_STYLE		0

#define VPORT_NONE_BORDER	    2
#define VPORT_BORDER_NONE		2
#define VPORT_H_SCROLLBAR		4
#define VPORT_V_SCROLLBAR		8
#define VPORT_VER				8


#define VPORT_BORDER_SIZE		1

/**************************************************************
	DATA STRUCTURE	
**************************************************************/

typedef struct tagViewport
{
	TGuiControl base;
	
	/* extention attribute */

	// 目前viewport中可视范围的左上角   
	int iCurrentLeft ;
	int iCurrentTop ;
	
	// viewport的宽度以及高度  
	int iVirtualHeight;
	int iVirtualWidth ;

	//the size of one page and one dot,when the scrollbar rolling;
	WORD wVScroll_Page;
	WORD wVScroll_Dot;

	WORD wHScroll_Page;
	WORD wHScroll_Dot;
	
	// 置放於viewport中的widget串列   
	struct dLinkList tControlList ;

	//Can't put these scrollbars into controlList;
	HNDL hHScroll,hVScroll;
} TViewport,TGuiViewport;


/**************************************************************
	FUNCTION DECLARATION	
**************************************************************/
/*	create new Viewport */
DLL_EXP(HNDL) guiViewport_Create( WORD wLeft, WORD wTop,WORD wRight,WORD wBottom,WORD nStyle);

/*	delete viewport */
DLL_EXP(STATUS) guiViewport_Delete( HNDL hVport );

/*	enable viewport */
DLL_EXP(STATUS) guiViewport_Show( HNDL hVport );

//get current position
DLL_EXP(STATUS) guiViewport_GetCurrentPos(HNDL hVport,int *pCurrentLeft,int *pCurrentTop);
/*	change view */
DLL_EXP(STATUS) guiViewport_Move(HNDL hVport,int iNewX,int iNewY) ;


/**************************************************************
// 和viewport中widget有关的function 
**************************************************************/

/*
	将某个control加入vport的control list中
*/
DLL_EXP(STATUS) guiViewport_AddControl(HNDL hVport, HNDL hCtrl) ;
DLL_EXP(STATUS) guiViewport_RemoveControl(HNDL hVprot, HNDL hCtrl);
DLL_EXP(STATUS) guiViewport_DeleteAllControl(HNDL hVport);

//refresh viewport's width and height.
DLL_EXP(STATUS)	guiViewport_Refresh_WH(HNDL hVport);
DLL_EXP(STATUS) guiViewport_MoveControlFromPos(HNDL hVport,WORD wBeginPos,short nSize,WORD wType);


/*
	会将可视区内的widget show出来
*/
DLL_EXP(STATUS) guiViewport_Repaint(HNDL hVport) ;

//modify the size of one page and one dot,when the scrollbar rolling;
//wpage 计数以wDot为单位。
DLL_EXP(STATUS) guiViewport_ModiScroll(HNDL hVport,WORD wPage,WORD wDot,WORD wType);



#endif

⌨️ 快捷键说明

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