diff options
Diffstat (limited to 'source/blender/editors/space_userpref')
-rw-r--r-- | source/blender/editors/space_userpref/space_userpref.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/source/blender/editors/space_userpref/space_userpref.c b/source/blender/editors/space_userpref/space_userpref.c index 06c6e612f13..87da461f269 100644 --- a/source/blender/editors/space_userpref/space_userpref.c +++ b/source/blender/editors/space_userpref/space_userpref.c @@ -47,6 +47,8 @@ #include "WM_api.h" #include "WM_types.h" +#include "UI_interface.h" + /* ******************** default callbacks for userpref space ***************** */ @@ -59,6 +61,13 @@ static SpaceLink *userpref_new(const ScrArea *UNUSED(area), const Scene *UNUSED( spref = MEM_callocN(sizeof(SpaceUserPref), "inituserpref"); spref->spacetype = SPACE_USERPREF; + /* navigation region */ + ar = MEM_callocN(sizeof(ARegion), "navigation region for userpref"); + + BLI_addtail(&spref->regionbase, ar); + ar->regiontype = RGN_TYPE_NAV_BAR; + ar->alignment = RGN_ALIGN_LEFT; + /* header */ ar = MEM_callocN(sizeof(ARegion), "header for userpref"); @@ -136,6 +145,19 @@ static void userpref_header_region_draw(const bContext *C, ARegion *ar) ED_region_header(C, ar); } +/* add handlers, stuff you only do once or on area/region changes */ +static void userpref_navigation_region_init(wmWindowManager *wm, ARegion *ar) +{ + ar->v2d.scroll = V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HIDE; + + ED_region_panels_init(wm, ar); +} + +static void userpref_navigation_region_draw(const bContext *C, ARegion *ar) +{ + ED_region_panels(C, ar); +} + static void userpref_main_region_listener( wmWindow *UNUSED(win), ScrArea *UNUSED(sa), ARegion *UNUSED(ar), wmNotifier *UNUSED(wmn), const Scene *UNUSED(scene)) @@ -156,6 +178,13 @@ static void userpref_header_listener( #endif } +static void userpref_navigation_region_listener( + wmWindow *UNUSED(win), ScrArea *UNUSED(sa), ARegion *UNUSED(ar), + wmNotifier *UNUSED(wmn), const Scene *UNUSED(scene)) +{ + /* context changes */ +} + /* only called once, from space/spacetypes.c */ void ED_spacetype_userpref(void) { @@ -193,6 +222,17 @@ void ED_spacetype_userpref(void) BLI_addhead(&st->regiontypes, art); + /* regions: navigation window */ + art = MEM_callocN(sizeof(ARegionType), "spacetype userpref region"); + art->regionid = RGN_TYPE_NAV_BAR; + art->prefsizex = UI_NAVIGATION_REGION_WIDTH; + art->init = userpref_navigation_region_init; + art->draw = userpref_navigation_region_draw; + art->listener = userpref_navigation_region_listener; + art->keymapflag = ED_KEYMAP_UI; + + BLI_addhead(&st->regiontypes, art); + BKE_spacetype_register(st); } |