示例#1
0
static LRESULT CALLBACK winDialogMDIChildProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
{
    LRESULT result;
    Ihandle *ih = iupwinHandleGet(hwnd);
    if (!ih)
    {
        /* the first time WM_GETMINMAXINFO is called, Ihandle is not associated yet */
        if (msg == WM_GETMINMAXINFO && winMinMaxHandle)
        {
            if (winDialogCheckMinMaxInfo(winMinMaxHandle, (MINMAXINFO*)lp))
                return 0;
        }

        return DefMDIChildProc(hwnd, msg, wp, lp);
    }

    if (msg == WM_MDIACTIVATE)
    {
        HWND hNewActive = (HWND)lp;
        if (hNewActive == ih->handle)
        {
            Icallback cb = (Icallback)IupGetCallback(ih, "MDIACTIVATE_CB");
            if (cb) cb(ih);
        }
    }

    if (winDialogBaseProc(ih, msg, wp, lp, &result))
        return result;

    return DefMDIChildProc(hwnd, msg, wp, lp);
}
示例#2
0
static LRESULT CALLBACK winDialogMDIFrameProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
{
    LRESULT result;
    HWND hWndClient = NULL;
    Ihandle *ih = iupwinHandleGet(hwnd);
    if (!ih)
    {
        /* the first time WM_GETMINMAXINFO is called, Ihandle is not associated yet */
        if (msg == WM_GETMINMAXINFO && winMinMaxHandle)
        {
            if (winDialogCheckMinMaxInfo(winMinMaxHandle, (MINMAXINFO*)lp))
                return 0;
        }

        return DefFrameProc(hwnd, hWndClient, msg, wp, lp);
    }

    {
        Ihandle* client = (Ihandle*)iupAttribGet(ih, "MDICLIENT_HANDLE");
        if (client) hWndClient = client->handle;
    }

    if (winDialogBaseProc(ih, msg, wp, lp, &result))
        return result;

    if (msg == WM_MENUCOMMAND)
    {
        int menuId = GetMenuItemID((HMENU)lp, (int)wp);
        if (menuId >= IUP_MDI_FIRSTCHILD && hWndClient)
        {
            /* we manually activate the MDI child when its menu item is selected. */
            HWND hChild = GetDlgItem(hWndClient, menuId);
            if (hChild)
                SendMessage(hWndClient, WM_MDIACTIVATE, (WPARAM)hChild, 0);
        }
        else if (menuId >= SC_SIZE && menuId <= SC_CONTEXTHELP)
        {
            /* we manually forward the message to the MDI child */
            HWND hChild = (HWND)SendMessage(hWndClient, WM_MDIGETACTIVE, 0, 0);
            if (hChild)
                SendMessage(hChild, WM_SYSCOMMAND, (WPARAM)menuId, 0);
        }
    }

    return DefFrameProc(hwnd, hWndClient, msg, wp, lp);
}
示例#3
0
static LRESULT CALLBACK winDialogMDIFrameProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
{   
  LRESULT result;
  HWND hWndClient = NULL;
  Ihandle *ih = iupwinHandleGet(hwnd); 
  if (!ih)
  {
    /* the first time WM_GETMINMAXINFO is called, Ihandle is not associated yet */
    if (msg == WM_GETMINMAXINFO && winMinMaxHandle)
    {
      if (winDialogCheckMinMaxInfo(winMinMaxHandle, (MINMAXINFO*)lp))
        return 0;
    }

    return DefFrameProc(hwnd, hWndClient, msg, wp, lp);
  }

  {
    Ihandle* client = (Ihandle*)iupAttribGet(ih, "MDICLIENT_HANDLE");
    if (client) hWndClient = client->handle;
  }

  if (winDialogBaseProc(ih, msg, wp, lp, &result))
    return result;

  switch (msg)
  {
  case WM_MENUCOMMAND:
    {
      int menuId = GetMenuItemID((HMENU)lp, (int)wp);
      if (menuId >= IUP_MDICHILD_START && hWndClient)
      {
        Ihandle* child = winDialogGetMdiChildId(ih, menuId-IUP_MDICHILD_START);
        if (child)
          SendMessage(hWndClient, WM_MDIACTIVATE, (WPARAM)child->handle, 0);
        break;
      }
    }
  }


  return DefFrameProc(hwnd, hWndClient, msg, wp, lp);
}
示例#4
0
static LRESULT CALLBACK winDialogProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
{
    LRESULT result;
    Ihandle *ih = iupwinHandleGet(hwnd);
    if (!ih)
    {
        /* the first time WM_GETMINMAXINFO is called, Ihandle is not associated yet */
        if (msg == WM_GETMINMAXINFO && winMinMaxHandle)
        {
            if (winDialogCheckMinMaxInfo(winMinMaxHandle, (MINMAXINFO*)lp))
                return 0;
        }

        return DefWindowProc(hwnd, msg, wp, lp);
    }

    if (winDialogBaseProc(ih, msg, wp, lp, &result))
        return result;

    return DefWindowProc(hwnd, msg, wp, lp);
}