📄 guiscroll.h
字号:
#pragma once
#include "GUI.h"
#include "GUIButton.h"
#define SCROLL_CMD_BTN_MIN 0x1
#define SCROLL_CMD_BTN_MAX 0x2
#define SCROLL_CMD_BTN_MOVE 0x3
#define SCROLL_BTN_WIDTH 16
#define SCROLL_BTN_HEIGHT 16
enum SCROLLTYPE
{
SCROLLTYPE_COL = 0, //纵向滚动
SCROLLTYPE_ROW = 1 //横向滚动
};
class GUIScroll :
public GUI
{
public:
GUIScroll(void);
~GUIScroll(void);
public:
enum
{
SCROLLBACK_COL = 0,
SCROLLBACK_ROW = 1
};
enum
{
SCROLL_MINBUTTON = 0,
SCROLL_MAXBUTTON = 1,
SCROLL_MOVEBUTTON = 2,
SCROLL_MOVEBACK = 3
};
static const int SCROLLBACK_COUNT = 4;
static char SCROLLRESNAME[SCROLLBACK_COUNT][MAX_RESNAME];
static void SETRESOURCE(char* min,char* max,char* move,char* back);
protected:
GUIButton* m_pBtnMin;
GUI* m_pScrollBack;
GUIButton* m_pBtnMax;
GUIButton* m_pBtnMove;
protected:
BYTE m_ScrollType; //SCROLLTYPE_COL或者SCROLLTYPE_ROW
float m_Range; //滚动范围
float m_PageRange; //单页范围
float m_LineRange; //单步范围
float m_CurPos; //当前位置
bool m_bMoveBar; //是否开始使用拖动滚动条
GUIPoint m_ptMoveBarOff; //鼠标与滚动条的偏移
GUISize m_BtnSize; //默认按钮大小
public:
bool CreateGUIScroll(char* lpszName,BYTE type,float size,float range,float pagerange,float linerange,float btnwidth,float btnheight,GUI* pParent);
void SetGUIScrollSize(float size);
void ScrollMin();
void ScrollMax();
float GetRange();
float GetPageRange();
float GetLineRange();
float GetCurPos();
void SetRange(float range);
void SetPageRange(float pagerange);
void SetLineRange(float linerange);
void SetCurPos(float curpos);
void UpdataScroll(); ///根据当前位置更新滑动条的位置
public:
virtual void Updata(float dt); ///立即更新
virtual void OnChildMessage(GUI* pChildGUI,UINT iMsg, WPARAM wParam, LPARAM lParam);///子对象发送了命令请求
virtual int OnMouseLButton(float x,float y,bool down); ///左键按下松开(在区域内)
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -