2 ===========================================================================
5 Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
7 This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
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.
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.
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/>.
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.
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.
26 ===========================================================================
29 #include "../../idlib/precompiled.h"
32 #include "../../sys/win32/win_local.h"
33 #include "RollupPanel.h"
35 // Based on original code by Johann Nadalutti
37 #define RP_PGBUTTONHEIGHT 18
38 #define RP_SCROLLBARWIDTH 6
39 #define RP_GRPBOXINDENT 6
40 #define RP_SCROLLBARCOLOR RGB(150,180,180)
41 #define RP_ROLLCURSOR MAKEINTRESOURCE(32649) // see IDC_HAND (WINVER >= 0x0500)
44 #define RP_IDM_EXPANDALL 0x100
45 #define RP_IDM_COLLAPSEALL 0x101
46 #define RP_IDM_STARTITEMS 0x102
48 idList<HWND> rvRollupPanel::mDialogs;
49 HHOOK rvRollupPanel::mDialogHook = NULL;
55 rvRollupPanel::rvRollupPanel
60 rvRollupPanel::rvRollupPanel ( void )
69 rvRollupPanel::~rvRollupPanel
74 rvRollupPanel::~rvRollupPanel ( void )
77 for ( ; mItems.Num(); )
87 Create the rollup panel window
90 bool rvRollupPanel::Create ( DWORD dwStyle, const RECT& rect, HWND parent, unsigned int id )
93 memset ( &wndClass, 0, sizeof(wndClass) );
94 wndClass.cbSize = sizeof(WNDCLASSEX);
95 wndClass.lpszClassName = "ROLLUP_PANEL";
96 wndClass.lpfnWndProc = WindowProc;
97 wndClass.hbrBackground = (HBRUSH)GetSysColorBrush ( COLOR_3DFACE );
98 wndClass.hCursor = LoadCursor((HINSTANCE) NULL, IDC_ARROW);
99 wndClass.lpszMenuName = NULL;
100 wndClass.hInstance = win32.hInstance;
101 wndClass.style = CS_VREDRAW | CS_HREDRAW;
102 RegisterClassEx ( &wndClass );
104 mWindow = CreateWindowEx ( WS_EX_TOOLWINDOW,
107 dwStyle|WS_CLIPSIBLINGS,
108 rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top,
124 rvRollupPanel::InsertItem
126 Insert and item into the rollup panel. Return -1 if an error occured
129 int rvRollupPanel::InsertItem ( const char* caption, HWND dialog, bool autoDestroy, int index )
134 // -1 means add to the end
135 if ( index > 0 && index >= mItems.Num() )
142 GetClientRect(mWindow,&r);
144 // Create the GroupBox control
145 HWND groupbox = CreateWindow ( "BUTTON", "", WS_CHILD|BS_GROUPBOX,
146 r.left, r.top, r.right-r.left, r.bottom-r.top,
147 mWindow, 0, win32.hInstance, NULL );
149 // Create the expand button
150 HWND button = CreateWindow ( "BUTTON", caption, WS_CHILD|BS_AUTOCHECKBOX|BS_PUSHLIKE|BS_FLAT,
151 r.left, r.top, r.right-r.left, r.bottom-r.top,
152 mWindow, 0, win32.hInstance, NULL );
154 // Change the button's font
155 SendMessage ( button, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0 );
157 // Add item to the item list
158 RPITEM* item = new RPITEM;
159 item->mExpanded = false;
160 item->mEnable = true;
161 item->mDialog = dialog;
162 item->mButton = button;
163 item->mGroupBox = groupbox;
164 item->mOldDlgProc = (WNDPROC) GetWindowLong ( dialog, DWL_DLGPROC );
165 item->mOldButtonProc = (WNDPROC) GetWindowLong ( button, GWL_WNDPROC );
166 item->mAutoDestroy = autoDestroy;
167 strcpy ( item->mCaption, caption );
171 index = mItems.Append ( item );
175 mItems.Insert ( item, index );
178 // Store data with the dialog window in its user data
179 SetWindowLong ( dialog, GWL_USERDATA, (LONG)item );
181 // Attach item to button through user data
182 SetWindowLong ( button, GWL_USERDATA, (LONG)item );
183 SetWindowLong ( button, GWL_ID, index );
186 SetWindowLong ( dialog, DWL_DLGPROC, (LONG)DialogProc );
189 SetWindowLong ( button, GWL_WNDPROC, (LONG)ButtonProc );
192 mItemHeight += RP_PGBUTTONHEIGHT+(RP_GRPBOXINDENT/2);
195 // One hook for all panel dialogs
198 mDialogHook = SetWindowsHookEx( WH_GETMESSAGE, GetMsgProc, NULL, GetCurrentThreadId() );
201 mDialogs.Append ( dialog );
208 rvRollupPanel::RemoveItem
210 Remove the item at the given index from the rollup panel
213 void rvRollupPanel::RemoveItem ( int index )
216 if ( index >= mItems.Num() || index < 0 )
222 _RemoveItem( index );
230 rvRollupPanel::RemoveAllItems
232 Remove all items from the control
235 void rvRollupPanel::RemoveAllItems()
237 for ( ; mItems.Num(); )
248 rvRollupPanel::_RemoveItem
250 called by RemoveItem and RemoveAllItems methods to acutally remove the item
253 void rvRollupPanel::_RemoveItem ( int index )
255 RPITEM* item = mItems[index];
259 GetWindowRect ( item->mDialog, &ir );
261 // update item height
262 mItemHeight -= RP_PGBUTTONHEIGHT+(RP_GRPBOXINDENT/2);
263 if ( item->mExpanded )
265 mItemHeight -= (ir.bottom-ir.top);
271 DestroyWindow ( item->mButton );
273 if ( item->mGroupBox )
275 DestroyWindow ( item->mGroupBox );
277 if ( item->mDialog && item->mAutoDestroy )
279 DestroyWindow ( item->mDialog );
280 mDialogs.Remove ( item->mDialog );
283 if ( mDialogs.Num () <= 0 )
285 UnhookWindowsHookEx( mDialogHook );
290 mItems.RemoveIndex ( index );
296 rvRollupPanel::ExpandItem
298 expand or collapse the item at the given index
301 void rvRollupPanel::ExpandItem( int index, bool expand )
304 if ( index >= mItems.Num() || index < 0 )
309 _ExpandItem ( mItems[index], expand );
313 // scroll to this page (automatic page visibility)
316 ScrollToItem ( index, false );
322 rvRollupPanel::ExpandItem
324 expand or collapse the item at the given index
327 void rvRollupPanel::ExpandAllItems( bool expand )
332 for ( i=0; i < mItems.Num(); i ++ )
334 _ExpandItem ( mItems[i], expand );
342 rvRollupPanel::ExpandItem
344 expand or collapse the item at the given index
347 void rvRollupPanel::_ExpandItem ( RPITEM* item, bool expand )
349 // check if we need to change state
350 if ( item->mExpanded == expand || !item->mEnable )
356 GetWindowRect ( item->mDialog, &ir );
359 item->mExpanded = expand;
363 mItemHeight += (ir.bottom - ir.top);
367 mItemHeight -= (ir.bottom - ir.top);
373 rvRollupPanel::EnableItem
375 enable/disable the item at the given index
378 void rvRollupPanel::EnableItem ( int index, bool enable )
381 if ( index >= mItems.Num() || index < 0 )
386 _EnableItem ( mItems[index], enable );
392 rvRollupPanel::EnableAllItems
394 enable/disable all items in the panel
397 void rvRollupPanel::EnableAllItems ( bool enable )
401 for ( i=0; i < mItems.Num(); i++ )
403 _EnableItem ( mItems[i], enable );
411 rvRollupPanel::_EnableItem
413 Called by EnableItem and EnableAllItems to do the work of enabling/disablgin
417 void rvRollupPanel::_EnableItem ( RPITEM* item, bool enable )
419 // check if we need to change state
420 if ( item->mEnable == enable )
426 GetWindowRect ( item->mDialog, &ir );
428 item->mEnable = enable;
430 if ( item->mExpanded )
432 mItemHeight -= (ir.bottom-ir.top);
433 item->mExpanded = false;
439 rvRollupPanel::ScrollToItem
441 Scroll a page at the top of the Rollup Panel if top = true or just ensure
442 item visibility into view if top = false
445 void rvRollupPanel::ScrollToItem ( int index, bool top )
448 if ( index >= mItems.Num() || index < 0 )
453 RPITEM* item = mItems[index];
458 GetWindowRect ( mWindow, &r );
459 GetWindowRect ( item->mDialog, &ir );
461 // check page visibility
462 if ( top || ((ir.bottom > r.bottom) || (ir.top < r.top)))
464 // compute new mStartYPos
465 GetWindowRect( item->mButton, &ir );
466 mStartYPos -= (ir.top-r.top);
474 rvRollupPanel::MoveItemAt
476 newIndex can be equal to -1 (move at end)
477 return -1 if an error occurs
480 int rvRollupPanel::MoveItemAt ( int index, int newIndex )
482 if ( index == newIndex || index >= mItems.Num() || index < 0 )
487 // remove page from its old position
488 RPITEM* item = mItems[index];
489 mItems.RemoveIndex ( index );
491 // insert at its new position
494 index = mItems.Append( item );
498 mItems.Insert ( item, newIndex );
509 rvRollupPanel::RecallLayout
511 Update the layout of the control based on current states
514 void rvRollupPanel::RecallLayout ( void )
522 GetClientRect ( mWindow, &r );
523 bottomPagePos = mStartYPos + mItemHeight;
525 if ( bottomPagePos < r.bottom-r.top )
527 mStartYPos = (r.bottom-r.top) - mItemHeight;
529 if ( mStartYPos > 0 )
537 hdwp = BeginDeferWindowPos ( mItems.Num() * 3 );
541 for ( i=0; i < mItems.Num(); i++ )
543 RPITEM* item = mItems[i];
545 // enable / disable button
546 SendMessage ( item->mButton, BM_SETCHECK, (item->mEnable&item->mExpanded)?BST_CHECKED:BST_UNCHECKED, 0 );
547 EnableWindow ( item->mButton, item->mEnable );
550 if ( item->mExpanded && item->mEnable )
553 GetWindowRect ( item->mDialog, &ir );
555 // update GroupBox position and size
557 DeferWindowPos ( hdwp,
561 item->mGroupBox, 0, 2, posy,
562 (r.right-r.left)-3-RP_SCROLLBARWIDTH,
563 (ir.bottom-ir.top)+RP_PGBUTTONHEIGHT+RP_GRPBOXINDENT-4,
564 SWP_NOZORDER|SWP_SHOWWINDOW);
566 //Update Dialog position and size
568 DeferWindowPos ( hdwp,
572 item->mDialog, 0, RP_GRPBOXINDENT, posy+RP_PGBUTTONHEIGHT,
573 (r.right-r.left)-RP_SCROLLBARWIDTH-(RP_GRPBOXINDENT*2),
574 ir.bottom-ir.top, SWP_NOZORDER|SWP_SHOWWINDOW);
576 //Update Button's position and size
578 DeferWindowPos ( hdwp,
582 item->mButton, 0, RP_GRPBOXINDENT, posy,
583 (r.right-r.left)-RP_SCROLLBARWIDTH-(RP_GRPBOXINDENT*2),
584 RP_PGBUTTONHEIGHT, SWP_NOZORDER|SWP_SHOWWINDOW);
586 posy += (ir.bottom-ir.top) + RP_PGBUTTONHEIGHT;
591 // update GroupBox position and size
593 DeferWindowPos ( hdwp,
597 item->mGroupBox, 0, 2, posy,
598 (r.right-r.left)-3-RP_SCROLLBARWIDTH, 16, SWP_NOZORDER|SWP_SHOWWINDOW);
600 // update Dialog position and size
602 DeferWindowPos ( hdwp,
606 item->mDialog, 0, RP_GRPBOXINDENT, 0, 0, 0,SWP_NOZORDER|SWP_HIDEWINDOW|SWP_NOSIZE|SWP_NOMOVE);
608 // update Button's position and size
610 DeferWindowPos ( hdwp,
614 item->mButton, 0, RP_GRPBOXINDENT, posy,
615 (r.right-r.left)-RP_SCROLLBARWIDTH-(RP_GRPBOXINDENT*2),
616 RP_PGBUTTONHEIGHT, SWP_NOZORDER|SWP_SHOWWINDOW);
618 posy += RP_PGBUTTONHEIGHT;
621 posy += (RP_GRPBOXINDENT/2);
626 EndDeferWindowPos ( hdwp );
631 SetRect ( &br, r.right-RP_SCROLLBARWIDTH,r.top,r.right,r.bottom);
632 InvalidateRect( mWindow, &br, FALSE );
633 UpdateWindow ( mWindow );
638 rvRollupPanel::GetItemIndex
640 Return -1 if no matching item was found, otherwise the index of the item
643 int rvRollupPanel::GetItemIndex ( HWND wnd )
647 //Search matching button's hwnd
648 for ( i=0; i < mItems.Num(); i++ )
650 if ( wnd == mItems[i]->mButton )
659 int rvRollupPanel::GetItemIndex ( const char* caption )
663 //Search matching button's hwnd
664 for ( i=0; i < mItems.Num(); i++ )
666 if ( !idStr::Icmp ( caption, mItems[i]->mCaption ) )
677 rvRollupPanel::GetItem
679 Return NULL if the index is invalid
682 RPITEM* rvRollupPanel::GetItem ( int index )
685 if ( index >= mItems.Num() || index < 0 )
690 return mItems[index];
695 rvRollupPanel::DialogProc
697 Dialog procedure for items
700 LRESULT CALLBACK rvRollupPanel::DialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
702 RPITEM* item = (RPITEM*)GetWindowLong ( hWnd, GWL_USERDATA );
703 rvRollupPanel* _this = (rvRollupPanel*)GetWindowLong ( GetParent ( hWnd ), GWL_USERDATA );
706 GetClientRect ( _this->mWindow, &r );
708 if ( _this->mItemHeight > r.bottom-r.top )
716 GetCursorPos ( &pos );
717 _this->mOldMouseYPos = pos.y;
725 if ( ::GetCapture() == hWnd )
734 if ( (::GetCapture() == hWnd) && (wParam==MK_LBUTTON || wParam==MK_MBUTTON))
738 _this->mStartYPos += (pos.y-_this->mOldMouseYPos);
739 _this->RecallLayout();
740 _this->mOldMouseYPos = pos.y;
741 InvalidateRect ( _this->mWindow, NULL, TRUE );
748 if ( (HWND)wParam == hWnd)
750 SetCursor ( LoadCursor (NULL, RP_ROLLCURSOR) );
757 return ::CallWindowProc ( item->mOldDlgProc, hWnd, uMsg, wParam, lParam );
762 rvRollupPanel::DialogProc
764 Button procedure for items
767 LRESULT CALLBACK rvRollupPanel::ButtonProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
769 if ( uMsg == WM_SETFOCUS )
774 RPITEM* item = (RPITEM*)GetWindowLong(hWnd, GWL_USERDATA);
775 return ::CallWindowProc( item->mOldButtonProc, hWnd, uMsg, wParam, lParam );
780 rvRollupPanel::WindowProc
782 Window procedure for rollup panel
785 LRESULT CALLBACK rvRollupPanel::WindowProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
787 rvRollupPanel* panel;
788 panel = (rvRollupPanel*)GetWindowLong (hWnd, GWL_USERDATA);
796 // Attach the class to the window first
797 cs = (LPCREATESTRUCT) lParam;
798 panel = (rvRollupPanel*) cs->lpCreateParams;
799 SetWindowLong ( hWnd, GWL_USERDATA, (LONG)panel );
804 panel->HandleCommand ( wParam, lParam );
808 return panel->HandlePaint ( wParam, lParam );
811 return panel->HandleSize ( wParam, lParam );
814 panel->HandleLButtonDown ( wParam, lParam );
818 panel->HandleLButtonUp ( wParam, lParam );
822 panel->HandleMouseMove ( wParam, lParam );
826 panel->HandleMouseWheel ( wParam, lParam );
829 case WM_MOUSEACTIVATE:
830 panel->HandleMouseActivate ( wParam, lParam );
834 return panel->HandleContextMenu ( wParam, lParam );
837 return DefWindowProc ( hWnd, uMsg, wParam, lParam );
842 rvRollupPanel::HandleCommand
844 Handle the WM_COMMAND message
847 int rvRollupPanel::HandleCommand ( WPARAM wParam, LPARAM lParam )
849 // popup menu command to expand or collapse pages
850 if ( LOWORD(wParam) == RP_IDM_EXPANDALL )
852 ExpandAllItems ( true );
854 else if ( LOWORD(wParam) == RP_IDM_COLLAPSEALL )
856 ExpandAllItems ( false );
859 // popupMenu command to expand page
860 else if ( LOWORD(wParam) >= RP_IDM_STARTITEMS &&
861 LOWORD(wParam) < RP_IDM_STARTITEMS + GetItemCount ( ) )
863 int index = LOWORD(wParam)-RP_IDM_STARTITEMS;
864 ExpandItem ( index, !IsItemExpanded(index) );
868 else if ( HIWORD(wParam) == BN_CLICKED )
870 int index = GetItemIndex ((HWND)lParam);
873 ExpandItem ( index, !IsItemExpanded ( index ) );
883 rvRollupPanel::HandlePaint
885 Handle the WM_PAINT message
888 int rvRollupPanel::HandlePaint( WPARAM wParam, LPARAM lParam )
898 dc = BeginPaint ( mWindow, &ps );
901 GetClientRect ( mWindow, &r );
902 SetRect ( &br, r.right-RP_SCROLLBARWIDTH, r.top, r.right, r.bottom );
903 DrawEdge ( dc, &br, EDGE_RAISED, BF_RECT );
907 clientHeight = (r.bottom-r.top) - 4;
909 if ( mItemHeight > (r.bottom-r.top) )
911 sbSize = clientHeight - (((mItemHeight-(r.bottom-r.top)) * clientHeight ) / mItemHeight );
912 sbPos = -(mStartYPos * clientHeight) / mItemHeight;
916 sbSize = clientHeight;
922 br.bottom = br.top+sbSize;
925 brush = CreateSolidBrush ( RP_SCROLLBARCOLOR );
926 FillRect ( dc, &br, brush );
927 DeleteObject ( brush );
929 SetRect ( &r, br.left,2,br.right,br.top );
930 FillRect ( dc, &r, (HBRUSH)GetStockObject ( BLACK_BRUSH ) );
932 SetRect ( &r, br.left,br.bottom,br.right,2+clientHeight );
933 FillRect ( dc, &r, (HBRUSH)GetStockObject ( BLACK_BRUSH ) );
940 rvRollupPanel::HandleSize
942 Handle the WM_SIZE message
945 int rvRollupPanel::HandleSize ( WPARAM wParam, LPARAM lParam )
947 DefWindowProc ( mWindow, WM_SIZE, wParam, lParam );
954 rvRollupPanel::HandleLButtonDown
956 Handle the WM_LBUTTONDOWN message
959 int rvRollupPanel::HandleLButtonDown ( WPARAM wParam, LPARAM lParam )
965 GetClientRect ( mWindow, &r );
966 if ( mItemHeight <= r.bottom - r.top )
971 point.x = LOWORD(lParam);
972 point.y = HIWORD(lParam);
974 SetRect ( &br, r.right - RP_SCROLLBARWIDTH, r.top, r.right, r.bottom );
976 if ( (wParam & MK_LBUTTON) && PtInRect ( &br, point ) )
978 SetCapture( mWindow );
980 int clientHeight = (r.bottom-r.top) - 4;
982 int sbSize = clientHeight - (((mItemHeight - (r.bottom-r.top)) * clientHeight) / mItemHeight );
983 int sbPos = -(mStartYPos * clientHeight) / mItemHeight;
985 // click inside scrollbar cursor
986 if ( (point.y < (sbPos + sbSize)) && (point.y > sbPos ))
988 mSBOffset = sbPos - point.y + 1;
990 // click outside scrollbar cursor (2 cases => above or below cursor)
993 int distup = point.y - sbPos;
994 int distdown = (sbPos + sbSize) - point.y;
996 if ( distup < distdown )
1004 mSBOffset = -sbSize;
1008 // calc new m_nStartYPos from mouse pos
1009 int targetPos = point.y + mSBOffset;
1010 mStartYPos =- (targetPos * mItemHeight) / clientHeight;
1021 rvRollupPanel::HandleLButtonUp
1023 Handle the WM_LBUTTONUP message
1026 int rvRollupPanel::HandleLButtonUp ( WPARAM wParam, LPARAM lParam )
1028 if ( GetCapture() == mWindow )
1038 rvRollupPanel::HandleMouseMove
1040 Handle the WM_MOUSEMOVE message
1043 int rvRollupPanel::HandleMouseMove ( WPARAM wParam, LPARAM lParam )
1049 GetClientRect ( mWindow, &r );
1050 if ( mItemHeight <= r.bottom - r.top )
1055 point.x = LOWORD(lParam);
1056 point.y = HIWORD(lParam);
1058 SetRect ( &br, r.right - RP_SCROLLBARWIDTH, r.top, r.right, r.bottom );
1060 if ( (wParam & MK_LBUTTON) && (GetCapture() == mWindow ))
1062 // calc new m_nStartYPos from mouse pos
1063 int clientHeight = (r.bottom-r.top) - 4;
1064 int targetPos = point.y + mSBOffset;
1066 mStartYPos =- (targetPos * mItemHeight) / clientHeight;
1070 InvalidateRect ( mWindow, NULL, FALSE );
1071 // UpdateWindow ( mWindow );
1079 rvRollupPanel::HandleMouseWheel
1081 Handle the WM_MOUSEWHEEL message
1084 int rvRollupPanel::HandleMouseWheel ( WPARAM wParam, LPARAM lParam )
1086 // calc new m_nStartYPos
1087 mStartYPos += (HIWORD(wParam) / 4);
1096 rvRollupPanel::HandleMouseActivate
1098 Handle the WM_MOUSEACTIVATE message
1101 int rvRollupPanel::HandleMouseActivate ( WPARAM wParam, LPARAM lParam )
1103 SetFocus ( mWindow );
1109 rvRollupPanel::HandleContextMenu
1111 Handle the WM_CONTEXTMENU message
1114 int rvRollupPanel::HandleContextMenu ( WPARAM wParam, LPARAM lParam )
1120 menu = CreatePopupMenu ( );
1126 point.x = LOWORD(lParam);
1127 point.y = HIWORD(lParam);
1129 AppendMenu ( menu, MF_STRING, RP_IDM_EXPANDALL, "Expand all" );
1130 AppendMenu ( menu, MF_STRING, RP_IDM_COLLAPSEALL, "Collapse all" );
1131 AppendMenu ( menu, MF_SEPARATOR, 0, "" );
1133 //Add all pages with checked style for expanded ones
1134 for ( i=0; i < mItems.Num(); i++ )
1136 char itemName[1024];
1137 GetWindowText ( mItems[i]->mButton, itemName, 1023 );
1138 AppendMenu ( menu, MF_STRING, RP_IDM_STARTITEMS + i, itemName );
1140 if ( mItems[i]->mExpanded )
1142 CheckMenuItem ( menu, RP_IDM_STARTITEMS + i, MF_CHECKED);
1145 TrackPopupMenu ( menu, TPM_LEFTALIGN|TPM_LEFTBUTTON, point.x, point.y, 0, mWindow, NULL );
1153 rvRollupPanel::GetMsgProc
1155 Ensures normal dialog functions work in the alpha select dialog
1158 LRESULT FAR PASCAL rvRollupPanel::GetMsgProc ( int nCode, WPARAM wParam, LPARAM lParam )
1160 LPMSG lpMsg = (LPMSG) lParam;
1162 if ( nCode >= 0 && PM_REMOVE == wParam )
1164 // Don't translate non-input events.
1165 if ( (lpMsg->message >= WM_KEYFIRST && lpMsg->message <= WM_KEYLAST) )
1168 for ( i = 0; i < mDialogs.Num(); i ++ )
1170 if ( IsDialogMessage( mDialogs[i], lpMsg) )
1172 // The value returned from this hookproc is ignored,
1173 // and it cannot be used to tell Windows the message has been handled.
1174 // To avoid further processing, convert the message to WM_NULL
1175 // before returning.
1176 lpMsg->message = WM_NULL;
1185 return CallNextHookEx ( mDialogHook, nCode, wParam, lParam);
1190 rvRollupPanel::AutoSize
1192 Automatically set the width of the control based on the dialogs it contains
1195 void rvRollupPanel::AutoSize ( void )
1199 for ( i = 0; i < mItems.Num(); i ++ )
1203 GetWindowRect ( mItems[i]->mDialog, &r );
1204 w = (r.right-r.left)+RP_SCROLLBARWIDTH+(RP_GRPBOXINDENT*2);
1212 GetWindowRect ( mWindow, &cr );
1213 SetWindowPos ( mWindow, NULL, 0, 0, width, cr.bottom-cr.top, SWP_NOMOVE|SWP_NOZORDER );