ReactOS  0.4.12-dev-75-g00dd17e
Pane Struct Reference

child window pane for displaying file lists More...

#include <pane.h>

Inheritance diagram for Pane:
Collaboration diagram for Pane:

Public Types

typedef SubclassedWindow super
 
- Public Types inherited from SubclassedWindow
typedef Window super
 
- Public Types inherited from Window
typedef map< HWND, Window * > WindowMap
 
typedef Window *(* CREATORFUNC) (HWND)
 
typedef Window *(* CREATORFUNC_INFO) (HWND, const void *)
 

Public Member Functions

 Pane (HWND hparent, int id, int id_header, Entry *rool, bool treePane, int visible_cols)
 
 ~Pane ()
 
void init ()
 
void set_header ()
 
bool create_header (HWND parent, int id)
 
bool calc_widths (bool anyway)
 
void calc_single_width (int col)
 
void draw_item (LPDRAWITEMSTRUCT dis, Entry *entry, int calcWidthCol=-1)
 
int insert_entries (Entry *dir, int idx=-1)
 
BOOL command (UINT cmd)
 
virtual int Notify (int id, NMHDR *pnmh)
 
- Public Member Functions inherited from SubclassedWindow
 SubclassedWindow (HWND)
 
- Public Member Functions inherited from Window
 Window (HWND hwnd)
 
virtual ~Window ()
 
LRESULT SendParent (UINT nmsg, WPARAM wparam=0, LPARAM lparam=0)
 
LRESULT PostParent (UINT nmsg, WPARAM wparam=0, LPARAM lparam=0)
 

Public Attributes

int _widths [COLUMNS]
 
int _positions [COLUMNS+1]
 
WindowHandle _hwndHeader
 
Entry_root
 
Entry_cur
 
COLORREF _clrCompressed
 
int _visible_cols
 
bool _treePane
 
HWND hwnd
 
HWND hwndHeader
 
int widths [COLUMNS]
 
int positions [COLUMNS+1]
 
BOOL treePane
 
int visible_cols
 
Entryroot
 
Entrycur
 
- Public Attributes inherited from Window
IAccessible IAccessible_iface
 
IOleWindow IOleWindow_iface
 
IEnumVARIANT IEnumVARIANT_iface
 
LONG ref
 

Protected Member Functions

virtual LRESULT WndProc (UINT nmsg, WPARAM wparam, LPARAM lparam)
 
void calc_width (LPDRAWITEMSTRUCT dis, int col, LPCTSTR str)
 
void calc_tabbed_width (LPDRAWITEMSTRUCT dis, int col, LPCTSTR str)
 
struct MainFrameBaseget_frame ()
 
- Protected Member Functions inherited from SubclassedWindow
virtual int Command (int id, int code)
 
- Protected Member Functions inherited from Window
virtual LRESULT Init (LPCREATESTRUCT pcs)
 

Protected Attributes

HIMAGELIST _himl
 
OutputWorker _out_wrkr
 
- Protected Attributes inherited from SubclassedWindow
WNDPROC _orgWndProc
 

Additional Inherited Members

- Static Public Member Functions inherited from Window
static HWND Create (CREATORFUNC creator, DWORD dwExStyle, LPCTSTR lpClassName, LPCTSTR lpWindowName, DWORD dwStyle, int x, int y, int w, int h, HWND hwndParent=0, HMENU hMenu=0)
 
static HWND Create (CREATORFUNC_INFO creator, const void *info, DWORD dwExStyle, LPCTSTR lpClassName, LPCTSTR lpWindowName, DWORD dwStyle, int x, int y, int w, int h, HWND hwndParent=0, HMENU hMenu=0)
 
static Windowcreate_mdi_child (const ChildWndInfo &info, const MDICREATESTRUCT &mcs, CREATORFUNC_INFO creator)
 
static LRESULT CALLBACK WindowWndProc (HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam)
 
static INT_PTR CALLBACK DialogProc (HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam)
 
static Windowget_window (HWND hwnd)
 get window controller from window handle More...
 
template<typename CLASS >
static CLASS * get_window (HWND hwnd)
 
static void register_pretranslate (HWND hwnd)
 
static void unregister_pretranslate (HWND hwnd)
 
static BOOL pretranslate_msg (LPMSG pmsg)
 
static void register_dialog (HWND hwnd)
 
static void unregister_dialog (HWND hwnd)
 
static BOOL dispatch_dialog_msg (LPMSG pmsg)
 
static int MessageLoop ()
 
static void CancelModes ()
 
- Static Protected Member Functions inherited from SubclassedWindow
static LRESULT CALLBACK SubclassedWndProc (HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam)
 
- Static Protected Member Functions inherited from Window
static Windowcreate_controller (HWND hwnd)
 create controller for a new window More...
 
static StaticWindowDataGetStaticWindowData ()
 
static LRESULT CALLBACK MDICBTHookProc (int code, WPARAM wparam, LPARAM lparam)
 
static LRESULT CALLBACK PropSheetCBTHookProc (int code, WPARAM wparam, LPARAM lparam)
 
- Static Protected Attributes inherited from Window
static WindowMap s_wnd_map
 
static const voids_new_info = NULL
 
static CREATORFUNC s_window_creator = NULL
 
static HHOOK s_hcbtHook = 0
 
static WindowSet s_pretranslate_windows
 
static WindowSet s_dialogs
 

Detailed Description

child window pane for displaying file lists

Definition at line 66 of file pane.h.

Member Typedef Documentation

◆ super

Definition at line 68 of file pane.h.

Constructor & Destructor Documentation

◆ Pane()

Pane::Pane ( HWND  hparent,
int  id,
int  id_header,
Entry rool,
bool  treePane,
int  visible_cols 
)

Definition at line 73 of file pane.cpp.

76  0, 0, 0, 0, hparent, (HMENU)id, g_Globals._hInstance, 0)),
77  _root(root),
80 {
81  // insert entries into listbox
82  Entry* entry = _root;
83 
84  if (entry)
85  insert_entries(entry);
86 
87  init();
88 
89  create_header(hparent, id_header);
90 }
Entry * _root
Definition: pane.h:79
#define CreateWindow
Definition: winuser.h:5620
int _visible_cols
Definition: pane.h:84
uint8_t entry
Definition: isohybrid.c:63
int insert_entries(Entry *dir, int idx=-1)
Definition: pane.cpp:658
#define WS_CHILD
Definition: pedump.c:617
#define LBS_OWNERDRAWFIXED
Definition: pedump.c:682
void init()
Definition: pane.cpp:153
#define LBS_NOINTEGRALHEIGHT
Definition: pedump.c:686
bool _treePane
Definition: pane.h:85
#define WS_HSCROLL
Definition: pedump.c:628
HINSTANCE _hInstance
Definition: globals.h:270
int visible_cols
Definition: winefile.c:124
ExplorerGlobals g_Globals
Definition: explorer.cpp:52
#define TEXT(s)
Definition: k32.h:26
#define LBS_NOTIFY
Definition: pedump.c:678
#define LBS_DISABLENOSCROLL
Definition: pedump.c:690
bool create_header(HWND parent, int id)
Definition: pane.cpp:127
#define WS_VSCROLL
Definition: pedump.c:627
SubclassedWindow super
Definition: pane.h:68
BOOL treePane
Definition: winefile.c:123
#define WS_VISIBLE
Definition: pedump.c:620
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
base of all file and directory entries
Definition: entries.h:82

◆ ~Pane()

