/*
- * Copyright 2003 Martin Fuchs
+ * Copyright 2003, 2004 Martin Fuchs
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
//
+#include "utility/xmlstorage.h"
+
+using namespace XMLStorage;
+
+#include "taskbar/favorites.h"
+
+
/// management of file types
struct FileTypeInfo {
String _classname;
+ String _displayname;
bool _neverShowExt;
};
typedef map<String, FileTypeInfo> super;
const FileTypeInfo& operator[](String ext);
+
+ static bool is_exe_file(LPCTSTR ext);
+
+ LPCTSTR set_type(struct Entry* entry, bool dont_hide_ext=false);
};
ICID_NETWORK,
ICID_COMPUTER,
ICID_LOGOFF,
+ ICID_BOOKMARK,
ICID_DYNAMIC
};
struct Icon {
- ICON_ID _id;
- ICON_TYPE _itype;
- HICON _hIcon;
-
Icon();
Icon(ICON_ID id, UINT nid);
Icon(ICON_TYPE itype, int id, HICON hIcon);
+ Icon(ICON_TYPE itype, int id, int sys_idx);
+
+ operator ICON_ID() const {return _id;}
+
+ void draw(HDC hdc, int x, int y, int cx, int cy, COLORREF bk_color, HBRUSH bk_brush) const;
+ HBITMAP create_bitmap(COLORREF bk_color, HBRUSH hbrBkgnd, HDC hdc_wnd) const;
+ int add_to_imagelist(HIMAGELIST himl, HDC hdc_wnd, COLORREF bk_color=GetSysColor(COLOR_WINDOW), HBRUSH bk_brush=GetSysColorBrush(COLOR_WINDOW)) const;
+
+ int get_sysiml_idx() const {return _itype==IT_SYSCACHE? _sys_idx: -1;}
+
+ bool destroy() {if (_itype == IT_DYNAMIC) {DestroyIcon(_hicon); return true;} else return false;}
+
+protected:
+ ICON_ID _id;
+ ICON_TYPE _itype;
+ HICON _hicon;
+ int _sys_idx;
+};
+
+struct SysCacheIcon : public Icon {
+ SysCacheIcon(int id, int sys_idx)
+ : Icon(IT_SYSCACHE, id, sys_idx) {}
};
struct IconCache {
+ IconCache() : _himlSys(0) {}
+
void init();
+ const Icon& extract(const String& path);
+ const Icon& extract(LPCTSTR path, int idx);
const Icon& extract(IExtractIcon* pExtract, LPCTSTR path, int idx);
- const Icon& extract_from_file(LPCTSTR path, int idx);
- const Icon& add(HICON hIcon);
- const Icon& add_cached(HICON hIcon, LPCTSTR path, int idx);
+ const Icon& add(HICON hIcon, ICON_TYPE type=IT_DYNAMIC);
+ const Icon& add(int sys_idx/*, ICON_TYPE type=IT_SYSCACHE*/);
const Icon& get_icon(int icon_id);
- HBITMAP get_icon_bitmap(int icon_id, HBRUSH hbrBkgnd, HDC hdc);
+ HIMAGELIST get_sys_imagelist() const {return _himlSys;}
void free_icon(int icon_id);
protected:
+ static int s_next_id;
+
typedef map<int, Icon> IconMap;
+ IconMap _icons;
- typedef pair<String, int> CachePair;
- typedef map<CachePair, ICON_ID> CacheMap;
+ typedef map<String, ICON_ID> PathMap;
+ PathMap _pathMap;
- static int s_next_id;
+ typedef pair<String, int> CachePair;
+ typedef map<CachePair, ICON_ID> PathIdxMap;
+ PathIdxMap _pathIdxMap;
- IconMap _icons;
- CacheMap _cache_map;
+ HIMAGELIST _himlSys;
};
/// create a bitmap from an icon
extern HBITMAP create_bitmap_from_icon(HICON hIcon, HBRUSH hbrush_bkgnd, HDC hdc_wnd);
+ /// add icon with alpha channel to imagelist using the specified background color
+extern int ImageList_AddAlphaIcon(HIMAGELIST himl, HICON hIcon, HBRUSH hbrush_bkgnd, HDC hdc_wnd);
+
+ /// retrieve icon from window
+extern HICON get_window_icon_small(HWND hwnd);
+extern HICON get_window_icon_big(HWND hwnd, bool allow_from_class=true);
+
+
+ /// desktop management
+#ifdef _USE_HDESK
+
+typedef auto_ptr<struct DesktopThread> DesktopThreadPtr;
+
+struct Desktop
+{
+ HDESK _hdesktop;
+// HWINSTA _hwinsta;
+ DesktopThreadPtr _pThread;
+ WindowHandle _hwndDesktop;
+
+ Desktop(HDESK hdesktop=0/*, HWINSTA hwinsta=0*/);
+ ~Desktop();
+};
+
+typedef auto_ptr<Desktop> DesktopPtr;
+typedef DesktopPtr DesktopRef;
+
+ /// Thread class for additional desktops
+struct DesktopThread : public Thread
+{
+ DesktopThread(Desktop& desktop)
+ : _desktop(desktop)
+ {
+ }
+
+ int Run();
+
+protected:
+ Desktop& _desktop;
+};
+
+#else
+
+typedef pair<HWND, DWORD> MinimizeStruct;
+
+struct Desktop
+{
+ set<HWND> _windows;
+ WindowHandle _hwndForeground;
+ list<MinimizeStruct> _minimized;
+};
+typedef Desktop DesktopRef;
+
+#endif
+
+
+#define DESKTOP_COUNT 4
+
+struct Desktops : public vector<DesktopRef>
+{
+ Desktops();
+ ~Desktops();
+
+ void init();
+ void SwitchToDesktop(int idx);
+ void ToggleMinimize();
+
+#ifdef _USE_HDESK
+ DesktopRef& get_current_Desktop() {return (*this)[_current_desktop];}
+#endif
+
+ int _current_desktop;
+};
+
/// structure containing global variables of Explorer
extern struct ExplorerGlobals
{
ExplorerGlobals();
- void init(HINSTANCE hInstance);
+ void init(HINSTANCE hInstance);
+
+ void read_persistent();
+ void write_persistent();
+
+ XMLPos get_cfg();
+ XMLPos get_cfg(const char* path);
HINSTANCE _hInstance;
- ATOM _hframeClass;
UINT _cfStrFName;
+
+#ifndef ROSSHELL
+ ATOM _hframeClass;
HWND _hMainWnd;
- bool _prescan_nodes;
bool _desktop_mode;
+ bool _prescan_nodes;
+#endif
FILE* _log;
FileTypeManager _ftype_mgr;
IconCache _icon_cache;
+
+ HWND _hwndDesktopBar;
+ HWND _hwndShellView;
+ HWND _hwndDesktop;
+
+ Desktops _desktops;
+
+ XMLDoc _cfg;
+ String _cfg_dir;
+ String _cfg_path;
+
+ Favorites _favorites;
+ String _favorites_path;
} g_Globals;
{
ResIcon(UINT nid);
- operator HICON() const {return _hIcon;}
+ operator HICON() const {return _hicon;}
protected:
- HICON _hIcon;
+ HICON _hicon;
};
/// convenient loading of small (16x16) icon resources
{
SmallIcon(UINT nid);
- operator HICON() const {return _hIcon;}
+ operator HICON() const {return _hicon;}
protected:
- HICON _hIcon;
+ HICON _hicon;
};
/// convenient loading of icon resources with specified sizes
{
ResIconEx(UINT nid, int w, int h);
- operator HICON() const {return _hIcon;}
+ operator HICON() const {return _hicon;}
protected:
- HICON _hIcon;
+ HICON _hicon;
};
/// set big and small icons out of the resources for a window