77 lines
2.0 KiB
C
77 lines
2.0 KiB
C
|
#pragma once
|
|||
|
|
|||
|
#include <Windows.h>
|
|||
|
#include <CommCtrl.h>
|
|||
|
#include <string>
|
|||
|
#include <vector>
|
|||
|
#include <sane/sane_ex.h>
|
|||
|
#include <sane/sane_option_definitions.h>
|
|||
|
|
|||
|
// CDlgIndicator 对话框
|
|||
|
#define WM_REFRESH_OPTION WM_USER + 111 // WPARAM: source option SN, LPARAM: unused now
|
|||
|
|
|||
|
extern HMODULE g_my_inst;
|
|||
|
|
|||
|
class dlg_base
|
|||
|
{
|
|||
|
protected:
|
|||
|
HWND hwnd_;
|
|||
|
HWND parent_;
|
|||
|
UINT idd_;
|
|||
|
|
|||
|
static std::wstring prop_name;
|
|||
|
static BOOL CALLBACK dlg_proc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp);
|
|||
|
|
|||
|
virtual BOOL handle_message(UINT msg, WPARAM wp, LPARAM lp);
|
|||
|
virtual void on_font_changed(void);
|
|||
|
void create(void);
|
|||
|
|
|||
|
public:
|
|||
|
dlg_base(HWND parent, UINT idd);
|
|||
|
virtual ~dlg_base();
|
|||
|
|
|||
|
static bool get_max_size(SIZE& dst, const SIZE& src); // return whether changed dst
|
|||
|
static bool get_max_size(SIZE& dst, int cx, int cy); // return whether changed dst
|
|||
|
|
|||
|
public:
|
|||
|
HWND hwnd(void);
|
|||
|
void screen_2_client(LPRECT r);
|
|||
|
void client_2_screen(LPRECT r);
|
|||
|
HWND get_item(UINT id);
|
|||
|
BOOL set_font(HFONT font);
|
|||
|
HFONT get_font(void);
|
|||
|
};
|
|||
|
|
|||
|
class dlg_page : public dlg_base
|
|||
|
{
|
|||
|
std::wstring name_;
|
|||
|
SIZE size_;
|
|||
|
SIZE font_size_;
|
|||
|
UINT ctrl_id_;
|
|||
|
POINT pos_;
|
|||
|
|
|||
|
static UINT dyn_id_base;
|
|||
|
static int gap_x;
|
|||
|
static int gap_y;
|
|||
|
|
|||
|
BOOL handle_message(UINT msg, WPARAM wp, LPARAM lp) override;
|
|||
|
void on_font_changed(void) override;
|
|||
|
void refresh_font(void);
|
|||
|
bool create_control_bool(int sn, const SANE_Option_Descriptor* desc, void* cur_val);
|
|||
|
bool create_control_int(int sn, const SANE_Option_Descriptor* desc, void* cur_val);
|
|||
|
bool create_control_float(int sn, const SANE_Option_Descriptor* desc, void* cur_val);
|
|||
|
bool create_control_string(int sn, const SANE_Option_Descriptor* desc, void* cur_val);
|
|||
|
bool create_control_button(int sn, const SANE_Option_Descriptor* desc, void* cur_val);
|
|||
|
|
|||
|
public:
|
|||
|
dlg_page(HWND parent, const wchar_t* name);
|
|||
|
~dlg_page();
|
|||
|
|
|||
|
public:
|
|||
|
bool add_control(int sn, const SANE_Option_Descriptor* desc, void* cur_val);
|
|||
|
SIZE desired_size(void);
|
|||
|
void show(void);
|
|||
|
void hide(void);
|
|||
|
const wchar_t* name(void);
|
|||
|
};
|