Esempio n. 1
0
wxWindow* wxWindow::GetWindowChild(wxWindowID id)
{
    wxWindow* win = GetWindowChild1(id);
    if ( !win )
    {
        HWND hwnd = ::GetDlgItem(GetHwnd(), id);
        if ( hwnd )
        {
            win = CreateWindowFromHWND(this, (WXHWND) hwnd);
        }
    }

    return win;
}
Esempio n. 2
0
bool wxWindow::LoadNativeDialog(wxWindow* parent, const wxString& name)
{
    SetName(name);

    wxWindowCreationHook hook(this);
    m_hWnd = (WXHWND)::CreateDialog((HINSTANCE) wxGetInstance(),
                                    name.c_str(),
                                    parent ? (HWND)parent->GetHWND() : 0,
                                    (DLGPROC)wxDlgProc);

    if ( !m_hWnd )
        return false;

    SubclassWin(GetHWND());

    if ( parent )
        parent->AddChild(this);
    else
        wxTopLevelWindows.Append(this);

    // Enumerate all children
    HWND hWndNext;
    hWndNext = ::GetWindow((HWND) m_hWnd, GW_CHILD);

    if (hWndNext)
        CreateWindowFromHWND(this, (WXHWND) hWndNext);

    while (hWndNext != (HWND) NULL)
    {
        hWndNext = ::GetWindow(hWndNext, GW_HWNDNEXT);
        if (hWndNext)
            CreateWindowFromHWND(this, (WXHWND) hWndNext);
    }

    return true;
}
Esempio n. 3
0
bool wxWindow::LoadNativeDialog (
  wxWindow*                         pParent
, wxWindowID&                       vId
)
{
    wxWindow*                       pChild = NULL;
    HWND                            hWndOwner;
    HWND                            hWndNext = NULLHANDLE;
    HENUM                           hEnum;

    if (pParent)
        hWndOwner = GetHwndOf(pParent);
    else
        hWndOwner = HWND_DESKTOP;

    m_windowId = vId;
    wxWndHook  = this;

    m_hWnd = ::WinLoadDlg( HWND_DESKTOP
                          ,hWndOwner
                          ,(PFNWP)wxDlgProc
                          ,NULL
                          ,(ULONG)131 // Caption dialog from the resource file
                          ,(PVOID)this
                         );
    wxWndHook = NULL;

    if ( !m_hWnd )
        return FALSE;

    SubclassWin(GetHWND());

    if (pParent)
        pParent->AddChild(this);
    else
        wxTopLevelWindows.Append(this);

    //
    // Enumerate the children
    //
    hEnum = ::WinBeginEnumWindows(GetHwndOf(pParent));
    while ((hWndNext = ::WinGetNextWindow(hEnum)) != NULLHANDLE)
        pChild = CreateWindowFromHWND( this
                                      ,(WXHWND)hWndNext
                                     );
    ::WinEndEnumWindows(hEnum);
    return TRUE;
} // end of wxWindow::LoadNativeDialog
Esempio n. 4
0
wxWindow* wxWindow::GetWindowChild (
  wxWindowID                        vId
)
{
    wxWindow*                       pWin = GetWindowChild1(vId);

    if (!pWin)
    {
        HWND                        hWnd = 0; // TODO: ::GetDlgItem((HWND) GetHWND(), id);

        if (hWnd)
        {
            wxWindow*               pChild = CreateWindowFromHWND( this
                                                                  ,(WXHWND)hWnd
                                                                 );
            if (pChild)
            {
                pChild->AddChild(this);
                return pChild;
            }
        }
    }
    return NULL;
} // end of wxWindow::GetWindowChild