mirror of
https://github.com/reactos/reactos.git
synced 2025-02-25 01:39:30 +00:00
implemented 'minimize all' feature
svn path=/trunk/; revision=8433
This commit is contained in:
parent
44c383eeef
commit
ae26b09eb5
3 changed files with 39 additions and 3 deletions
|
@ -158,7 +158,7 @@ int DesktopThread::Run()
|
|||
|
||||
#else // _USE_HDESK
|
||||
|
||||
static BOOL CALLBACK DesktopEnumFct(HWND hwnd, LPARAM lparam)
|
||||
static BOOL CALLBACK SwitchDesktopEnumFct(HWND hwnd, LPARAM lparam)
|
||||
{
|
||||
WindowSet& windows = *(WindowSet*)lparam;
|
||||
|
||||
|
@ -181,7 +181,7 @@ void Desktops::SwitchToDesktop(int idx)
|
|||
WindowSet& windows = old_desktop._windows;
|
||||
|
||||
windows.clear();
|
||||
EnumWindows(DesktopEnumFct, (LPARAM)&windows);
|
||||
EnumWindows(SwitchDesktopEnumFct, (LPARAM)&windows);
|
||||
|
||||
// hide all windows we found
|
||||
for(WindowSet::iterator it=windows.begin(); it!=windows.end(); ++it)
|
||||
|
@ -199,6 +199,36 @@ void Desktops::SwitchToDesktop(int idx)
|
|||
#endif // _USE_HDESK
|
||||
|
||||
|
||||
static BOOL CALLBACK MinimizeDesktopEnumFct(HWND hwnd, LPARAM lparam)
|
||||
{
|
||||
list<MinimizeStruct>& minimized = *(list<MinimizeStruct>*)lparam;
|
||||
|
||||
if (IsWindowVisible(hwnd))
|
||||
if (hwnd!=g_Globals._hwndDesktopBar && hwnd!=g_Globals._hwndDesktop)
|
||||
if (!IsIconic(hwnd)) {
|
||||
minimized.push_back(MinimizeStruct(hwnd, GetWindowStyle(hwnd)));
|
||||
ShowWindowAsync(hwnd, SW_MINIMIZE);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/// minimize/restore all windows on the desktop
|
||||
void Desktops::ToggleMinimize()
|
||||
{
|
||||
list<MinimizeStruct>& minimized = (*this)[_current_desktop]._minimized;
|
||||
|
||||
if (minimized.empty()) {
|
||||
EnumWindows(MinimizeDesktopEnumFct, (LPARAM)&minimized);
|
||||
} else {
|
||||
for(list<MinimizeStruct>::const_iterator it=minimized.begin(); it!=minimized.end(); ++it)
|
||||
ShowWindowAsync(it->first, it->second&WS_MAXIMIZE? SW_MAXIMIZE: SW_RESTORE);
|
||||
|
||||
minimized.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BOOL IsAnyDesktopRunning()
|
||||
{
|
||||
HINSTANCE hUser32 = GetModuleHandle(TEXT("user32"));
|
||||
|
|
|
@ -177,9 +177,12 @@ protected:
|
|||
|
||||
#else
|
||||
|
||||
typedef pair<HWND, DWORD> MinimizeStruct;
|
||||
|
||||
struct Desktop
|
||||
{
|
||||
set<HWND> _windows;
|
||||
list<MinimizeStruct> _minimized;
|
||||
};
|
||||
typedef Desktop DesktopRef;
|
||||
|
||||
|
@ -195,6 +198,7 @@ struct Desktops : public vector<DesktopRef>
|
|||
|
||||
void init();
|
||||
void SwitchToDesktop(int idx);
|
||||
void ToggleMinimize();
|
||||
|
||||
#ifdef _USE_HDESK
|
||||
DesktopRef& get_current_Desktop() {return (*this)[_current_desktop];}
|
||||
|
|
|
@ -131,7 +131,9 @@ LRESULT DesktopBar::Init(LPCREATESTRUCT pcs)
|
|||
rbBand.cxMinChild = 0;
|
||||
rbBand.cyMinChild = HIWORD(SendMessage(_hwndQuickLaunch, TB_GETBUTTONSIZE, 0, 0)) + 2;
|
||||
rbBand.cx = 250;
|
||||
LOG(TEXT("before RB_INSERTBAND"));
|
||||
SendMessage(_hwndrebar, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbBand);
|
||||
LOG(TEXT("after RB_INSERTBAND"));
|
||||
|
||||
rbBand.lpText = TEXT("Taskbar");
|
||||
rbBand.hwndChild = _hwndTaskBar;
|
||||
|
@ -280,7 +282,7 @@ int DesktopBar::Command(int id, int code)
|
|||
break;
|
||||
|
||||
case ID_MINIMIZE_ALL:
|
||||
; ///@todo minimize/restore all windows on the desktop
|
||||
g_Globals._desktops.ToggleMinimize();
|
||||
break;
|
||||
|
||||
case ID_EXPLORE:
|
||||
|
|
Loading…
Reference in a new issue