UI: Region polling support #105088
|
@ -5079,11 +5079,6 @@ static int userpref_show_exec(bContext *C, wmOperator *op)
|
|||
region->flag |= RGN_FLAG_HIDDEN;
|
||||
ED_region_visibility_change_update(C, area, region);
|
||||
|
||||
/* And also show the region with "Load & Save" buttons. */
|
||||
region = BKE_area_find_region_type(area, RGN_TYPE_EXECUTE);
|
||||
region->flag &= ~RGN_FLAG_HIDDEN;
|
||||
ED_region_visibility_change_update(C, area, region);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
BKE_report(op->reports, RPT_ERROR, "Failed to open window!");
|
||||
|
|
|
@ -65,7 +65,7 @@ static SpaceLink *userpref_create(const ScrArea *area, const Scene *UNUSED(scene
|
|||
BLI_addtail(&spref->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_EXECUTE;
|
||||
region->alignment = RGN_ALIGN_BOTTOM | RGN_SPLIT_PREV;
|
||||
region->flag |= RGN_FLAG_DYNAMIC_SIZE | RGN_FLAG_HIDDEN;
|
||||
region->flag |= RGN_FLAG_DYNAMIC_SIZE;
|
||||
|
||||
/* main region */
|
||||
region = MEM_callocN(sizeof(ARegion), "main region for userpref");
|
||||
|
@ -162,6 +162,13 @@ static void userpref_navigation_region_draw(const bContext *C, ARegion *region)
|
|||
ED_region_panels(C, region);
|
||||
}
|
||||
|
||||
static bool userpref_execute_region_poll(const bContext *C)
|
||||
{
|
||||
const ScrArea *area = CTX_wm_area(C);
|
||||
const ARegion *region_header = BKE_area_find_region_type(area, RGN_TYPE_HEADER);
|
||||
return !region_header->visible;
|
||||
}
|
||||
|
||||
/* add handlers, stuff you only do once or on area/region changes */
|
||||
static void userpref_execute_region_init(wmWindowManager *wm, ARegion *region)
|
||||
{
|
||||
|
@ -243,6 +250,7 @@ void ED_spacetype_userpref(void)
|
|||
art = MEM_callocN(sizeof(ARegionType), "spacetype userpref region");
|
||||
art->regionid = RGN_TYPE_EXECUTE;
|
||||
art->prefsizey = HEADERY;
|
||||
art->poll = userpref_execute_region_poll;
|
||||
art->init = userpref_execute_region_init;
|
||||
art->layout = ED_region_panels_layout;
|
||||
art->draw = ED_region_panels_draw;
|
||||
|
|
Loading…
Reference in New Issue