!19 Refactor wnd, add HelloWidgets

This commit is contained in:
idea4good
2019-05-24 10:20:40 +08:00
committed by Gitee
parent ef7e8f8b70
commit c38b8b0cf1
62 changed files with 265 additions and 347 deletions

34
widgets_include/button.h Normal file
View File

@@ -0,0 +1,34 @@
#ifndef BUTTON_H
#define BUTTON_H
#define GL_BN_CLICKED 0x1111
#define ON_GL_BN_CLICKED(ctrlId, func) \
{MSG_TYPE_WND, GL_BN_CLICKED, (c_cmd_target*)ctrlId, MSG_CALLBACK_VWV, (MsgFuncVV)(static_cast<void (c_cmd_target::*)(unsigned int)>(&func))},
typedef struct struct_bitmap_info BITMAP_INFO;
class c_button : public c_wnd
{
public:
virtual const char* get_class_name() const {return "c_button";}
virtual c_wnd* clone(){return new c_button();}
void set_bitmap(const BITMAP_INFO *pBitmap) { m_bitmap_normal = pBitmap; }
void set_focus_bitmap(const BITMAP_INFO *pBitmap) { m_bitmap_focus = pBitmap; }
void set_pushed_bitmap(const BITMAP_INFO *pBitmap) { m_bitmap_pushed = pBitmap; }
void set_disable_bitmap(const BITMAP_INFO *pBitmap) { m_bitmap_disable = pBitmap; }
protected:
virtual void on_paint();
virtual void on_focus();
virtual void on_kill_focus();
virtual void pre_create_wnd();
virtual bool on_touch(int x, int y, TOUCH_ACTION action);
virtual bool on_key(KEY_TYPE key);
const BITMAP_INFO* m_bitmap_normal;
const BITMAP_INFO* m_bitmap_focus;
const BITMAP_INFO* m_bitmap_pushed;
const BITMAP_INFO* m_bitmap_disable;
};
#endif