> Reading the documentation I couldn't find any reference to it.
>
Yes, this is specific to operating system and a task of window mangager. 
If you are using windows, it had had been possible to do this, by a 
simple call of system functions. But using Vista or Win7 this doesn't 
work any more - it is a common known problem, that these systems now 
ignore TOPMOST flag and it is not likely, that MS will fix this. I had 
this problem last week, when visiting a customer in austria with a new 
Win7-PC and I was botherd and angry and felt pure hate, because things 
went wrong after 13 years of function. I'm so happy to use Linux right 
now, but GNOME doesn't provide TOPMOST ability at all (only advantage 
is, that Linux users are not used to it).

#include <windows.h>
#include <FL/Fl_Window.H>

void Show_Topmost(Fl_Window* pWindow)
{
HWND hWnd= fl_xid(pWindow);     
SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
}

bool Is_Topmost(Fl_Window* pWindow)
{
HWND hWnd= fl_xid(pWindow);     
WINDOWINFO pwi;
if (GetWindowInfo(hWnd, &pwi)) return pwi.dwExStyle & WS_EX_TOPMOST;
else return false;
}

void Clear_Topmost(Fl_Window* pWindow)
{
HWND hWnd= fl_xid(pWindow);     
SetWindowPos(hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
}

void Show_Foreground(Fl_Window* pWindow)
{
HWND hWnd= fl_xid(pWindow);     
if (GetForegroundWindow() != hWnd)
    {
        DWORD fgwpid = GetWindowThreadProcessId(GetForegroundWindow(),NULL);
       DWORD mypid  = GetWindowThreadProcessId(hWnd, NULL);
       AttachThreadInput(mypid, fgwpid, TRUE);
       BringWindowToTop(hWnd);
       SetForegroundWindow(hWnd);
       AttachThreadInput(mypid, fgwpid, FALSE);
    }
}

bool Is_Foreground(Fl_Window* pWindow)
{
return GetForegroundWindow()== fl_xid(pWindow);
}

void Show_Background(Fl_Window* pWindow)
{
HWND hWnd= fl_xid(pWindow);     
SetWindowPos(hWnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
}

bool Show_Maximized(Fl_Window* pWindow)
{
HWND hWnd= fl_xid(pWindow);     
ShowWindow(hWnd, SW_MAXIMIZE);
return hWnd;
}

void Show_Minimized(Fl_Window* pWindow)
{
HWND hWnd= fl_xid(pWindow);     
ShowWindow(hWnd, SW_MINIMIZE);
}

void Show_Normal(Fl_Window* pWindow)
{
HWND hWnd= fl_xid(pWindow);     
ShowWindow(hWnd, SW_SHOWNORMAL);
}

bool Is_Maximized(Fl_Window* pWindow)
{
HWND hWnd= fl_xid(pWindow);     
WINDOWINFO pwi;
if (GetWindowInfo(hWnd, &pwi)) return pwi.dwStyle & WS_MAXIMIZE;
else return false;
}

bool Is_Minimized(Fl_Window* pWindow)
{
HWND hWnd= fl_xid(pWindow);     
WINDOWINFO pwi;
if (GetWindowInfo(hWnd, &pwi)) return pwi.dwExStyle & WS_MINIMIZE;
else return false;
}




_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to