code_twain/sane/DlgSetting.h

60 lines
1.4 KiB
C
Raw Normal View History

#pragma once
#include <Windows.h>
#include <string>
#include <vector>
#include <sane/sane_ex.h>
#include "DlgPage.h"
// CDlgIndicator 对话框
//#define USE_SOLE_WIN_THREAD
#ifdef USE_SOLE_WIN_THREAD
#include <thread>
#include <memory>
#endif
class dlg_setting : public dlg_base
{
SANEAPI sane_api_;
SANE_Handle sane_dev_;
bool with_scan_;
unsigned int papers_;
unsigned int images_;
bool err_;
HWND tab_;
#ifdef USE_SOLE_WIN_THREAD
std::unique_ptr<std::thread> thread_;
#endif
void(__stdcall* notify_)(bool, void*);
void* notify_param_;
BOOL handle_message(UINT msg, WPARAM wp, LPARAM lp) override;
void handle_command(WORD code, WORD id, HANDLE ctrl);
void notify_over(void);
void on_init_dialog(void);
void on_notify(int ctrl_id, LPNMHDR pnmh);
int get_tab_count(void);
dlg_page* add_tab(const char* utf8_title);
dlg_page* get_page(int index);
dlg_page* get_page(const char* utf8_title);
dlg_page* select_page(int index);
void refresh_controls(int src_sn);
public:
dlg_setting(HWND parent, LPSANEAPI api, SANE_Handle dev, bool with_scan, const wchar_t* name);
~dlg_setting();
public:
void set_quit_notify(void(__stdcall* notify)(bool cancel, void*), void* param);
HWND window(void);
HWND parent(void);
void show(void);
void hide(void);
void notify_data_arrived(bool image);
void notify_scan_over(const char* msg, bool err);
};