xref: /netbsd-src/sys/arch/hpc/stand/hpcboot/menu/menu.h (revision ce099b40997c43048fb78bd578195f81d2456523)
1 /* -*-C++-*-	$NetBSD: menu.h,v 1.6 2008/04/28 20:23:20 martin Exp $	*/
2 
3 /*-
4  * Copyright (c) 2001 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by UCHIYAMA Yasushi.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 class MainTabWindow : public TabWindow
33 {
34 private:
35 	HWND _edit_md_root;
36 	HWND _combobox_serial_speed;
37 
38 	struct PlatMap {
39 		int id;		// index in platid_name_table
40 		TCHAR *name;	// platform name
41 	};
42 
43 	struct PlatMap *_platmap;
44 	void _sort_platids(HWND w);
45 	int _item_to_platid(int idx);
46 	static int _platcmp(const void *, const void *);
47 
48 	int _item_idx;
49 	void _insert_item(HWND w, TCHAR *name, int id);
50 public:
MainTabWindow(TabWindowBase & base,int id)51 	explicit MainTabWindow(TabWindowBase &base, int id)
52 		: TabWindow(base, id, TEXT("WMain")) {
53 		_item_idx = 0;
54 	}
~MainTabWindow(void)55 	virtual ~MainTabWindow(void) { /* NO-OP */ }
56 	virtual void init(HWND w);
57 	virtual void command(int id, int msg);
58 	void get(void);
59 
60 	// control layouter.
61 	void layout(void);
62 };
63 
64 class OptionTabWindow : public TabWindow
65 {
66 public:
67 	HWND _spin_edit;
68 	HWND _spin;
69 #define	IS_CHECKED(x)	_is_checked(IDC_OPT_##x)
70 #define	SET_CHECK(x, b)	_set_check(IDC_OPT_##x,(b))
71 
72 public:
OptionTabWindow(TabWindowBase & base,int id)73 	explicit OptionTabWindow(TabWindowBase &base, int id)
74 		: TabWindow(base, id, TEXT("WOption")) {
75 		_spin_edit = NULL;
76 		_spin = NULL;
77 	}
~OptionTabWindow(void)78 	virtual ~OptionTabWindow(void) { /* NO-OP */ }
79 	virtual void init(HWND w);
80 	virtual void command(int id, int msg);
81 	void get(void);
82 };
83 
84 class ConsoleTabWindow : public TabWindow
85 {
86 private:
87 	HWND _filename_edit;
88 	BOOL _filesave;
89 	HANDLE _logfile;
90 	BOOL _open_log_file(void);
91 public:
92 	HWND _edit;
93 
94 public:
ConsoleTabWindow(TabWindowBase & base,int id)95 	explicit ConsoleTabWindow(TabWindowBase &base, int id)
96 		: TabWindow(base, id, TEXT("WConsole")) {
97 		_edit = NULL;
98 		_logfile = INVALID_HANDLE_VALUE;
99 	}
~ConsoleTabWindow(void)100 	virtual ~ConsoleTabWindow(void) {
101 		if (_logfile != INVALID_HANDLE_VALUE)
102 			CloseHandle(_logfile);
103 	}
104 	virtual void init(HWND);
105 	virtual void command(int, int);
106 
107 	void print(TCHAR *buf, BOOL = FALSE);
108 };
109 
110 __BEGIN_DECLS
111 BOOL _find_pref_dir(TCHAR *);
112 __END_DECLS
113