code_twain/sane/DlgSetting.h

74 lines
1.7 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
2022-07-01 07:24:58 +00:00
namespace gb
{
class scanner_cfg;
2022-07-01 07:24:58 +00:00
}
class dlg_setting : public dlg_base
{
SANEAPI sane_api_;
SANE_Handle sane_dev_;
bool with_scan_;
unsigned int papers_;
unsigned int images_;
bool err_;
2022-06-21 09:23:26 +00:00
int id_help_;
int id_restore_;
gb::scanner_cfg *cfg_;
std::wstring cfg_file_;
bool *twain_set_;
gb::sane_config_schm* twain_schm_;
bool schm_from_empty_;
HMENU cfg_menu_;
void(__stdcall* apply_scheme_)(gb::sane_config_schm*, void*);
void* apply_param_;
HWND tab_;
#ifdef USE_SOLE_WIN_THREAD
std::unique_ptr<std::thread> thread_;
#endif
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);
2022-06-21 09:23:26 +00:00
BOOL 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);
void save_changes_to_cur_scheme(int reason);
public:
dlg_setting(HWND parent, LPSANEAPI api, SANE_Handle dev, bool with_scan, const wchar_t* name);
~dlg_setting();
public:
void set_config(gb::scanner_cfg* cfg, const wchar_t* file, void(__stdcall* apply)(gb::sane_config_schm*, void*), void* param, bool* twain_set = nullptr);
HWND window(void);
HWND parent(void);
2022-07-01 07:24:58 +00:00
//void show(void);
void hide(void);
void notify_scan_over(void);
std::vector<std::wstring> get_stored_scheme_names(void);
};