29 #include "../../idlib/precompiled.h"
32 #include "../../sys/win32/win_local.h"
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
93 memset ( &wndClass, 0,
sizeof(wndClass) );
94 wndClass.cbSize =
sizeof(WNDCLASSEX);
95 wndClass.lpszClassName =
"ROLLUP_PANEL";
97 wndClass.hbrBackground = (HBRUSH)GetSysColorBrush ( COLOR_3DFACE );
98 wndClass.hCursor = LoadCursor((HINSTANCE)
NULL, IDC_ARROW);
99 wndClass.lpszMenuName =
NULL;
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,
135 if ( index > 0 && index >=
mItems.
Num() )
145 HWND groupbox = CreateWindow (
"BUTTON",
"", WS_CHILD|BS_GROUPBOX,
146 r.left, r.top, r.right-r.left, r.bottom-r.top,
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,
155 SendMessage ( button, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0 );
164 item->
mOldDlgProc = (WNDPROC) GetWindowLong ( dialog, DWL_DLGPROC );
165 item->
mOldButtonProc = (WNDPROC) GetWindowLong ( button, GWL_WNDPROC );
179 SetWindowLong ( dialog, GWL_USERDATA, (
LONG)item );
182 SetWindowLong ( button, GWL_USERDATA, (
LONG)item );
183 SetWindowLong ( button, GWL_ID, index );
216 if ( index >=
mItems.
Num() || index < 0 )
259 GetWindowRect ( item->
mDialog, &ir );
271 DestroyWindow ( item->
mButton );
279 DestroyWindow ( item->
mDialog );
304 if ( index >=
mItems.
Num() || index < 0 )
356 GetWindowRect ( item->
mDialog, &ir );
381 if ( index >=
mItems.
Num() || index < 0 )
426 GetWindowRect ( item->
mDialog, &ir );
448 if ( index >=
mItems.
Num() || index < 0 )
459 GetWindowRect ( item->
mDialog, &ir );
462 if ( top || ((ir.bottom > r.bottom) || (ir.top < r.top)))
465 GetWindowRect( item->
mButton, &ir );
482 if ( index == newIndex || index >=
mItems.
Num() || index < 0 )
525 if ( bottomPagePos < r.bottom-r.top )
537 hdwp = BeginDeferWindowPos (
mItems.
Num() * 3 );
553 GetWindowRect ( item->
mDialog, &ir );
557 DeferWindowPos ( hdwp,
564 SWP_NOZORDER|SWP_SHOWWINDOW);
568 DeferWindowPos ( hdwp,
574 ir.bottom-ir.top, SWP_NOZORDER|SWP_SHOWWINDOW);
578 DeferWindowPos ( hdwp,
593 DeferWindowPos ( hdwp,
602 DeferWindowPos ( hdwp,
610 DeferWindowPos ( hdwp,
626 EndDeferWindowPos ( hdwp );
650 if ( wnd ==
mItems[i]->mButton )
685 if ( index >=
mItems.
Num() || index < 0 )
702 RPITEM* item = (
RPITEM*)GetWindowLong ( hWnd, GWL_USERDATA );
706 GetClientRect ( _this->
mWindow, &r );
716 GetCursorPos ( &pos );
725 if ( ::GetCapture() == hWnd )
734 if ( (::GetCapture() == hWnd) && (wParam==MK_LBUTTON || wParam==MK_MBUTTON))
748 if ( (HWND)wParam == hWnd)
757 return ::CallWindowProc ( item->
mOldDlgProc, hWnd, uMsg, wParam, lParam );
769 if ( uMsg == WM_SETFOCUS )
774 RPITEM* item = (
RPITEM*)GetWindowLong(hWnd, GWL_USERDATA);
775 return ::CallWindowProc( item->
mOldButtonProc, hWnd, uMsg, wParam, lParam );
797 cs = (LPCREATESTRUCT) lParam;
799 SetWindowLong ( hWnd, GWL_USERDATA, (
LONG)panel );
829 case WM_MOUSEACTIVATE:
837 return DefWindowProc ( hWnd, uMsg, wParam, lParam );
868 else if ( HIWORD(wParam) == BN_CLICKED )
898 dc = BeginPaint (
mWindow, &ps );
903 DrawEdge ( dc, &br, EDGE_RAISED, BF_RECT );
907 clientHeight = (r.bottom-r.top) - 4;
916 sbSize = clientHeight;
922 br.bottom = br.top+sbSize;
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 ) );
947 DefWindowProc (
mWindow, WM_SIZE, wParam, lParam );
971 point.
x = LOWORD(lParam);
972 point.
y = HIWORD(lParam);
976 if ( (wParam & MK_LBUTTON) && PtInRect ( &br, point ) )
980 int clientHeight = (r.bottom-r.top) - 4;
986 if ( (point.
y < (sbPos + sbSize)) && (point.
y > sbPos ))
993 int distup = point.
y - sbPos;
994 int distdown = (sbPos + sbSize) - point.
y;
996 if ( distup < distdown )
1028 if ( GetCapture() ==
mWindow )
1049 GetClientRect (
mWindow, &r );
1055 point.
x = LOWORD(lParam);
1056 point.
y = HIWORD(lParam);
1060 if ( (wParam & MK_LBUTTON) && (GetCapture() ==
mWindow ))
1063 int clientHeight = (r.bottom-r.top) - 4;
1120 menu = CreatePopupMenu ( );
1126 point.
x = LOWORD(lParam);
1127 point.
y = HIWORD(lParam);
1131 AppendMenu ( menu, MF_SEPARATOR, 0,
"" );
1136 char itemName[1024];
1137 GetWindowText (
mItems[i]->mButton, itemName, 1023 );
1140 if (
mItems[i]->mExpanded )
1145 TrackPopupMenu ( menu, TPM_LEFTALIGN|TPM_LEFTBUTTON, point.
x, point.
y, 0,
mWindow,
NULL );
1160 LPMSG lpMsg = (LPMSG) lParam;
1162 if ( nCode >= 0 && PM_REMOVE == wParam )
1165 if ( (lpMsg->message >= WM_KEYFIRST && lpMsg->message <= WM_KEYLAST) )
1170 if ( IsDialogMessage(
mDialogs[i], lpMsg) )
1176 lpMsg->message = WM_NULL;
1185 return CallNextHookEx (
mDialogHook, nCode, wParam, lParam);
1203 GetWindowRect (
mItems[i]->mDialog, &r );
1212 GetWindowRect (
mWindow, &cr );
1213 SetWindowPos (
mWindow,
NULL, 0, 0, width, cr.bottom-cr.top, SWP_NOMOVE|SWP_NOZORDER );
bool IsItemExpanded(int index)
char mCaption[RPITEM_MAX_NAME]
int HandleLButtonDown(WPARAM wParam, LPARAM lParam)
assert(prefInfo.fullscreenBtn)
void ExpandItem(int index, bool expand=true)
int InsertItem(const char *caption, HWND dialog, bool autoDestroy, int index=-1)
void _EnableItem(RPITEM *item, bool enable)
#define RP_SCROLLBARWIDTH
int HandlePaint(WPARAM wParam, LPARAM lParam)
int HandleMouseMove(WPARAM wParam, LPARAM lParam)
CONST PIXELFORMATDESCRIPTOR UINT
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)
static LRESULT FAR PASCAL GetMsgProc(int nCode, WPARAM wParam, LPARAM lParam)
void _ExpandItem(RPITEM *item, bool expand)
virtual ~rvRollupPanel(void)
static LRESULT CALLBACK ButtonProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
static LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
int Icmp(const char *text) const
int HandleMouseActivate(WPARAM wParam, LPARAM lParam)
int HandleMouseWheel(WPARAM wParam, LPARAM lParam)
idList< RPITEM * > mItems
GLubyte GLubyte GLubyte GLubyte w
#define RP_IDM_COLLAPSEALL
static idList< HWND > mDialogs
#define RP_SCROLLBARCOLOR
int HandleContextMenu(WPARAM wParam, LPARAM lParam)
typedef HDC(WINAPI *PFNWGLGETCURRENTREADDCARBPROC)(void)
bool Create(DWORD dwStyle, const RECT &rect, HWND parent, unsigned int id)
GLdouble GLdouble GLdouble top
int HandleCommand(WPARAM wParam, LPARAM lParam)
int Insert(const type &obj, int index=0)
int Append(const type &obj)
GLdouble GLdouble GLdouble r
int MoveItemAt(int index, int newIndex)
bool RemoveIndex(int index)
MFnDagNode * GetParent(MFnDagNode *joint)
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)
if(!ValidDisplayID(prefInfo.prefDisplayID)) prefInfo.prefDisplayID
#define RP_PGBUTTONHEIGHT
int HandleLButtonUp(WPARAM wParam, LPARAM lParam)
#define RP_IDM_STARTITEMS
bool Remove(const type &obj)