xref: /netbsd-src/sys/arch/hpc/stand/hpcboot/menu/menu.h (revision d48f14661dda8638fee055ba15d35bdfb29b9fa8)
1 /* -*-C++-*-	$NetBSD: menu.h,v 1.5 2005/12/11 12:17:28 christos 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  * 3. All advertising materials mentioning features or use of this software
19  *    must display the following acknowledgement:
20  *        This product includes software developed by the NetBSD
21  *        Foundation, Inc. and its contributors.
22  * 4. Neither the name of The NetBSD Foundation nor the names of its
23  *    contributors may be used to endorse or promote products derived
24  *    from this software without specific prior written permission.
25  *
26  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36  * POSSIBILITY OF SUCH DAMAGE.
37  */
38 
39 class MainTabWindow : public TabWindow
40 {
41 private:
42 	HWND _edit_md_root;
43 	HWND _combobox_serial_speed;
44 
45 	struct PlatMap {
46 		int id;		// index in platid_name_table
47 		TCHAR *name;	// platform name
48 	};
49 
50 	struct PlatMap *_platmap;
51 	void _sort_platids(HWND w);
52 	int _item_to_platid(int idx);
53 	static int _platcmp(const void *, const void *);
54 
55 	int _item_idx;
56 	void _insert_item(HWND w, TCHAR *name, int id);
57 public:
58 	explicit MainTabWindow(TabWindowBase &base, int id)
59 		: TabWindow(base, id, TEXT("WMain")) {
60 		_item_idx = 0;
61 	}
62 	virtual ~MainTabWindow(void) { /* NO-OP */ }
63 	virtual void init(HWND w);
64 	virtual void command(int id, int msg);
65 	void get(void);
66 
67 	// control layouter.
68 	void layout(void);
69 };
70 
71 class OptionTabWindow : public TabWindow
72 {
73 public:
74 	HWND _spin_edit;
75 	HWND _spin;
76 #define	IS_CHECKED(x)	_is_checked(IDC_OPT_##x)
77 #define	SET_CHECK(x, b)	_set_check(IDC_OPT_##x,(b))
78 
79 public:
80 	explicit OptionTabWindow(TabWindowBase &base, int id)
81 		: TabWindow(base, id, TEXT("WOption")) {
82 		_spin_edit = NULL;
83 		_spin = NULL;
84 	}
85 	virtual ~OptionTabWindow(void) { /* NO-OP */ }
86 	virtual void init(HWND w);
87 	virtual void command(int id, int msg);
88 	void get(void);
89 };
90 
91 class ConsoleTabWindow : public TabWindow
92 {
93 private:
94 	HWND _filename_edit;
95 	BOOL _filesave;
96 	HANDLE _logfile;
97 	BOOL _open_log_file(void);
98 public:
99 	HWND _edit;
100 
101 public:
102 	explicit ConsoleTabWindow(TabWindowBase &base, int id)
103 		: TabWindow(base, id, TEXT("WConsole")) {
104 		_edit = NULL;
105 		_logfile = INVALID_HANDLE_VALUE;
106 	}
107 	virtual ~ConsoleTabWindow(void) {
108 		if (_logfile != INVALID_HANDLE_VALUE)
109 			CloseHandle(_logfile);
110 	}
111 	virtual void init(HWND);
112 	virtual void command(int, int);
113 
114 	void print(TCHAR *buf, BOOL = FALSE);
115 };
116 
117 __BEGIN_DECLS
118 BOOL _find_pref_dir(TCHAR *);
119 __END_DECLS
120