Add 'size' cursor type

This commit is contained in:
Nikita Lisitsa 2022-12-17 15:18:32 +03:00
parent 5f7da5ddc5
commit 87c612a0eb
2 changed files with 7 additions and 0 deletions

View file

@ -14,6 +14,7 @@ namespace psemek::sdl2
arrow, arrow,
beam, beam,
hand, hand,
size,
}; };
struct cursor; struct cursor;

View file

@ -58,6 +58,7 @@ namespace psemek::sdl2
arrow_.cursor.reset(create_system_cursor(SDL_SYSTEM_CURSOR_ARROW)); arrow_.cursor.reset(create_system_cursor(SDL_SYSTEM_CURSOR_ARROW));
beam_.cursor.reset(create_system_cursor(SDL_SYSTEM_CURSOR_IBEAM)); beam_.cursor.reset(create_system_cursor(SDL_SYSTEM_CURSOR_IBEAM));
hand_.cursor.reset(create_system_cursor(SDL_SYSTEM_CURSOR_HAND)); hand_.cursor.reset(create_system_cursor(SDL_SYSTEM_CURSOR_HAND));
size_.cursor.reset(create_system_cursor(SDL_SYSTEM_CURSOR_SIZEALL));
} }
cursor const & get(cursor_type type) const override cursor const & get(cursor_type type) const override
@ -67,6 +68,7 @@ namespace psemek::sdl2
case cursor_type::arrow: return arrow_; case cursor_type::arrow: return arrow_;
case cursor_type::beam: return beam_; case cursor_type::beam: return beam_;
case cursor_type::hand: return hand_; case cursor_type::hand: return hand_;
case cursor_type::size: return size_;
} }
throw util::unknown_enum_value_exception<cursor_type>(type); throw util::unknown_enum_value_exception<cursor_type>(type);
@ -76,6 +78,7 @@ namespace psemek::sdl2
cursor arrow_; cursor arrow_;
cursor beam_; cursor beam_;
cursor hand_; cursor hand_;
cursor size_;
}; };
cursor_ptr create_image_cursor(image_cursor_description desc) cursor_ptr create_image_cursor(image_cursor_description desc)
@ -99,6 +102,7 @@ namespace psemek::sdl2
arrow_.cursor = create_image_cursor(image_provider(cursor_type::arrow)); arrow_.cursor = create_image_cursor(image_provider(cursor_type::arrow));
beam_.cursor = create_image_cursor(image_provider(cursor_type::beam)); beam_.cursor = create_image_cursor(image_provider(cursor_type::beam));
hand_.cursor = create_image_cursor(image_provider(cursor_type::hand)); hand_.cursor = create_image_cursor(image_provider(cursor_type::hand));
size_.cursor = create_image_cursor(image_provider(cursor_type::size));
} }
cursor const & get(cursor_type type) const override cursor const & get(cursor_type type) const override
@ -108,6 +112,7 @@ namespace psemek::sdl2
case cursor_type::arrow: return arrow_; case cursor_type::arrow: return arrow_;
case cursor_type::beam: return beam_; case cursor_type::beam: return beam_;
case cursor_type::hand: return hand_; case cursor_type::hand: return hand_;
case cursor_type::size: return size_;
} }
throw util::unknown_enum_value_exception<cursor_type>(type); throw util::unknown_enum_value_exception<cursor_type>(type);
@ -117,6 +122,7 @@ namespace psemek::sdl2
cursor arrow_; cursor arrow_;
cursor beam_; cursor beam_;
cursor hand_; cursor hand_;
cursor size_;
}; };
} }