1 /* -*-C++-*- $NetBSD: tabwindow.h,v 1.5 2005/12/11 12:17:28 christos Exp $ */
4 * Copyright (c) 2001 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
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_
37 class TabWindowBase
: public Window
{
43 void _load_bitmap(HIMAGELIST
, const TCHAR
*);
46 explicit TabWindowBase(HpcBootApp
&app
, HWND parent
,
48 : Window(app
, parent
) {
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
83 explicit TabWindow(TabWindowBase
&base
, int id
, const TCHAR
*name
)
84 : Window(base
._app
, base
._window
), _base(base
), _name(name
) {
89 // utility for check box and radio button.
90 BOOL
_is_checked(int id
);
91 void _set_check(int id
, BOOL onoff
);
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
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) {
111 ShowWindow(_window
, SW_SHOW
);
114 InvalidateRect(_window
, &_rect
, TRUE
);
117 #endif // _HPCBOOT_TABWINDOW_H_