code_production/cfg-tools/apps/scanner-check/page.h

66 lines
2.2 KiB
C
Raw Normal View History

2022-12-09 07:31:09 +00:00
//
#pragma once
#include <string>
#include <utility/known_file.h>
#pragma comment(lib, "base_util.lib")
2023-01-04 10:23:36 +00:00
//#define WM_GET_TEST_ITEM_NAME WM_USER + 100 // WPARAM: (wchar_t*)title, LPARAM: (ITEM*)item
//#define WM_GET_TEST_ITEM_TITLE WM_USER + 101 // WPARAM: (wchar_t*)name, LPARAM: (ITEM*)item
2022-12-09 08:56:15 +00:00
#define WM_TO_ITEM_MGR_TAB WM_USER + 102
#define WM_TEST_ITEM_CHANGED WM_USER + 103
2023-01-04 10:23:36 +00:00
#define WM_REFRESH_TEST_ITEM WM_USER + 104
2023-01-05 01:52:48 +00:00
#define WM_SET_CODE_VER WM_USER + 105 // WPARAM: unused, LPARAM: ver
2022-12-09 07:31:09 +00:00
#include <string>
#include <algorithm>
class page_config
{
public:
page_config()
{}
virtual ~page_config()
{}
typedef struct _item
{
std::wstring name;
std::wstring title;
std::wstring desc;
2022-12-09 07:31:09 +00:00
bool man;
bool fatal;
bool operator==(const wchar_t* t)
{
return title == t;
}
}ITEM;
public:
virtual std::wstring export_config(bool *ok/*return error message if this returned false*/, bool used_in_code = false, int code_ver = 1) = 0;
};
2023-01-04 10:23:36 +00:00
typedef struct _lst_col
{
std::wstring title;
int width;
int align;
}LSTCOL;
2022-12-09 07:31:09 +00:00
extern INTER_MODULE_CALLBACK(got_wstr);
extern INTER_MODULE_CALLBACK(got_str);
2023-01-04 10:23:36 +00:00
extern void init_list_ctrl(CListCtrl* lst, const std::vector<LSTCOL>& cols);
extern std::wstring get_list_item_text(CListCtrl* lst, int item, int col);
extern std::wstring get_list_column_title(CListCtrl* lst, int col);
extern int find_list_item(CListCtrl* lst, const wchar_t* find, int col = 0);
extern int get_list_selected_item(CListCtrl* lst);
extern void select_list_item(CListCtrl* lst, int item);
extern WORD vid_pid_from_hex(const wchar_t* hex, bool* ok);
extern void set_sane_config(known_file_util::IJsonW* sane, known_file_util::IJsonW* cfg, std::wstring& val);
extern void get_sane_config(std::wstring& cfg);
2022-12-09 07:31:09 +00:00
2023-01-04 10:23:36 +00:00
extern void on_combo_param_changed(HWND dlg, CComboBox* param_ctrl, CComboBox* val_ctrl, CListCtrl* lst, UINT edit_id, bool lst_trigger);
extern int add_param(HWND dlg, CComboBox* param_ctrl, CComboBox* val_ctrl, CListCtrl* lst, UINT edit_id);
extern void on_list_param_sel_changed(CComboBox* param_ctrl, CListCtrl* lst, int item, void(*cb_change_notify)(void*), void* param);
extern std::wstring get_window_text(HWND wnd);
extern void replace(std::wstring& str, const wchar_t* now, const wchar_t* to_be);