doom3-gpl
Doom 3 GPL source release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RollupPanel.h
Go to the documentation of this file.
1 /*
2 ===========================================================================
3 
4 Doom 3 GPL Source Code
5 Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
6 
7 This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
8 
9 Doom 3 Source Code is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13 
14 Doom 3 Source Code is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
21 
22 In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
23 
24 If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
25 
26 ===========================================================================
27 */
28 
29 #ifndef ROLLUPPANEL_H_
30 #define ROLLUPPANEL_H_
31 
32 #define RPITEM_MAX_NAME 64
33 
34 struct RPITEM
35 {
36  HWND mDialog;
37  HWND mButton;
38  HWND mGroupBox;
39  bool mExpanded;
40  bool mEnable;
42  WNDPROC mOldDlgProc;
43  WNDPROC mOldButtonProc;
45 };
46 
48 {
49 public:
50 
51  rvRollupPanel ( void );
52  virtual ~rvRollupPanel ( void );
53 
54  bool Create ( DWORD dwStyle, const RECT& rect, HWND parent, unsigned int id );
55 
56  int InsertItem ( const char* caption, HWND dialog, bool autoDestroy, int index = -1);
57 
58  void RemoveItem ( int index );
59  void RemoveAllItems ( void );
60 
61  void ExpandItem ( int index, bool expand = true );
62  void ExpandAllItems ( bool expand = true );
63 
64  void EnableItem ( int index, bool enabled = true );
65  void EnableAllItems ( bool enable = true );
66 
67  int GetItemCount ( void );
68 
69  RPITEM* GetItem ( int index );
70 
71  int GetItemIndex ( const char* caption );
72  int GetItemIndex ( HWND hwnd );
73 
74  void ScrollToItem ( int index, bool top = true );
75  int MoveItemAt ( int index, int newIndex );
76  bool IsItemExpanded ( int index );
77  bool IsItemEnabled ( int index );
78 
79  HWND GetWindow ( void );
80 
81  void AutoSize ( void );
82 
83 protected:
84 
85  void RecallLayout ( void );
86  void _RemoveItem ( int index );
87  void _ExpandItem ( RPITEM* item, bool expand );
88  void _EnableItem ( RPITEM* item, bool enable );
89 
90  int HandleCommand ( WPARAM wParam, LPARAM lParam );
91  int HandlePaint ( WPARAM wParam, LPARAM lParam );
92  int HandleSize ( WPARAM wParam, LPARAM lParam );
93  int HandleLButtonDown ( WPARAM wParam, LPARAM lParam );
94  int HandleLButtonUp ( WPARAM wParam, LPARAM lParam );
95  int HandleMouseMove ( WPARAM wParam, LPARAM lParam );
96  int HandleMouseWheel ( WPARAM wParam, LPARAM lParam );
97  int HandleMouseActivate ( WPARAM wParam, LPARAM lParam );
98  int HandleContextMenu ( WPARAM wParam, LPARAM lParam );
99 
100  // Datas
106  HWND mWindow;
107 
108  // Window proc
109  static LRESULT CALLBACK WindowProc ( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
110  static LRESULT CALLBACK DialogProc ( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
111  static LRESULT CALLBACK ButtonProc ( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
112 
113  static LRESULT FAR PASCAL GetMsgProc ( int nCode, WPARAM wParam, LPARAM lParam );
115  static HHOOK mDialogHook;
116 };
117 
118 ID_INLINE int rvRollupPanel::GetItemCount ( void )
119 {
120  return mItems.Num();
121 }
122 
123 ID_INLINE bool rvRollupPanel::IsItemExpanded ( int index )
124 {
125  if ( index >= mItems.Num() || index < 0 )
126  {
127  return false;
128  }
129  return mItems[index]->mExpanded;
130 }
131 
132 ID_INLINE bool rvRollupPanel::IsItemEnabled( int index )
133 {
134  if ( index >= mItems.Num() || index < 0 )
135  {
136  return false;
137  }
138  return mItems[index]->mEnable;
139 }
140 
141 ID_INLINE HWND rvRollupPanel::GetWindow ( void )
142 {
143  return mWindow;
144 }
145 
146 #endif // ROLLUPPANEL_H_
bool mEnable
Definition: RollupPanel.h:40
HWND mGroupBox
Definition: RollupPanel.h:38
bool IsItemExpanded(int index)
Definition: RollupPanel.h:123
char mCaption[RPITEM_MAX_NAME]
Definition: RollupPanel.h:44
void RecallLayout(void)
HWND mButton
Definition: RollupPanel.h:37
int HandleLButtonDown(WPARAM wParam, LPARAM lParam)
HWND GetWindow(void)
Definition: RollupPanel.h:141
#define RPITEM_MAX_NAME
Definition: RollupPanel.h:32
void ExpandItem(int index, bool expand=true)
bool mExpanded
Definition: RollupPanel.h:39
int InsertItem(const char *caption, HWND dialog, bool autoDestroy, int index=-1)
void _EnableItem(RPITEM *item, bool enable)
int HandlePaint(WPARAM wParam, LPARAM lParam)
bool mAutoDestroy
Definition: RollupPanel.h:41
int HandleMouseMove(WPARAM wParam, LPARAM lParam)
CONST PIXELFORMATDESCRIPTOR UINT
Definition: win_qgl.cpp:47
void EnableItem(int index, bool enabled=true)
void RemoveItem(int index)
static LRESULT CALLBACK DialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
void EnableAllItems(bool enable=true)
DWORD
Definition: win_qgl.cpp:61
static LRESULT FAR PASCAL GetMsgProc(int nCode, WPARAM wParam, LPARAM lParam)
void _ExpandItem(RPITEM *item, bool expand)
virtual ~rvRollupPanel(void)
Definition: RollupPanel.cpp:74
void AutoSize(void)
static LRESULT CALLBACK ButtonProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
rvRollupPanel(void)
Definition: RollupPanel.cpp:60
static LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
int GetItemCount(void)
Definition: RollupPanel.h:118
int HandleMouseActivate(WPARAM wParam, LPARAM lParam)
int HandleMouseWheel(WPARAM wParam, LPARAM lParam)
static HHOOK mDialogHook
Definition: RollupPanel.h:115
idList< RPITEM * > mItems
Definition: RollupPanel.h:101
GLuint index
Definition: glext.h:3476
HWND mDialog
Definition: RollupPanel.h:36
WNDPROC mOldDlgProc
Definition: RollupPanel.h:42
static idList< HWND > mDialogs
Definition: RollupPanel.h:114
#define FAR
Definition: jmorecfg.h:205
int HandleContextMenu(WPARAM wParam, LPARAM lParam)
bool Create(DWORD dwStyle, const RECT &rect, HWND parent, unsigned int id)
Definition: RollupPanel.cpp:90
GLdouble GLdouble GLdouble top
Definition: qgl.h:273
int HandleCommand(WPARAM wParam, LPARAM lParam)
int MoveItemAt(int index, int newIndex)
int Num(void) const
Definition: List.h:265
int HandleSize(WPARAM wParam, LPARAM lParam)
int GetItemIndex(const char *caption)
void ExpandAllItems(bool expand=true)
void _RemoveItem(int index)
RPITEM * GetItem(int index)
void RemoveAllItems(void)
void ScrollToItem(int index, bool top=true)
bool IsItemEnabled(int index)
Definition: RollupPanel.h:132
int HandleLButtonUp(WPARAM wParam, LPARAM lParam)
WNDPROC mOldButtonProc
Definition: RollupPanel.h:43