Public Member Functions | Public Attributes

Desktops Struct Reference

#include <globals.h>

Inheritance diagram for Desktops:
Inheritance graph
[legend]
Collaboration diagram for Desktops:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Desktops ()
 ~Desktops ()
void init ()
void SwitchToDesktop (int idx)
void ToggleMinimize ()
 minimize/restore all windows on the desktop

Public Attributes

int _current_desktop

Detailed Description

Definition at line 240 of file globals.h.


Constructor & Destructor Documentation

Desktops::Desktops (  )

Definition at line 66 of file desktop.cpp.

 :  _current_desktop(0)
{
}
Desktops::~Desktops (  )

Definition at line 71 of file desktop.cpp.

{
     // show all hidden windows
    for(iterator it_dsk=begin(); it_dsk!=end(); ++it_dsk)
        for(WindowSet::iterator it=it_dsk->_windows.begin(); it!=it_dsk->_windows.end(); ++it)
            ShowWindowAsync(*it, SW_SHOW);
}

Member Function Documentation

void Desktops::init (  )

Definition at line 79 of file desktop.cpp.

References DESKTOP_COUNT.

Referenced by _tWinMain().

{
    resize(DESKTOP_COUNT);

#ifdef _USE_HDESK
    DesktopPtr& desktop = (*this)[0];

    desktop = DesktopPtr(new Desktop(OpenInputDesktop(0, FALSE, DESKTOP_SWITCHDESKTOP)));
#endif
}

Here is the caller graph for this function:

void Desktops::SwitchToDesktop ( int  idx )

Definition at line 165 of file desktop.cpp.

References _current_desktop, ExplorerGlobals::_hwndDesktopBar, Desktop::_hwndForeground, Desktop::_windows, g_Globals, HWND, and PM_GET_LAST_ACTIVE.

Referenced by DesktopBar::Command().

{
    if (_current_desktop == idx)
        return;

    Desktop& old_desktop = (*this)[_current_desktop];
    WindowSet& windows = old_desktop._windows;
    Desktop& desktop = (*this)[idx];

    windows.clear();

     // collect window handles of all other desktops
    WindowSet other_wnds;
    for(const_iterator it1=begin(); it1!=end(); ++it1)
        for(WindowSet::const_iterator it2=it1->_windows.begin(); it2!=it1->_windows.end(); ++it2)
            other_wnds.insert(*it2);

     // save currently visible application windows
    EnumWindows(SwitchDesktopEnumFct, (LPARAM)&windows);

    old_desktop._hwndForeground = (HWND)SendMessage(g_Globals._hwndDesktopBar, PM_GET_LAST_ACTIVE, 0, 0);

     // hide all windows of the previous desktop
    for(WindowSet::iterator it=windows.begin(); it!=windows.end(); ++it)
        ShowWindowAsync(*it, SW_HIDE);

     // show all windows of the new desktop
    for(WindowSet::iterator it=desktop._windows.begin(); it!=desktop._windows.end(); ++it)
        ShowWindowAsync(*it, SW_SHOW);

    if (desktop._hwndForeground)
        SetForegroundWindow(desktop._hwndForeground);

     // remove the window handles of the other desktops from what we found on the previous desktop
    for(WindowSet::const_iterator it=other_wnds.begin(); it!=other_wnds.end(); ++it)
        windows.erase(*it);

     // We don't need to store the window handles of what's now visible the now current desktop.
    desktop._windows.clear();

    _current_desktop = idx;
}

Here is the caller graph for this function:

void Desktops::ToggleMinimize (  )

minimize/restore all windows on the desktop

Definition at line 231 of file desktop.cpp.

References _current_desktop.

Referenced by DesktopBar::Command().

{
    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();
    }
}

Here is the caller graph for this function:


Member Data Documentation

Definition at line 253 of file globals.h.

Referenced by QuickLaunchBar::AddShortcuts(), SwitchToDesktop(), and ToggleMinimize().


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

ROS Explorer Source Code Documentation
generated on 02.01.2013 by doxygen

ROS Explorer Homepage