Pane::~Pane ( )

Definition at line 92 of file pane.cpp.

93 {
95 }
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:893
HIMAGELIST _himl
Definition: pane.h:107

Member Function Documentation

◆ calc_single_width()

void Pane::calc_single_width ( int  col)

Definition at line 726 of file pane.cpp.

Referenced by Notify().

727 {
728  HFONT hfontOld;
729  int x, cx;
730  int cnt;
731  HDC hdc;
732 
733  int entries = ListBox_GetCount(_hwnd);
734 
735  _widths[col] = 0;
736 
737  hdc = GetDC(_hwnd);
738  hfontOld = SelectFont(hdc, _out_wrkr._hfont);
739 
740  for(cnt=0; cnt<entries; cnt++) {
741  Entry* entry = (Entry*) ListBox_GetItemData(_hwnd, cnt);
742 
743  DRAWITEMSTRUCT dis;
744 
745  dis.CtlType = 0;
746  dis.CtlID = 0;
747  dis.itemID = 0;
748  dis.itemAction = 0;
749  dis.itemState = 0;
750  dis.hwndItem = _hwnd;
751  dis.hDC = hdc;
752  dis.rcItem.left = 0;
753  dis.rcItem.top = 0;
754  dis.rcItem.right = 0;
755  dis.rcItem.bottom = 0;
756  /*dis.itemData = 0; */
757 
758  draw_item(&dis, entry, col);
759  }
760 
761  SelectObject(hdc, hfontOld);
762  ReleaseDC(_hwnd, hdc);
763 
764  cx = _widths[col];
765 
766  if (cx) {
767  cx += 3*_out_wrkr._spaceSize.cx;
768 
769  if (cx < IMAGE_WIDTH)
770  cx = IMAGE_WIDTH;
771  }
772 
773  _widths[col] = cx;
774 
775  x = _positions[col] + cx;
776 
777  for(; col<COLUMNS; col++) {
778  _positions[col+1] = x;
779  x += _widths[col];
780  }
781 
782  ListBox_SetHorizontalExtent(_hwnd, x);
783 }
#define HDC
Definition: msvc.h:22
HDC WINAPI GetDC(_In_opt_ HWND)
uint8_t entry
Definition: isohybrid.c:63
LONG top
Definition: windef.h:297
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
LONG left
Definition: windef.h:296
LONG right
Definition: windef.h:298
#define ListBox_SetHorizontalExtent(hwndCtl, cxExtent)
Definition: windowsx.h:471
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HDC hdc
Definition: msvc.h:53
HFONT _hfont
Definition: pane.h:61
LONG cx
Definition: windef.h:324
#define ListBox_GetItemData(hwndCtl, index)
Definition: windowsx.h:453
void draw_item(LPDRAWITEMSTRUCT dis, Entry *entry, int calcWidthCol=-1)
Definition: pane.cpp:298
#define SelectFont(hdc, hfont)
Definition: windowsx.h:486
SIZE _spaceSize
Definition: pane.h:59
int _widths[COLUMNS]
Definition: pane.h:74
INT x
Definition: msvc.h:62
OutputWorker _out_wrkr
Definition: pane.h:108
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
_Out_opt_ int * cx
Definition: commctrl.h:570
#define COLUMNS
Definition: pane.h:73
int _positions[COLUMNS+1]
Definition: pane.h:75
LONG bottom
Definition: windef.h:299
#define IMAGE_WIDTH
Definition: pane.cpp:38
#define ListBox_GetCount(hwndCtl)
Definition: windowsx.h:450
base of all file and directory entries
Definition: entries.h:82

◆ calc_tabbed_width()

void Pane::calc_tabbed_width ( LPDRAWITEMSTRUCT  dis,
int  col,
LPCTSTR  str 
)
protected

Definition at line 642 of file pane.cpp.

Referenced by draw_item().

643 {
644  RECT rt = {0, 0, 0, 0};
645 
646 /* DRAWTEXTPARAMS dtp = {sizeof(DRAWTEXTPARAMS), 2};
647  DrawTextEx(dis->hDC, (LPTSTR)str, -1, &rt, DT_CALCRECT|DT_SINGLELINE|DT_NOPREFIX|DT_EXPANDTABS|DT_TABSTOP, &dtp);*/
648 
650 
651  if (rt.right > _widths[col])
652  _widths[col] = rt.right;
653 }
#define DT_EXPANDTABS
Definition: winuser.h:532
#define DT_TABSTOP
Definition: winuser.h:541
LONG right
Definition: windef.h:298
CHAR * LPTSTR
Definition: xmlstorage.h:192
#define DrawText
Definition: winuser.h:5637
#define DT_CALCRECT
Definition: winuser.h:526
const WCHAR * str
#define DT_SINGLELINE
Definition: winuser.h:540
int _widths[COLUMNS]
Definition: pane.h:74

◆ calc_width()

void Pane::calc_width ( LPDRAWITEMSTRUCT  dis,
int  col,
LPCTSTR  str 
)
protected

Definition at line 632 of file pane.cpp.

Referenced by draw_item().

633 {
634  RECT rt = {0, 0, 0, 0};
635 
637 
638  if (rt.right > _widths[col])
639  _widths[col] = rt.right;
640 }
LONG right
Definition: windef.h:298
#define DT_NOPREFIX
Definition: winuser.h:537
CHAR * LPTSTR
Definition: xmlstorage.h:192
#define DrawText
Definition: winuser.h:5637
#define DT_CALCRECT
Definition: winuser.h:526
const WCHAR * str
#define DT_SINGLELINE
Definition: winuser.h:540
int _widths[COLUMNS]
Definition: pane.h:74

◆ calc_widths()

bool Pane::calc_widths ( bool  anyway)

Definition at line 178 of file pane.cpp.

Referenced by FileChildWindow::activate_entry(), command(), FileChildWindow::expand_entry(), init(), FileChildWindow::jump_to_int(), FileChildWindow::scan_entry(), and FileChildWindow::set_curdir().

