Exemple #1
0
static void winCanvasUnMapMethod(Ihandle* ih)
{
  if (iupAttribGetBoolean(ih, "MDICLIENT")) 
  {
    /* hide the MDI client window to avoid multiple re-paints */
    ShowWindow(ih->handle, SW_HIDE);

    /* must destroy all MDI Children */
    winCanvasMDICloseChildren(ih);

    DestroyWindow(ih->handle);

    /* mdiclient class is not a IUP class, must return here */
    return;
  }

  iupwinTipsDestroy(ih);
  iupwinDestroyDragDrop(ih);

  /* remove the association before destroying */
  iupwinHandleRemove(ih->handle);

  /* remove from parent and destroys window */
  SetParent(ih->handle, NULL);
  DestroyWindow(ih->handle);
}
Exemple #2
0
static void winDialogUnMapMethod(Ihandle* ih)
{
    if (ih->data->menu)
    {
        ih->data->menu->handle = NULL; /* the dialog will destroy the native menu */
        IupDestroy(ih->data->menu);
    }

    if (iupAttribGet(ih, "_IUPDLG_HASTRAY"))
        winDialogSetTrayAttrib(ih, NULL);

    iupwinTipsDestroy(ih);
    iupwinDestroyDragDrop(ih);

    /* remove the association before destroying */
    iupwinHandleRemove(ih->handle);

    /* Destroys the window, so we can destroy the class */
    if (iupAttribGetBoolean(ih, "MDICHILD"))
    {
        /* for MDICHILDs must send WM_MDIDESTROY, instead of calling DestroyWindow */
        Ihandle* client = (Ihandle*)iupAttribGet(ih, "MDICLIENT_HANDLE");
        SendMessage(client->handle, WM_MDIDESTROY, (WPARAM)ih->handle, 0);

        winDialogMDIRefreshMenu(ih);
    }
    else
        DestroyWindow(ih->handle); /* this will destroy the Windows children also. */
    /* but IupDestroy already destroyed the IUP children */
    /* so it is safe to call DestroyWindow */
}
Exemple #3
0
/********************************************************************
** Frees window and class. Also destroys Ihandle information stored
** inside the window USERDATA atribute.
********************************************************************/
static void winDestroyFreeWindowClass(Ihandle *n)
{
  char cname[255];

  SetLastError(0);
  GetClassName(handle(n), cname, 255);
  assert(GetLastError() == 0);

  /* Ihandle will not be found when WM_DESTROY is called */
  iupwinHandleRemove(n);

  if (iupCheck(n, "MDICLIENT")==YES) /* mdiclient class is not a IUP class */
  {
    HWND hwndT;

    /* hide the MDI client window to avoid multiple repaints */
    ShowWindow((HWND)handle(n), SW_HIDE);

    /* As long as the MDI client has a child, destroy it */
    while (hwndT = GetWindow((HWND)handle(n), GW_CHILD))
    {
      Ihandle* child;

	    /* Skip the icon title windows */
	    while (hwndT && GetWindow (hwndT, GW_OWNER))
	      hwndT = GetWindow (hwndT, GW_HWNDNEXT);

	    if (!hwndT)
	        break;

      child = iupwinHandleGet(hwndT); 
      if (child)
        IupDestroy(child);
    }

    return;
  }

  SetClassLongPtr((HWND)handle(n), GCLP_HBRBACKGROUND, 0);
  SetClassLongPtr((HWND)handle(n), GCLP_HCURSOR,       0);
  SetWindowLongPtr((HWND)handle(n), GWLP_WNDPROC,      0);

  /* Destroys window, so we can destroy the class */
  SetLastError(0);
  if (iupCheck(n, "MDICHILD")==YES) 
  {
    Ihandle* client = (Ihandle*)iupGetEnv(n, "_IUPWIN_MDICLIENT");
    SendMessage((HWND)handle(client), WM_MDIDESTROY, (WPARAM)handle(n), 0);
  }
  else
    DestroyWindow(handle(n));

/*  iupwinShowLastError(); */

  SetLastError(0);
  UnregisterClass(cname, iupwin_hinstance);
}
void iupwinTipsDestroy(Ihandle* ih)
{
  HWND tips_hwnd = (HWND)iupAttribGet(ih, "_IUPWIN_TIPSWIN");
  if (tips_hwnd)
  {
    winTipsSendMessage(ih, tips_hwnd, TTM_DELTOOL);

    iupAttribSet(ih, "_IUPWIN_TIPSWIN", NULL);

    iupwinHandleRemove(tips_hwnd);
    DestroyWindow(tips_hwnd);
  }
}
Exemple #5
0
static void winListUnMapMethod(Ihandle* ih)
{
  HWND handle;

  winListRemoveAllItemData(ih);

  handle = (HWND)iupAttribGet(ih, "_IUPWIN_LISTBOX");
  if (handle)
  {
    iupwinHandleRemove(handle);
    iupAttribSetStr(ih, "_IUPWIN_LISTBOX", NULL);
  }

  handle = (HWND)iupAttribGet(ih, "_IUPWIN_EDITBOX");
  if (handle)
  {
    iupwinHandleRemove(handle);
    iupAttribSetStr(ih, "_IUPWIN_EDITBOX", NULL);
  }

  iupdrvBaseUnMapMethod(ih);
}
void iupdrvBaseUnMapMethod(Ihandle* ih)
{
  WNDPROC oldProc = (WNDPROC)IupGetCallback(ih, "_IUPWIN_OLDWNDPROC_CB");
  if (oldProc)
  {
    SetWindowLongPtr(ih->handle, GWLP_WNDPROC, (LONG_PTR)oldProc);
    IupSetCallback(ih, "_IUPWIN_OLDWNDPROC_CB",  NULL);
  }

  iupwinTipsDestroy(ih);
  iupwinDestroyDragDrop(ih);

  /* remove the association before destroying */
  iupwinHandleRemove(ih->handle);

  /* destroys window (it will remove from parent) */
  DestroyWindow(ih->handle);
}
Exemple #7
0
static void winDestroyWindow(Ihandle *n)
{
  assert(n);
  if(!n)
    return;

  if(type(n) == DIALOG_)
  {
    Ihandle *menu = IupGetAttributeHandle(n, IUP_MENU);
    if (menu) 
    {
      handle(menu) = NULL; /* the dialog will destroy the menu */
      IupDestroy(menu);  
    }

    /* if this is a popup window, this will also end the message loop */
    IupHide(n); 
    
    /* Deletes window and associated window class */
    winDestroyFreeWindowClass(n);
  }
  else if(type(n) == CANVAS_)
  {
    winDestroyFreeWindowClass(n);
  }
  else if(type(n) == MULTILINE_ || type(n) == TEXT_)
  {
    winDestroyRemoveProc(n, handle(n), "_IUPWIN_TEXTOLDPROC__");
    iupwinHandleRemove(n);
    DestroyWindow(handle(n));
  }
  else if(type(n) == LABEL_ || type(n) == LIST_ || type(n) == TOGGLE_)
  {
    if (type(n) == TOGGLE_)
      winDestroyRemoveProc(n, handle(n), "_IUPWIN_TOGGLEOLDPROC__");
    else if (type(n) == LIST_)
    {
      winDestroyRemoveProc(n, (HWND)IupGetAttribute(n, "_IUPWIN_EDITBOX"), "_IUPWIN_TEXTOLDPROC__");
      winDestroyRemoveProc(n, (HWND)IupGetAttribute(n, "_IUPWIN_COMBOBOX"), "_IUPWIN_COMBOLISTOLDPROC__");
    }
    else if (type(n) == LABEL_)
    {
      winDestroyRemoveProc(n, handle(n), "_IUPWIN_BUTTONOLDPROC__");
    }
    iupwinHandleRemove(n);
    DestroyWindow(handle(n));
  }
  else if(type(n) == BUTTON_)
  {
    winDestroyRemoveProc(n, handle(n), "_IUPWIN_BUTTONOLDPROC__");
    iupwinHandleRemove(n);
    DestroyWindow(handle(n));
  }
  else if(type(n) == IMAGE_)
  {
    winDestroyImage(n);
  }
  else if(type(n) == FRAME_)
  {
    winDestroyRemoveProc(n, handle(n), "_IUPWIN_FRAMEOLDPROC__");
    iupwinHandleRemove(n);
    DestroyWindow(handle(n));
  }
  else if(type(n) == MENU_)
  {
    assert(number(n)!=-1); 
    iupwinCleanidIhandle(number(n));
    if (handle(n)) DestroyMenu(handle(n));  /* Destroy Menu is recursive */
  }
  else if(type(n) == SUBMENU_)
  {
    assert(number(n)!=-1); 
    iupwinCleanidIhandle(number(n));
    /* DestroyWindows is automatically called by the system */
  }
  else if(type(n) == ITEM_ || type(n) == SEPARATOR_)
  {
    assert(number(n)!=-1); 
    iupwinCleanidIhandle(number(n));
    /* DestroyWindows is automatically called by the system */
  }
}