Blender  V3.3
interface_regions.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2008 Blender Foundation. All rights reserved. */
3 
12 #include "BLI_listbase.h"
13 #include "BLI_utildefines.h"
14 #include "MEM_guardedalloc.h"
15 
16 #include "BKE_context.h"
17 #include "BKE_screen.h"
18 
19 #include "WM_api.h"
20 #include "wm_draw.h"
21 
22 #include "ED_screen.h"
23 
25 
27 {
28  ARegion *region = MEM_cnew<ARegion>(__func__);
29  BLI_addtail(&screen->regionbase, region);
30 
32  region->alignment = RGN_ALIGN_FLOAT;
33 
34  return region;
35 }
36 
38 {
39  wmWindow *win = CTX_wm_window(C);
40 
42  BLI_assert(BLI_findindex(&screen->regionbase, region) != -1);
43  if (win) {
44  wm_draw_region_clear(win, region);
45  }
46 
47  ED_region_exit(C, region);
48  BKE_area_region_free(nullptr, region); /* nullptr: no spacetype */
49  BLI_freelinkN(&screen->regionbase, region);
50 }
struct wmWindow * CTX_wm_window(const bContext *C)
Definition: context.c:723
void BKE_area_region_free(struct SpaceType *st, struct ARegion *region)
Definition: screen.c:626
#define BLI_assert(a)
Definition: BLI_assert.h:46
void BLI_freelinkN(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:239
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:80
int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
@ RGN_TYPE_TEMPORARY
@ RGN_ALIGN_FLOAT
void ED_region_exit(struct bContext *C, struct ARegion *region)
Definition: screen_edit.c:686
Read Guarded memory(de)allocation.
#define C
Definition: RandGen.cpp:25
void ui_region_temp_remove(bContext *C, bScreen *screen, ARegion *region)
ARegion * ui_region_temp_add(bScreen *screen)
short alignment
short regiontype
ListBase regionbase
void wm_draw_region_clear(wmWindow *win, ARegion *UNUSED(region))
Definition: wm_draw.c:1354