179 {
180  int col, x, cx, spc=3*_out_wrkr._spaceSize.cx;
181  int entries = ListBox_GetCount(_hwnd);
182  int orgWidths[COLUMNS];
183  int orgPositions[COLUMNS+1];
184  HFONT hfontOld;
185  HDC hdc;
186  int cnt;
187 
188  if (!anyway) {
189  memcpy(orgWidths, _widths, sizeof(orgWidths));
190  memcpy(orgPositions, _positions, sizeof(orgPositions));
191  }
192 
193  for(col=0; col<COLUMNS; col++)
194  _widths[col] = 0;
195 
196  hdc = GetDC(_hwnd);
197  hfontOld = SelectFont(hdc, _out_wrkr._hfont);
198 
199  for(cnt=0; cnt<entries; cnt++) {
200  Entry* entry = (Entry*) ListBox_GetItemData(_hwnd, cnt);
201 
202  DRAWITEMSTRUCT dis;
203 
204  dis.CtlType = 0;
205  dis.CtlID = 0;
206  dis.itemID = 0;
207  dis.itemAction = 0;
208  dis.itemState = 0;
209  dis.hwndItem = _hwnd;
210  dis.hDC = hdc;
211  dis.rcItem.left = 0;
212  dis.rcItem.top = 0;
213  dis.rcItem.right = 0;
214  dis.rcItem.bottom = 0;
215  /*dis.itemData = 0; */
216 
217  draw_item(&dis, entry, COLUMNS);
218  }
219 
220  SelectObject(hdc, hfontOld);
221  ReleaseDC(_hwnd, hdc);
222 
223  x = 0;
224  for(col=0; col<COLUMNS; col++) {
225  _positions[col] = x;
226  cx = _widths[col];
227 
228  if (cx) {
229  cx += spc;
230 
231  if (cx < IMAGE_WIDTH)
232  cx = IMAGE_WIDTH;
233 
234  _widths[col] = cx;
235  }
236 
237  x += cx;
238  }
239 
240  _positions[COLUMNS] = x;
241 
242  ListBox_SetHorizontalExtent(_hwnd, x);
243 
244  // no change?
245  if (!memcmp(orgWidths, _widths, sizeof(orgWidths)))
246  return FALSE;
247 
248  // don't move, if only collapsing an entry
249  if (!anyway && _widths[0]<orgWidths[0] &&
250  !memcmp(orgWidths+1, _widths+1, sizeof(orgWidths)-sizeof(int))) {
251  _widths[0] = orgWidths[0];
252  memcpy(_positions, orgPositions, sizeof(orgPositions));
253 
254  return FALSE;
255  }
256 
257  InvalidateRect(_hwnd, 0, TRUE);
258 
259  return TRUE;
260 }
#define HDC
Definition: msvc.h:22
#define TRUE
Definition: types.h:120
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
HDC WINAPI GetDC(_In_opt_ HWND)
uint8_t entry
Definition: isohybrid.c:63
LONG top
Definition: windef.h:297
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
LONG left
Definition: windef.h:296
LONG right
Definition: windef.h:298
#define ListBox_SetHorizontalExtent(hwndCtl, cxExtent)
Definition: windowsx.h:471
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HDC hdc
Definition: msvc.h:53
HFONT _hfont
Definition: pane.h:61
LONG cx
Definition: windef.h:324
#define ListBox_GetItemData(hwndCtl, index)
Definition: windowsx.h:453
void draw_item(LPDRAWITEMSTRUCT dis, Entry *entry, int calcWidthCol=-1)
Definition: pane.cpp:298
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define SelectFont(hdc, hfont)
Definition: windowsx.h:486
SIZE _spaceSize
Definition: pane.h:59
int _widths[COLUMNS]
Definition: pane.h:74
INT x
Definition: msvc.h:62
OutputWorker _out_wrkr
Definition: pane.h:108
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
_Out_opt_ int * cx
Definition: commctrl.h:570
#define COLUMNS
Definition: pane.h:73
int _positions[COLUMNS+1]
Definition: pane.h:75
LONG bottom
Definition: windef.h:299
#define IMAGE_WIDTH
Definition: pane.cpp:38
#define ListBox_GetCount(hwndCtl)
Definition: windowsx.h:450
base of all file and directory entries
Definition: entries.h:82

◆ command()

BOOL Pane::command ( UINT  cmd)

Definition at line 942 of file pane.cpp.

Referenced by FileChildWindow::WndProc().

943 {
944  switch(cmd) {
945  case ID_VIEW_NAME:
946  if (_visible_cols) {
947  _visible_cols = 0;
948  calc_widths(true);
949  set_header();
950  InvalidateRect(_hwnd, 0, TRUE);
951  MenuInfo* menu_info = Frame_GetMenuInfo(GetParent(_hwnd));
952  if (menu_info) {
956  }
957  }
958  break;
959 
961  if (_visible_cols != COL_ALL) {
963  calc_widths(true);
964  set_header();
965  InvalidateRect(_hwnd, 0, TRUE);
966  MenuInfo* menu_info = Frame_GetMenuInfo(GetParent(_hwnd));
967  if (menu_info) {
971  }
972  }
973  break;
974 
975  case ID_PREFERED_SIZES: {
976  calc_widths(true);
977  set_header();
978  InvalidateRect(_hwnd, 0, TRUE);
979  break;}
980 
981  /*@todo more command ids... */
982 
983  default:
984  return FALSE;
985  }
986 
987  return TRUE;
988 }
#define TRUE
Definition: types.h:120
#define MF_BYCOMMAND
Definition: winuser.h:202
Definition: pane.h:45
int _visible_cols
Definition: pane.h:84
Definition: ftp_var.h:139
#define ID_VIEW_SELECTED_ATTRIBUTES
Definition: resource.h:134
bool calc_widths(bool anyway)
Definition: pane.cpp:178
#define ID_VIEW_ALL_ATTRIBUTES
Definition: resource.h:133
#define Frame_GetMenuInfo(hwnd)
Definition: window.h:282
void set_header()
Definition: pane.cpp:693
#define MF_CHECKED
Definition: winuser.h:132
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
DWORD WINAPI CheckMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
menu info structure
Definition: window.h:275
HWND WINAPI GetParent(_In_ HWND)
HMENU _hMenuView
Definition: window.h:277
#define ID_PREFERED_SIZES
Definition: resource.h:194
#define ID_VIEW_NAME
Definition: resource.h:132

◆ create_header()

bool Pane::create_header ( HWND  parent,
int  id 
)

Definition at line 127 of file pane.cpp.

Referenced by Pane().

