> Also, how to disable the maximize button in my window? 

It is automatically disabled, when the Fl_Window is not resizable.

> (If there is no portable way, then how to do it on windows, and how to
> #ifdef that section of code then?)

Think I posted it before, but here comes my set of functions. You really 
don't know, how to use #ifdef? Did you ever write software before?

//===============================================================================
#include <windows.h>
#include <FL/Fl_Window.H>
#include <#include <FL/x.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