29 #include "../../idlib/precompiled.h"
32 #include "../../sys/win32/rc/guied_resource.h"
36 #define GENAV_ITEMHEIGHT 22
58 memset ( &wndClass, 0,
sizeof(wndClass) );
59 wndClass.cbSize =
sizeof(WNDCLASSEX);
60 wndClass.lpszClassName =
"GUIEDITOR_NAVIGATOR_CLASS";
62 wndClass.hbrBackground = (HBRUSH)GetStockObject( LTGRAY_BRUSH );;
63 wndClass.hCursor = LoadCursor((HINSTANCE)
NULL, IDC_ARROW);
64 wndClass.lpszMenuName =
NULL;
66 RegisterClassEx ( &wndClass );
75 mWnd = CreateWindowEx ( WS_EX_TOOLWINDOW,
76 "GUIEDITOR_NAVIGATOR_CLASS",
78 WS_SYSMENU|WS_THICKFRAME|WS_CAPTION|WS_POPUP|WS_OVERLAPPED|WS_BORDER|WS_CLIPSIBLINGS|WS_CHILD,
95 GetWindowRect ( parent, &rParent );
96 GetWindowRect (
mWnd, &rNav );
97 SetWindowPos (
mWnd, NULL,
98 rParent.right - 10 - (rNav.right-rNav.left),
99 rParent.bottom - 10 - (rNav.bottom-rNav.top),
101 SWP_NOZORDER|SWP_NOSIZE );
120 SetRect ( &rOut, rect->left, rect->top, rect->right - 1, rect->top + 1 );
121 FillRect ( hDC,&rOut, topLeft );
123 SetRect ( &rOut, rect->left, rect->top, rect->left + 1, rect->bottom );
124 FillRect( hDC,&rOut, topLeft );
126 SetRect ( &rOut, rect->right, rect->top, rect->right -1, rect->bottom );
127 FillRect( hDC,&rOut, bottomRight );
129 SetRect ( &rOut, rect->left, rect->bottom, rect->right, rect->bottom - 1 );
130 FillRect( hDC,&rOut, bottomRight );
146 case WM_INITMENUPOPUP:
167 DRAWITEMSTRUCT* dis = (DRAWITEMSTRUCT*) lParam;
191 CopyRect ( &rDraw, &dis->rcItem );
196 FrameRect ( dis->hDC, &rDraw, (HBRUSH)GetStockObject ( BLACK_BRUSH ) );
199 FillRect ( dis->hDC, &rDraw, GetSysColorBrush ( COLOR_3DFACE ) );
201 Draw3dRect ( dis->hDC, &rDraw, GetSysColorBrush ( COLOR_3DHILIGHT ), GetSysColorBrush ( COLOR_3DSHADOW ) );
203 InflateRect ( &rDraw, -3, -3 );
204 Draw3dRect ( dis->hDC, &rDraw, GetSysColorBrush ( COLOR_3DSHADOW ), GetSysColorBrush ( COLOR_3DHILIGHT ) );
211 CopyRect ( &rDraw, &dis->rcItem );
215 if ( dis->itemState & ODS_SELECTED )
217 FillRect ( dis->hDC, &rDraw, GetSysColorBrush ( COLOR_HIGHLIGHT ) );
221 FillRect ( dis->hDC, &rDraw, GetSysColorBrush ( COLOR_WINDOW ) );
228 DrawIconEx ( dis->hDC, rDraw.left + offset, rDraw.top + 3, nav->
mCollapseIcon, 16, 16,0,
NULL, DI_NORMAL );
232 DrawIconEx ( dis->hDC, rDraw.left + offset, rDraw.top + 3, nav->
mExpandIcon, 16, 16,0,
NULL, DI_NORMAL );
236 HPEN pen = CreatePen ( PS_SOLID, 1, GetSysColor ( COLOR_3DSHADOW ) );
237 HPEN oldpen = (HPEN)SelectObject ( dis->hDC, pen );
238 MoveToEx ( dis->hDC, rDraw.left, dis->rcItem.top,
NULL );
239 LineTo ( dis->hDC, dis->rcItem.right, dis->rcItem.top );
240 MoveToEx ( dis->hDC, rDraw.left, dis->rcItem.bottom,
NULL );
241 LineTo ( dis->hDC, dis->rcItem.right, dis->rcItem.bottom);
242 SelectObject ( dis->hDC, oldpen );
243 DeleteObject ( pen );
248 int colorIndex = ( (dis->itemState & ODS_SELECTED ) ? COLOR_HIGHLIGHTTEXT : COLOR_WINDOWTEXT );
249 SetTextColor ( dis->hDC, GetSysColor ( colorIndex ) );
250 DrawText ( dis->hDC, name, name.
Length(), &rDraw, DT_LEFT|DT_VCENTER|DT_SINGLELINE );
254 DrawIconEx ( dis->hDC, dis->rcItem.right - 16, (dis->rcItem.bottom+dis->rcItem.top)/2-6, (dis->itemState & ODS_SELECTED)?nav->
mScriptsLightIcon:nav->
mScriptsIcon, 13, 13,0,
NULL, DI_NORMAL );
263 MEASUREITEMSTRUCT* mis = (MEASUREITEMSTRUCT*) lParam;
264 mis->itemHeight = 22;
274 cs = (LPCREATESTRUCT) lParam;
276 SetWindowLong ( hWnd, GWL_USERDATA, (
LONG)nav );
279 nav->
mTree = CreateWindowEx ( 0,
"SysListView32",
"", WS_VSCROLL|WS_CHILD|WS_VISIBLE|LVS_REPORT|LVS_OWNERDRAWFIXED|LVS_NOCOLUMNHEADER|LVS_SHOWSELALWAYS, 0, 0, 0, 0, hWnd, (HMENU)
IDC_GUIED_WINDOWTREE,
win32.
hInstance, 0 );
280 ListView_SetExtendedListViewStyle ( nav->
mTree, LVS_EX_FULLROWSELECT );
281 ListView_SetBkColor ( nav->
mTree, GetSysColor ( COLOR_3DFACE ) );
282 ListView_SetTextBkColor ( nav->
mTree, GetSysColor ( COLOR_3DFACE ) );
284 SetWindowLong ( nav->
mTree, GWL_USERDATA, (
LONG)nav );
289 ListView_InsertColumn ( nav->mTree, 0, &col );
297 MoveWindow ( nav->
mTree, 0, 0, LOWORD(lParam), HIWORD(lParam),
TRUE );
298 GetClientRect ( nav->
mTree, &rClient );
299 ListView_SetColumnWidth ( nav->
mTree, 0, rClient.right-rClient.left-1 );
310 nh = (LPNMHDR) lParam;
317 DWORD dwpos = GetMessagePos();
319 info.pt.x = LOWORD(dwpos);
320 info.pt.y = HIWORD(dwpos);
321 MapWindowPoints(HWND_DESKTOP, nh->hwndFrom, &info.pt, 1);
322 int index = ListView_HitTest ( nav->
mTree, &info );
327 ListView_GetItemRect ( nav->
mTree, index, &rItem, LVIR_BOUNDS );
329 item.mask = LVIF_PARAM;
331 ListView_GetItem ( nav->
mTree, &item );
335 offset = wrapper->
GetDepth ( ) * 10 + 1;
350 if ( wrapper->CanHaveChildren ( ) && window->
GetChildCount ( ) )
352 if ( wrapper->IsExpanded ( ) )
354 wrapper->Collapse ( );
364 else if ( nh->code == NM_DBLCLK )
375 DWORD dwpos = GetMessagePos();
377 info.pt.x = LOWORD(dwpos);
378 info.pt.y = HIWORD(dwpos);
379 MapWindowPoints(HWND_DESKTOP, nh->hwndFrom, &info.pt, 1);
380 int index = ListView_HitTest ( nav->
mTree, &info );
384 ClientToScreen ( hWnd, &info.pt );
386 TrackPopupMenu ( menu, TPM_RIGHTBUTTON|TPM_LEFTALIGN, info.pt.x, info.pt.y, 0,
gApp.
GetMDIFrame ( ),
NULL );
387 DestroyMenu ( menu );
393 case LVN_ITEMCHANGED:
395 NMLISTVIEW* nml = (NMLISTVIEW*) nh;
396 if ( (nml->uNewState & LVIS_SELECTED) != (nml->uOldState & LVIS_SELECTED) )
399 item.iItem = nml->iItem;
400 item.mask = LVIF_PARAM;
401 ListView_GetItem ( nav->
mTree, &item );
403 if ( nml->uNewState & LVIS_SELECTED )
420 return DefWindowProc ( hWnd, msg, wParam, lParam );
447 return CallWindowProc ( nav->
mListWndProc, hWnd, msg, wParam, lParam );
466 if ( !wrapper || wrapper->
IsDeleted ( ) )
472 ZeroMemory ( &item,
sizeof(item) );
473 item.mask = LVIF_PARAM|LVIF_STATE|LVIF_IMAGE;
474 item.iItem = ListView_GetItemCount (
mTree );
475 item.lParam = (
LONG) window;
478 item.stateMask = LVIS_SELECTED;
479 ListView_InsertItem (
mTree, &item );
481 if ( item.state & LVIS_SELECTED )
483 ListView_EnsureVisible (
mTree, item.iItem,
false );
493 for ( index = 0; index < wrapper->
GetChildCount(); index ++ )
523 ListView_DeleteAllItems (
mTree );
534 GetClientRect (
mTree, &rClient );
535 ListView_SetColumnWidth (
mTree, 0, rClient.right-rClient.left-1 );
550 for ( i = 0; i <
count; i++ )
557 item.mask = LVIF_PARAM;
558 ListView_GetItem (
mTree, &item );
562 ListView_SetItemState (
mTree, i, wrapper->
IsSelected ( )?LVIS_SELECTED:0, LVIS_SELECTED );
566 ListView_EnsureVisible (
mTree, i,
false );
594 ShowWindow (
mWnd, visible?SW_SHOW:SW_HIDE );
idUserInterfaceLocal * GetInterface(void)
#define ID_GUIED_ITEM_PROPERTIES
assert(prefInfo.fullscreenBtn)
void Add(idWindow *window, bool expand=true)
CONST PIXELFORMATDESCRIPTOR UINT
#define IDC_GUIED_WINDOWTREE
void SetWindowPlacement(const char *name, HWND hwnd)
bool GetWindowPlacement(const char *name, HWND hwnd)
static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
HINSTANCE GetInstance(void)
rvGEWorkspace * mWorkspace
bool CanHaveChildren(void)
void SetWorkspace(rvGEWorkspace *workspace)
idWindow * GetChild(int index)
GLuint GLuint GLsizei count
HICON mVisibleIconDisabled
rvGEOptions & GetOptions(void)
idDict & GetScriptDict(void)
static LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
#define IDI_GUIED_NAV_COLLAPSE
idDict & GetVariableDict(void)
void HideWindow(idWindow *window)
#define IDI_GUIED_NAV_SCRIPTS
rvGESelectionMgr & GetSelectionMgr(void)
typedef HDC(WINAPI *PFNWGLGETCURRENTREADDCARBPROC)(void)
idWindow * GetDesktop() const
#define IDR_GUIED_ITEM_POPUP
#define IDI_GUIED_NAV_SCRIPTSHI
int ToolWindowActivate(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
void UnhideWindow(idWindow *window)
#define IDI_GUIED_NAV_EXPAND
static rvGEWindowWrapper * GetWrapper(idWindow *window)
void Draw3dRect(HDC hDC, RECT *rect, HBRUSH topLeft, HBRUSH bottomRight)
bool Create(HWND parent, bool visible)
#define IDI_GUIED_NAV_VISIBLE
if(!ValidDisplayID(prefInfo.prefDisplayID)) prefInfo.prefDisplayID
#define IDI_GUIED_NAV_VISIBLEDISABLED
void SetNavigatorVisible(bool vis)
void UpdateSelections(void)
int GetNumKeyVals(void) const
virtual void ActivateTool(bool active)=0
void AddWindow(idWindow *window)