128 {
129  HWND hwnd = CreateWindow(WC_HEADER, 0, WS_CHILD|WS_VISIBLE|HDS_HORZ/*@todo |HDS_BUTTONS + sort orders*/,
130  0, 0, 0, 0, hparent, (HMENU)id, g_Globals._hInstance, 0);
131  if (!hwnd)
132  return false;
133 
135 
136  HD_ITEM hdi;
137 
138  hdi.mask = HDI_TEXT|HDI_WIDTH|HDI_FORMAT;
139 
140  for(int idx=0; idx<COLUMNS; idx++) {
141  hdi.pszText = (TCHAR*)g_pos_names[idx];
142  hdi.fmt = HDF_STRING | g_pos_align[idx];
143  hdi.cxy = _widths[idx];
144  Header_InsertItem(hwnd, idx, &hdi);
145  }
146 
147  _hwndHeader = hwnd;
148 
149  return true;
150 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define CreateWindow
Definition: winuser.h:5620
#define HD_ITEM
Definition: commctrl.h:649
#define GetStockFont(i)
Definition: windowsx.h:283
#define SetWindowFont(hwnd, hfont, fRedraw)
Definition: windowsx.h:503
#define WS_CHILD
Definition: pedump.c:617
#define HDI_TEXT
Definition: commctrl.h:689
#define HDS_HORZ
Definition: commctrl.h:613
#define HDF_STRING
Definition: commctrl.h:705
#define Header_InsertItem(hwndHD, i, phdi)
Definition: commctrl.h:726
#define HDI_FORMAT
Definition: commctrl.h:690
unsigned int idx
Definition: utils.c:41
static const TCHAR * g_pos_names[COLUMNS]
Definition: pane.cpp:42
char TCHAR
Definition: xmlstorage.h:189
static const int g_pos_align[]
Definition: pane.cpp:57
#define DEFAULT_GUI_FONT
Definition: wingdi.h:907
HINSTANCE _hInstance
Definition: globals.h:270
ExplorerGlobals g_Globals
Definition: explorer.cpp:52
WindowHandle _hwndHeader
Definition: pane.h:77
int _widths[COLUMNS]
Definition: pane.h:74
HWND hwnd
Definition: winefile.c:116
#define WC_HEADER
Definition: commctrl.h:611
#define COLUMNS
Definition: pane.h:73
#define HDI_WIDTH
Definition: commctrl.h:687
#define WS_VISIBLE
Definition: pedump.c:620
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60

◆ draw_item()

void Pane::draw_item ( LPDRAWITEMSTRUCT  dis,
Entry entry,
int  calcWidthCol = -1 
)
Todo:
not in every case time enough

Definition at line 298 of file pane.cpp.

Referenced by calc_single_width(), calc_widths(), and FileChildWindow::WndProc().

299 {
301  DWORD attrs;
303  COLORREF bkcolor, textcolor;
304  RECT focusRect = dis->rcItem;
305  enum IMAGE img;
306  int img_pos, cx;
307  int col = 0;
308 
309  if (entry) {
310  attrs = entry->_data.dwFileAttributes;
311 
312  if (attrs & FILE_ATTRIBUTE_DIRECTORY) {
313  if (entry->_data.cFileName[0]==TEXT('.') && entry->_data.cFileName[1]==TEXT('.')
314  && entry->_data.cFileName[2]==TEXT('\0'))
315  img = IMG_FOLDER_UP;
316  else if (entry->_data.cFileName[0]==TEXT('.') && entry->_data.cFileName[1]==TEXT('\0'))
317  img = IMG_FOLDER_CUR;
318  else if ((_treePane && (dis->itemState&ODS_FOCUS)))
319  img = IMG_OPEN_FOLDER;
320  else
321  img = IMG_FOLDER;
322  } else {
323  if (attrs & ATTRIBUTE_EXECUTABLE)
324  img = IMG_EXECUTABLE;
325  else if (entry->_type_name)
326  img = IMG_DOCUMENT;
327  else
328  img = IMG_FILE;
329  }
330  } else {
331  attrs = 0;
332  img = IMG_NONE;
333  }
334 
335  if (_treePane) {
336  if (entry) {
337  img_pos = dis->rcItem.left + entry->_level*(IMAGE_WIDTH+_out_wrkr._spaceSize.cx);
338 
339  if (calcWidthCol == -1) {
340  int x;
341  int y = dis->rcItem.top + IMAGE_HEIGHT/2;
342  Entry* up;
343  RECT rt_clip;
344  HRGN hrgn_org = CreateRectRgn(0, 0, 0, 0);
345  HRGN hrgn;
346 
347  rt_clip.left = dis->rcItem.left;
348  rt_clip.top = dis->rcItem.top;
349  rt_clip.right = dis->rcItem.left+_widths[col];
350  rt_clip.bottom = dis->rcItem.bottom;
351 
352  hrgn = CreateRectRgnIndirect(&rt_clip);
353 
354  if (!GetClipRgn(dis->hDC, hrgn_org)) {
355  DeleteObject(hrgn_org);
356  hrgn_org = 0;
357  }
358 
359  //HGDIOBJ holdPen = SelectObject(dis->hDC, GetStockObject(BLACK_PEN));
360  ExtSelectClipRgn(dis->hDC, hrgn, RGN_AND);
361  DeleteObject(hrgn);
362 
363  if ((up=entry->_up) != NULL) {
364  MoveToEx(dis->hDC, img_pos-IMAGE_WIDTH/2, y, 0);
365  LineTo(dis->hDC, img_pos-2, y);
366 
367  x = img_pos - IMAGE_WIDTH/2;
368 
369  do {
371 
372  if (up->_next) {
373 #ifndef _LEFT_FILES
374  bool following_child = (up->_next->_data.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)!=0; // a directory?
375 
376  if (!following_child)
377  {
378  for(Entry*n=up->_next; n; n=n->_next)
379  if (n->_down) { // any file with NTFS sub-streams?
380  following_child = true;
381  break;
382  }
383  }
384  if (following_child)
385 #endif
386  {
387  MoveToEx(dis->hDC, x, dis->rcItem.top, 0);
388  LineTo(dis->hDC, x, dis->rcItem.bottom);
389  }
390  }
391  } while((up=up->_up) != NULL);
392  }
393 
394  x = img_pos - IMAGE_WIDTH/2;
395 
396  MoveToEx(dis->hDC, x, dis->rcItem.top, 0);
397  LineTo(dis->hDC, x, y);
398 
399  if (entry->_next) {
400 #ifndef _LEFT_FILES
401  bool following_child = (entry->_next->_data.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)!=0; // a directory?
402 
403  if (!following_child)
404  {
405  for(Entry*n=entry->_next; n; n=n->_next)
406  if (n->_down) { // any file with NTFS sub-streams?
407  following_child = true;
408  break;
409  }
410  }
411  if (following_child)
412 #endif
413  LineTo(dis->hDC, x, dis->rcItem.bottom);
414  }
415 
416  if (entry->_down && entry->_expanded) {
418  MoveToEx(dis->hDC, x, dis->rcItem.top+IMAGE_HEIGHT, 0);
419  LineTo(dis->hDC, x, dis->rcItem.bottom);
420  }
421 
422  SelectClipRgn(dis->hDC, hrgn_org);
423  if (hrgn_org) DeleteObject(hrgn_org);
424  //SelectObject(dis->hDC, holdPen);
425  } else if (calcWidthCol==col || calcWidthCol==COLUMNS) {
426  int right = img_pos + IMAGE_WIDTH - _out_wrkr._spaceSize.cx;
427 
428  if (right > _widths[col])
429  _widths[col] = right;
430  }
431  } else {
432  img_pos = dis->rcItem.left;
433  }
434  } else {
435  img_pos = dis->rcItem.left;
436 
437  if (calcWidthCol==col || calcWidthCol==COLUMNS)
438  _widths[col] = IMAGE_WIDTH;
439  }
440 
441  if (calcWidthCol == -1) {
442  focusRect.left = img_pos -2;
443 
444  if (attrs & FILE_ATTRIBUTE_COMPRESSED)
445  textcolor = _clrCompressed;
446  else
447  textcolor = RGB(0,0,0);
448 
449  if (dis->itemState & ODS_FOCUS) {
450  textcolor = GetSysColor(COLOR_HIGHLIGHTTEXT);
451  bkcolor = GetSysColor(COLOR_HIGHLIGHT);
452  } else {
453  bkcolor = GetSysColor(COLOR_WINDOW);
454  }
455 
456  HBRUSH hbrush = CreateSolidBrush(bkcolor);
457  FillRect(dis->hDC, &focusRect, hbrush);
458  DeleteObject(hbrush);
459 
460  SetBkMode(dis->hDC, TRANSPARENT);
461  SetTextColor(dis->hDC, textcolor);
462 
463  cx = _widths[col];
464 
465  if (cx && img!=IMG_NONE) {
466  if (cx > IMAGE_WIDTH)
467  cx = IMAGE_WIDTH;
468 
469  if (entry->_icon_id > ICID_NONE)
470  g_Globals._icon_cache.get_icon(entry->_icon_id).draw(dis->hDC, img_pos, dis->rcItem.top, cx, GetSystemMetrics(SM_CYSMICON), bkcolor, 0);
471  else
472  ImageList_DrawEx(_himl, img, dis->hDC,
473  img_pos, dis->rcItem.top, cx,
474  IMAGE_HEIGHT, bkcolor, CLR_DEFAULT, ILD_NORMAL);
475  }
476  }
477 
478  if (!entry)
479  return;
480 
481  ++col;
482 
483  // output file name
484  if (calcWidthCol == -1)
485  _out_wrkr.output_text(dis, _positions, col, entry->_display_name, 0);
486  else if (calcWidthCol==col || calcWidthCol==COLUMNS)
487  calc_width(dis, col, entry->_display_name);
488  ++col;
489 
490  // output type/class name
491  if (visible_cols & COL_TYPE) {
492  if (calcWidthCol == -1)
493  _out_wrkr.output_text(dis, _positions, col, entry->_type_name? entry->_type_name: TEXT(""), 0);
494  else if (calcWidthCol==col || calcWidthCol==COLUMNS)
495  calc_width(dis, col, entry->_type_name? entry->_type_name: TEXT(""));
496  }
497  ++col;
498 
499  // display file size
500  if (visible_cols & COL_SIZE) {
501  ULONGLONG size = ((ULONGLONG)entry->_data.nFileSizeHigh << 32) | entry->_data.nFileSizeLow;
502 
503  _stprintf(buffer, TEXT("%") LONGLONGARG TEXT("d"), size);
504 
505  if (calcWidthCol == -1)
506  _out_wrkr.output_number(dis, _positions, col, buffer);
507  else if (calcWidthCol==col || calcWidthCol==COLUMNS)
508  calc_width(dis, col, buffer);
509  }
510  ++col;
511 
512  // display file date
513  if (visible_cols & (COL_DATE|COL_TIME)) {
514  format_date(&entry->_data.ftCreationTime, buffer, visible_cols);
515  if (calcWidthCol == -1)
516  _out_wrkr.output_text(dis, _positions, col, buffer, 0);
517  else if (calcWidthCol==col || calcWidthCol==COLUMNS)
518  calc_width(dis, col, buffer);
519  ++col;
520 
521  format_date(&entry->_data.ftLastAccessTime, buffer, visible_cols);
522  if (calcWidthCol == -1)
523  _out_wrkr.output_text(dis,_positions, col, buffer, 0);
524  else if (calcWidthCol==col || calcWidthCol==COLUMNS)
525  calc_width(dis, col, buffer);
526  ++col;
527 
528  format_date(&entry->_data.ftLastWriteTime, buffer, visible_cols);
529  if (calcWidthCol == -1)
530  _out_wrkr.output_text(dis, _positions, col, buffer, 0);
531  else if (calcWidthCol==col || calcWidthCol==COLUMNS)
532  calc_width(dis, col, buffer);
533  ++col;
534  } else
535  col += 3;
536 
537  if (entry->_bhfi_valid) {
538  ULONGLONG index = ((ULONGLONG)entry->_bhfi.nFileIndexHigh << 32) | entry->_bhfi.nFileIndexLow;
539 
540  if (visible_cols & COL_INDEX) {
541  _stprintf(buffer, TEXT("%") LONGLONGARG TEXT("X"), index);
542 
543  if (calcWidthCol == -1)
544  _out_wrkr.output_text(dis, _positions, col, buffer, DT_RIGHT);
545  else if (calcWidthCol==col || calcWidthCol==COLUMNS)
546  calc_width(dis, col, buffer);
547 
548  ++col;
549  }
550 
551  if (visible_cols & COL_LINKS) {
552  wsprintf(buffer, TEXT("%d"), entry->_bhfi.nNumberOfLinks);
553 
554  if (calcWidthCol == -1)
555  _out_wrkr.output_text(dis, _positions, col, buffer, DT_RIGHT);
556  else if (calcWidthCol==col || calcWidthCol==COLUMNS)
557  calc_width(dis, col, buffer);
558 
559  ++col;
560  }
561  } else
562  col += 2;
563 
564  // show file attributes
565  if (visible_cols & COL_ATTRIBUTES) {
566  lstrcpy(buffer, TEXT(" \t \t \t \t \t \t \t \t \t \t \t \t \t \t "));
567 
568  if (attrs & FILE_ATTRIBUTE_NORMAL) buffer[ 0] = 'N';
569  else {
570  if (attrs & FILE_ATTRIBUTE_READONLY) buffer[ 2] = 'R';
571  if (attrs & FILE_ATTRIBUTE_HIDDEN) buffer[ 4] = 'H';
572  if (attrs & FILE_ATTRIBUTE_SYSTEM) buffer[ 6] = 'S';
573  if (attrs & FILE_ATTRIBUTE_ARCHIVE) buffer[ 8] = 'A';
574  if (attrs & FILE_ATTRIBUTE_COMPRESSED) buffer[10] = 'C';
575  if (attrs & FILE_ATTRIBUTE_DIRECTORY) buffer[12] = 'D';
576  if (attrs & FILE_ATTRIBUTE_ENCRYPTED) buffer[14] = 'E';
577  if (attrs & FILE_ATTRIBUTE_TEMPORARY) buffer[16] = 'T';
578  if (attrs & FILE_ATTRIBUTE_SPARSE_FILE) buffer[18] = 'P';
579  if (attrs & FILE_ATTRIBUTE_REPARSE_POINT) buffer[20] = 'Q';
580  if (attrs & FILE_ATTRIBUTE_OFFLINE) buffer[22] = 'O';
581  if (attrs & FILE_ATTRIBUTE_NOT_CONTENT_INDEXED) buffer[24] = 'X';
582  if (attrs & ATTRIBUTE_EXECUTABLE) buffer[26] = 'x';
583  if (attrs & ATTRIBUTE_SYMBOLIC_LINK) buffer[28] = 'L';
584  }
585 
586  if (calcWidthCol == -1)
587  _out_wrkr.output_tabbed_text(dis, _positions, col, buffer);
588  else if (calcWidthCol==col || calcWidthCol==COLUMNS)
589  calc_tabbed_width(dis, col, buffer);
590  }
591  ++col;
592 
593 /*TODO
594  if (flags.security) {
595  DWORD rights = get_access_mask();
596 
597  tcscpy(buffer, TEXT(" \t \t \t \t \t \t \t \t \t \t \t "));
598 
599  if (rights & FILE_READ_DATA) buffer[ 0] = 'R';
600  if (rights & FILE_WRITE_DATA) buffer[ 2] = 'W';
601  if (rights & FILE_APPEND_DATA) buffer[ 4] = 'A';
602  if (rights & FILE_READ_EA) {buffer[6] = 'entry'; buffer[ 7] = 'R';}
603  if (rights & FILE_WRITE_EA) {buffer[9] = 'entry'; buffer[10] = 'W';}
604  if (rights & FILE_EXECUTE) buffer[12] = 'X';
605  if (rights & FILE_DELETE_CHILD) buffer[14] = 'D';
606  if (rights & FILE_READ_ATTRIBUTES) {buffer[16] = 'a'; buffer[17] = 'R';}
607  if (rights & FILE_WRITE_ATTRIBUTES) {buffer[19] = 'a'; buffer[20] = 'W';}
608  if (rights & WRITE_DAC) buffer[22] = 'C';
609  if (rights & WRITE_OWNER) buffer[24] = 'O';
610  if (rights & SYNCHRONIZE) buffer[26] = 'S';
611 
612  output_text(dis, col++, buffer, DT_LEFT, 3, psize);
613  }
614 
615  if (flags.description) {
616  get_description(buffer);
617  output_text(dis, col++, buffer, 0, psize);
618  }
619 */
620  ++col;
621 
622  // output content / symbolic link target / comment
623  if (visible_cols & COL_CONTENT) {
624  if (calcWidthCol == -1)
625  _out_wrkr.output_text(dis, _positions, col, entry->_content? entry->_content: TEXT(""), 0);
626  else if (calcWidthCol==col || calcWidthCol==COLUMNS)
627  calc_width(dis, col, entry->_content? entry->_content: TEXT(""));
628  }
629 }
#define ATTRIBUTE_EXECUTABLE
Definition: entries.h:63
Entry * _next
Definition: entries.h:92
Definition: pane.h:36
#define COLOR_HIGHLIGHT
Definition: winuser.h:916
#define FILE_ATTRIBUTE_TEMPORARY
Definition: nt_native.h:708
static HBRUSH hbrush
#define FILE_ATTRIBUTE_SPARSE_FILE
Definition: ntifs_ex.h:380
#define IMAGE_HEIGHT
Definition: pane.cpp:39
void calc_tabbed_width(LPDRAWITEMSTRUCT dis, int col, LPCTSTR str)
Definition: pane.cpp:642
int WINAPI SelectClipRgn(_In_ HDC, _In_opt_ HRGN)
Entry * _up
Definition: entries.h:94
WIN32_FIND_DATA _data
Definition: entries.h:100
int _visible_cols
Definition: pane.h:84
#define FILE_ATTRIBUTE_SYSTEM
Definition: nt_native.h:704
BY_HANDLE_FILE_INFORMATION _bhfi
Definition: entries.h:110
Definition: pane.h:39
#define HRGN
Definition: msvc.h:39
HRGN WINAPI CreateRectRgnIndirect(_In_ LPCRECT)
LONG top
Definition: windef.h:297
#define ODS_FOCUS
Definition: winuser.h:2503
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
BOOL WINAPI LineTo(_In_ HDC, _In_ int, _In_ int)
GLuint buffer
Definition: glext.h:5915
#define SM_CYSMICON
Definition: winuser.h:1003
#define DT_RIGHT
Definition: winuser.h:538
LONG left
Definition: windef.h:296
void output_tabbed_text(LPDRAWITEMSTRUCT dis, int *positions, int col, LPCTSTR str)
Definition: pane.cpp:894
LONG right
Definition: windef.h:298
#define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED
Definition: ntifs_ex.h:384
#define COLOR_WINDOW
Definition: winuser.h:908
int _icon_id
Definition: entries.h:108
DWORD WINAPI GetSysColor(_In_ int)
bool _expanded
Definition: entries.h:96
INT INT y
Definition: msvc.h:62
#define RGN_AND
Definition: wingdi.h:354
#define up(mutex)
Definition: glue.h:30
GLuint n
Definition: s_context.h:57
BOOL WINAPI MoveToEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
int WINAPI ExtSelectClipRgn(_In_ HDC, _In_opt_ HRGN, _In_ int)
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1032
Definition: pane.h:38
Definition: pane.h:37
bool _bhfi_valid
Definition: entries.h:111
HIMAGELIST _himl
Definition: pane.h:107
#define TRANSPARENT
Definition: wingdi.h:948
LPTSTR _content
Definition: entries.h:105
smooth NULL
Definition: ftsmooth.c:416
#define BUFFER_LEN
Definition: utility.h:97
LONG cx
Definition: windef.h:324
bool _treePane
Definition: pane.h:85
Definition: pane.h:42
GLuint index
Definition: glext.h:6031
#define COLOR_HIGHLIGHTTEXT
Definition: winuser.h:917
void output_number(LPDRAWITEMSTRUCT dis, int *positions, int col, LPCTSTR str)
Definition: pane.cpp:910
#define FILE_ATTRIBUTE_REPARSE_POINT
Definition: ntifs_ex.h:381
void calc_width(LPDRAWITEMSTRUCT dis, int col, LPCTSTR str)
Definition: pane.cpp:632
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
HRGN WINAPI CreateRectRgn(_In_ int, _In_ int, _In_ int, _In_ int)
void output_text(LPDRAWITEMSTRUCT dis, int *positions, int col, LPCTSTR str, DWORD flags)
Definition: pane.cpp:881
char TCHAR
Definition: xmlstorage.h:189
GLsizeiptr size
Definition: glext.h:5919
IMAGE
Definition: pane.cpp:31
GLint GLvoid * img
Definition: gl.h:1956
Entry * _down
Definition: entries.h:93
uint64_t ULONGLONG
Definition: typedefs.h:65
Definition: pane.h:43
#define RGB(r, g, b)
Definition: wingdi.h:2917
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
int WINAPI GetSystemMetrics(_In_ int)
unsigned long DWORD
Definition: ntddk_ex.h:95
GLdouble GLdouble right
Definition: glext.h:10859
#define FILE_ATTRIBUTE_COMPRESSED
Definition: nt_native.h:711
#define FILE_ATTRIBUTE_ARCHIVE
Definition: nt_native.h:706
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
int visible_cols
Definition: winefile.c:124
static HRGN hrgn
Definition: win.c:55
#define LONGLONGARG
Definition: utility.h:108
ExplorerGlobals g_Globals
Definition: explorer.cpp:52
const Icon & get_icon(int icon_id)
Definition: explorer.cpp:625
int _level
Definition: entries.h:98
#define _stprintf
Definition: utility.h:124
LPTSTR _type_name
Definition: entries.h:104
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:784
SIZE _spaceSize
Definition: pane.h:59
int _widths[COLUMNS]
Definition: pane.h:74
#define TEXT(s)
Definition: k32.h:26
#define FILE_ATTRIBUTE_ENCRYPTED
Definition: ntifs_ex.h:385
INT x
Definition: msvc.h:62
#define lstrcpy
Definition: winbase.h:3688
#define FILE_ATTRIBUTE_HIDDEN
Definition: nt_native.h:703
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
OutputWorker _out_wrkr
Definition: pane.h:108
#define CLR_DEFAULT
Definition: commctrl.h:305
_Out_opt_ int * cx
Definition: commctrl.h:570
COLORREF _clrCompressed
Definition: pane.h:82
#define COLUMNS
Definition: pane.h:73
int _positions[COLUMNS+1]
Definition: pane.h:75
LONG bottom
Definition: windef.h:299
int WINAPI GetClipRgn(_In_ HDC, _In_ HRGN)
#define ILD_NORMAL
Definition: commctrl.h:402
#define wsprintf
Definition: winuser.h:5731
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
static void format_date(const FILETIME *ft, TCHAR *buffer, int visible_cols)
Definition: pane.cpp:263
DWORD COLORREF
Definition: windef.h:290
#define IMAGE_WIDTH
Definition: pane.cpp:38
#define ATTRIBUTE_SYMBOLIC_LINK
Definition: entries.h:62
base of all file and directory entries
Definition: entries.h:82
void draw(HDC hdc, int x, int y, int cx, int cy, COLORREF bk_color, HBRUSH bk_brush) const
Definition: explorer.cpp:277
BOOL WINAPI ImageList_DrawEx(HIMAGELIST himl, INT i, HDC hdc, INT x, INT y, INT dx, INT dy, COLORREF rgbBk, COLORREF rgbFg, UINT fStyle)
Definition: imagelist.c:1229
#define FILE_ATTRIBUTE_OFFLINE
Definition: nt_native.h:712
IconCache _icon_cache
Definition: globals.h:285
LPTSTR _display_name
Definition: entries.h:103

◆ get_frame()

MainFrameBase * Pane::get_frame ( )
protected

Definition at line 990 of file pane.cpp.

991 {
992  HWND owner = GetParent(_hwnd);
993 
994  return (MainFrameBase*)owner;
995 }
Explorer frame window base class.
Definition: mainframe.h:41
HWND WINAPI GetParent(_In_ HWND)

◆ init()

void Pane::init ( void  )

Definition at line 153 of file pane.cpp.

Referenced by Pane().

154 {
156 
158 
159  // read the color for compressed files from registry
160  HKEY hkeyExplorer = 0;
161  DWORD len = sizeof(_clrCompressed);
162 
163  if (RegOpenKey(HKEY_CURRENT_USER, TEXT("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer"), &hkeyExplorer) ||
164  RegQueryValueEx(hkeyExplorer, TEXT("AltColor"), 0, NULL, (LPBYTE)&_clrCompressed, &len) || len!=sizeof(_clrCompressed))
165  _clrCompressed = RGB(0,0,255);
166 
167  if (hkeyExplorer)
168  RegCloseKey(hkeyExplorer);
169 
170  // calculate column widths
171  _out_wrkr.init_output(_hwnd);
172  calc_widths(true);
173 }
#define RegQueryValueEx
Definition: winreg.h:524
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define SetWindowFont(hwnd, hfont, fRedraw)
Definition: windowsx.h:503
bool calc_widths(bool anyway)
Definition: pane.cpp:178
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
HIMAGELIST _himl
Definition: pane.h:107
HFONT _hfont
Definition: pane.h:61
smooth NULL
Definition: ftsmooth.c:416
#define RGB(r, g, b)
Definition: wingdi.h:2917
unsigned long DWORD
Definition: ntddk_ex.h:95
HINSTANCE _hInstance
Definition: globals.h:270
GLenum GLsizei len
Definition: glext.h:6722
ExplorerGlobals g_Globals
Definition: explorer.cpp:52
#define TEXT(s)
Definition: k32.h:26
#define IDB_IMAGES
Definition: resource.h:64
#define ImageList_LoadBitmap(hi, lpbmp, cx, cGrow, crMask)
Definition: commctrl.h:543
void init_output(HWND hwnd)
Definition: pane.cpp:865
OutputWorker _out_wrkr
Definition: pane.h:108
COLORREF _clrCompressed
Definition: pane.h:82
#define RegOpenKey
Definition: winreg.h:519

◆ insert_entries()

int Pane::insert_entries ( Entry dir,
int  idx = -1 
)

Definition at line 658 of file pane.cpp.

Referenced by FileChildWindow::expand_entry(), FileChildWindow::jump_to_int(), Pane(), FileChildWindow::scan_entry(), and FileChildWindow::set_curdir().

659 {
660  Entry* entry = dir;
661 
662  if (!entry)
663  return idx;
664 
665  for(; entry; entry=entry->_next) {
666 #ifndef _LEFT_FILES
667  if (_treePane &&
668  !(entry->_data.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) && // not a directory?
669  !entry->_down) // not a file with NTFS sub-streams?
670  continue;
671 #endif
672 
673  // don't display entries "." and ".." in the left pane
674  if (_treePane && (entry->_data.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)
675  && entry->_data.cFileName[0]==TEXT('.'))
676  if (entry->_data.cFileName[1]==TEXT('\0') ||
677  (entry->_data.cFileName[1]==TEXT('.') && entry->_data.cFileName[2]==TEXT('\0')))
678  continue;
679 
680  if (idx != -1)
681  ++idx;
682 
683  ListBox_InsertItemData(_hwnd, idx, entry);
684 
685  if (_treePane && entry->_expanded)
686  idx = insert_entries(entry->_down, idx);
687  }
688 
689  return idx;
690 }
Entry * _next
Definition: entries.h:92
WIN32_FIND_DATA _data
Definition: entries.h:100
uint8_t entry
Definition: isohybrid.c:63
int insert_entries(Entry *dir, int idx=-1)
Definition: pane.cpp:658
bool _expanded
Definition: entries.h:96
unsigned int idx
Definition: utils.c:41
bool _treePane
Definition: pane.h:85
unsigned int dir
Definition: maze.c:112
#define ListBox_InsertItemData(hwndCtl, index, data)
Definition: windowsx.h:462
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
Entry * _down
Definition: entries.h:93
#define TEXT(s)
Definition: k32.h:26
base of all file and directory entries
Definition: entries.h:82

◆ Notify()

int Pane::Notify ( int  id,
NMHDR pnmh 
)
virtual

Reimplemented from SubclassedWindow.

Definition at line 786 of file pane.cpp.

787 {
788  switch(pnmh->code) {
789  case HDN_TRACK:
790  case HDN_ENDTRACK: {
791  HD_NOTIFY* phdn = (HD_NOTIFY*) pnmh;
792  int idx = phdn->iItem;
793  int dx = phdn->pitem->cxy - _widths[idx];
794  int i;
795 
796  ClientRect clnt(_hwnd);
797 
798  // move immediate to simulate HDS_FULLDRAG (for now [04/2000] not realy needed with WINELIB)
799  Header_SetItem(_hwndHeader, idx, phdn->pitem);
800 
801  _widths[idx] += dx;
802 
803  for(i=idx; ++i<=COLUMNS; )
804  _positions[i] += dx;
805 
806  {
807  int scroll_pos = GetScrollPos(_hwnd, SB_HORZ);
808  RECT rt_scr;
809  RECT rt_clip;
810 
811  rt_scr.left = _positions[idx+1]-scroll_pos;
812  rt_scr.top = 0;
813  rt_scr.right = clnt.right;
814  rt_scr.bottom = clnt.bottom;
815 
816  rt_clip.left = _positions[idx]-scroll_pos;
817  rt_clip.top = 0;
818  rt_clip.right = clnt.right;
819  rt_clip.bottom = clnt.bottom;
820 
821  if (rt_scr.left < 0) rt_scr.left = 0;
822  if (rt_clip.left < 0) rt_clip.left = 0;
823 
824  ScrollWindowEx(_hwnd, dx, 0, &rt_scr, &rt_clip, 0, 0, SW_INVALIDATE);
825 
826  rt_clip.right = _positions[idx+1];
827  RedrawWindow(_hwnd, &rt_clip, 0, RDW_INVALIDATE|RDW_UPDATENOW);
828 
829  if (pnmh->code == HDN_ENDTRACK) {
831 
832  if (GetScrollPos(_hwnd, SB_HORZ) != scroll_pos)
833  set_header();
834  }
835  }
836 
837  return 0;
838  }
839 
840  case HDN_DIVIDERDBLCLICK: {
841  HD_NOTIFY* phdn = (HD_NOTIFY*) pnmh;
842  HD_ITEM item;
843 
844  calc_single_width(phdn->iItem);
845  item.mask = HDI_WIDTH;
846  item.cxy = _widths[phdn->iItem];
847 
848  Header_SetItem(_hwndHeader, phdn->iItem, &item);
849  InvalidateRect(_hwnd, 0, TRUE);
850  break;}
851 
852  default:
853  return super::Notify(id, pnmh);
854  }
855 
856  return 0;
857 }
BOOL WINAPI RedrawWindow(_In_opt_ HWND, _In_opt_ LPCRECT, _In_opt_ HRGN, _In_ UINT)
#define TRUE
Definition: types.h:120
#define HD_ITEM
Definition: commctrl.h:649
#define SB_HORZ
Definition: winuser.h:552
LONG top
Definition: windef.h:297
#define HDN_TRACK
Definition: commctrl.h:856
LONG left
Definition: windef.h:296
LONG right
Definition: windef.h:298
#define HDN_DIVIDERDBLCLICK
Definition: commctrl.h:853
#define ListBox_SetHorizontalExtent(hwndCtl, cxExtent)
Definition: windowsx.h:471
#define HD_NOTIFY
Definition: commctrl.h:861
UINT code
Definition: winuser.h:3112
GLenum GLclampf GLint i
Definition: glfuncs.h:14
unsigned int idx
Definition: utils.c:41
int WINAPI ScrollWindowEx(_In_ HWND, _In_ int, _In_ int, _In_opt_ LPCRECT, _In_opt_ LPCRECT, _In_opt_ HRGN, _Out_opt_ LPRECT, _In_ UINT)
void set_header()
Definition: pane.cpp:693
int WINAPI GetScrollPos(_In_ HWND, _In_ int)
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
WindowHandle _hwndHeader
Definition: pane.h:77
#define SW_INVALIDATE
Definition: winuser.h:2533
int _widths[COLUMNS]
Definition: pane.h:74
static ATOM item
Definition: dde.c:856
void calc_single_width(int col)
Definition: pane.cpp:726
#define RDW_UPDATENOW
Definition: winuser.h:1206
#define COLUMNS
Definition: pane.h:73
int _positions[COLUMNS+1]
Definition: pane.h:75
LONG bottom
Definition: windef.h:299
virtual int Notify(int id, NMHDR *pnmh)
Definition: window.cpp:353
#define Header_SetItem(hwndHD, i, phdi)
Definition: commctrl.h:743
#define HDN_ENDTRACK
Definition: commctrl.h:855
#define HDI_WIDTH
Definition: commctrl.h:687
#define RDW_INVALIDATE
Definition: winuser.h:1200
INT dx
Definition: msvc.h:65

◆ set_header()

void Pane::set_header ( )

Definition at line 693 of file pane.cpp.

Referenced by FileChildWindow::activate_entry(), command(), FileChildWindow::expand_entry(), FileChildWindow::jump_to_int(), Notify(), FileChildWindow::scan_entry(), FileChildWindow::set_curdir(), and WndProc().

694 {
695  HD_ITEM item;
696  int scroll_pos = GetScrollPos(_hwnd, SB_HORZ);
697  int i=0, x=0;
698 
699  item.mask = HDI_WIDTH;
700  item.cxy = 0;
701 
702  for(; i<COLUMNS; i++) {
703  if (x + _widths[i] >= scroll_pos)
704  break;
705 
706  x += _widths[i];
707  Header_SetItem(_hwndHeader, i, &item);
708  }
709 
710  if (i < COLUMNS) {
711  x += _widths[i];
712  item.cxy = x - scroll_pos;
713  Header_SetItem(_hwndHeader, i++, &item);
714 
715  for(; i<COLUMNS; i++) {
716  item.cxy = _widths[i];
717  x += _widths[i];
718  Header_SetItem(_hwndHeader, i, &item);
719  }
720  }
721 }
#define HD_ITEM
Definition: commctrl.h:649
#define SB_HORZ
Definition: winuser.h:552
GLenum GLclampf GLint i
Definition: glfuncs.h:14
int WINAPI GetScrollPos(_In_ HWND, _In_ int)
WindowHandle _hwndHeader
Definition: pane.h:77
int _widths[COLUMNS]
Definition: pane.h:74
static ATOM item
Definition: dde.c:856
INT x
Definition: msvc.h:62
#define COLUMNS
Definition: pane.h:73
#define Header_SetItem(hwndHD, i, phdi)
Definition: commctrl.h:743
#define HDI_WIDTH
Definition: commctrl.h:687

◆ WndProc()

LRESULT Pane::WndProc ( UINT  nmsg,
WPARAM  wparam,
LPARAM  lparam 
)
protectedvirtual

Reimplemented from SubclassedWindow.

Definition at line 98 of file pane.cpp.

99 {
100  switch(nmsg) {
101  case WM_HSCROLL:
102  set_header();
103  break;
104 
105  case WM_SETFOCUS: {
107 
108  child->set_focus_pane(this);
109  ListBox_SetSel(_hwnd, TRUE, 1);
110  /*@todo check menu items */
111  break;}
112 
113  case WM_KEYDOWN: {
115 
116  if (wparam == VK_TAB) {
117  /*@todo SetFocus(g_Globals.hdrivebar) */
118  child->switch_focus_pane();
119  }
120  break;}
121  }
122 
123  return super::WndProc(nmsg, wparam, lparam);
124 }
MDI child window displaying file lists.
Definition: filechild.h:88
#define TRUE
Definition: types.h:120
#define PM_GET_FILEWND_PTR
Definition: explorer.h:61
#define VK_TAB
Definition: winuser.h:2153
static HWND child
Definition: cursoricon.c:298
#define WM_KEYDOWN
Definition: winuser.h:1691
void set_focus_pane(Pane *pane)
Definition: filechild.h:124
void set_header()
Definition: pane.cpp:693
void switch_focus_pane()
Definition: filechild.h:127
UINT WPARAM LPARAM lparam
Definition: msvc.h:92
HWND WINAPI GetParent(_In_ HWND)
#define ListBox_SetSel(hwndCtl, fSelect, index)
Definition: windowsx.h:474
#define WM_HSCROLL
Definition: winuser.h:1719
virtual LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: window.cpp:343
#define SendMessage
Definition: winuser.h:5709
#define WM_SETFOCUS
Definition: winuser.h:1595
UINT WPARAM wparam
Definition: msvc.h:92

Member Data Documentation

◆ _clrCompressed

COLORREF Pane::_clrCompressed

Definition at line 82 of file pane.h.

Referenced by draw_item(), and init().

◆ _cur

◆ _himl

HIMAGELIST Pane::_himl
protected

Definition at line 107 of file pane.h.

Referenced by draw_item(), init(), and ~Pane().

◆ _hwndHeader

WindowHandle Pane::_hwndHeader

Definition at line 77 of file pane.h.

Referenced by create_header(), Notify(), FileChildWindow::resize_children(), and set_header().

◆ _out_wrkr

OutputWorker Pane::_out_wrkr
protected

Definition at line 108 of file pane.h.

Referenced by calc_single_width(), calc_widths(), draw_item(), and init().

◆ _positions

int Pane::_positions[COLUMNS+1]

Definition at line 75 of file pane.h.

Referenced by calc_single_width(), calc_widths(), draw_item(), and Notify().

◆ _root

Entry* Pane::_root

Definition at line 79 of file pane.h.

Referenced by Pane(), and FileChildWindow::set_curdir().

◆ _treePane

bool Pane::_treePane

Definition at line 85 of file pane.h.

Referenced by FileChildWindow::activate_entry(), draw_item(), and insert_entries().

◆ _visible_cols

int Pane::_visible_cols

Definition at line 84 of file pane.h.

Referenced by command(), and draw_item().

◆ _widths

◆ cur

◆ hwnd

◆ hwndHeader

HWND Pane::hwndHeader

Definition at line 117 of file winefile.c.

Referenced by pane_notify(), resize_tree(), and set_header().

◆ positions

int Pane::positions[COLUMNS+1]

◆ root

Entry* Pane::root

◆ treePane

BOOL Pane::treePane

Definition at line 123 of file winefile.c.

Referenced by activate_entry(), alloc_child_window(), draw_item(), and insert_entries().

◆ visible_cols

int Pane::visible_cols

Definition at line 124 of file winefile.c.

Referenced by alloc_child_window(), draw_item(), draw_item(), and pane_command().

◆ widths


The documentation for this struct was generated from the following files: