No empty .Rs/.Re
[netbsd-mini2440.git] / sys / arch / hpc / stand / hpcboot / menu / tabwindow.h
blob7f771277241fb5d0a618a9ada5bfe997a34aa29a
1 /* -*-C++-*- $NetBSD: tabwindow.h,v 1.5 2005/12/11 12:17:28 christos Exp $ */
3 /*-
4 * Copyright (c) 2001 The NetBSD Foundation, Inc.
5 * All rights reserved.
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by UCHIYAMA Yasushi.
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.
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.
32 #ifndef _HPCBOOT_TABWINDOW_H_
33 #define _HPCBOOT_TABWINDOW_H_
35 class TabWindow;
37 class TabWindowBase : public Window {
38 public:
39 RECT _rect;
40 int _id;
42 private:
43 void _load_bitmap(HIMAGELIST, const TCHAR *);
45 public:
46 explicit TabWindowBase(HpcBootApp &app, HWND parent,
47 RECT &rect, int id)
48 : Window(app, parent) {
49 _rect = rect;
50 _id = id;
52 virtual ~TabWindowBase(void) { /* NO-OP */ }
54 static LRESULT CALLBACK
55 _tab_proc(HWND h, UINT msg, WPARAM param, LPARAM lparam);
56 virtual BOOL create(LPCREATESTRUCT aux);
58 BOOL focusManagerHook(WORD, UINT, HWND);
60 // setup child instance.
61 TabWindow *boot(int id);
63 // insert child dialog to me.
64 void insert(int id, TC_ITEM &item) {
65 TabCtrl_InsertItem(_window, id, &item);
67 // return tab-control region.
68 void adjust(RECT &rect) {
69 TabCtrl_AdjustRect(_window, FALSE, &rect);
73 class TabWindow : public Window
75 public:
76 TabWindowBase &_base;
77 RECT _rect;
78 int _id;
80 protected:
81 const TCHAR *_name;
83 explicit TabWindow(TabWindowBase &base, int id, const TCHAR *name)
84 : Window(base._app, base._window), _base(base), _name(name) {
85 _rect = _base._rect;
86 _id = id;
89 // utility for check box and radio button.
90 BOOL _is_checked(int id);
91 void _set_check(int id, BOOL onoff);
93 public:
94 virtual ~TabWindow(void) { /* NO-OP */ }
96 virtual BOOL proc(HWND w, UINT msg, WPARAM wparam, LPARAM lparam);
97 virtual BOOL create(LPCREATESTRUCT unused);
98 virtual void init(HWND w);
99 virtual void command(int id, int msg) { /* NO-OP */ }
101 // adjust my dialog size to tab-control
102 void adjust(void) {
103 MoveWindow(_window, _rect.left, 0, _rect.right - _rect.left,
104 _rect.bottom - _rect.top, TRUE);
106 virtual void hide(void) {
107 ShowWindow(_window, SW_HIDE);
109 virtual void show(void) {
110 adjust();
111 ShowWindow(_window, SW_SHOW);
113 void update(void) {
114 InvalidateRect(_window, &_rect, TRUE);
117 #endif // _HPCBOOT_TABWINDOW_H_