Incorporating Vas Crabb feedback

This commit is contained in:
Nathan Woods 2016-06-14 00:00:30 -04:00
parent 9fe7064f4e
commit c9b8f74548
6 changed files with 17 additions and 6 deletions

View File

@ -364,13 +364,16 @@ void menu_file_selector::custom_render(void *selectedref, float top, float botto
// custom_mouse_down - perform our special mouse down
//-------------------------------------------------
void menu_file_selector::custom_mouse_down()
bool menu_file_selector::custom_mouse_down()
{
if (m_hover_directory.length() > 0)
{
m_current_directory = m_hover_directory;
reset(reset_options::SELECT_FIRST);
return true;
}
return false;
}

View File

@ -68,7 +68,9 @@ public:
virtual void populate() override;
virtual void handle() override;
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
virtual void custom_mouse_down() override;
protected:
virtual bool custom_mouse_down() override;
private:
enum file_selector_entry_type

View File

@ -914,7 +914,9 @@ void menu::handle_events(UINT32 flags)
{
// if we are hovering over a valid item, select it with a single click
case UI_EVENT_MOUSE_DOWN:
custom_mouse_down();
if (custom_mouse_down())
return;
if ((flags & PROCESS_ONLYCHAR) == 0)
{
if (hover >= 0 && hover < item.size())

View File

@ -70,7 +70,6 @@ public:
// configure the menu for custom rendering
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2);
virtual void custom_mouse_down() { }
// allocate temporary memory from the menu's memory pool
void *m_pool_alloc(size_t size);
@ -288,6 +287,9 @@ protected:
void extra_text_position(float origx1, float origx2, float origy, float yspan, text_layout &layout,
int direction, float &x1, float &y1, float &x2, float &y2);
// custom events
virtual bool custom_mouse_down() { return false; }
template <typename T>
static T *topmost_menu() { return dynamic_cast<T *>(menu_stack.get()); }

View File

@ -22,7 +22,7 @@ INLINE FUNCTIONS
// is_space_character
//-------------------------------------------------
static inline bool is_space_character(unicode_char ch)
inline bool is_space_character(unicode_char ch)
{
return ch == ' ';
}
@ -33,7 +33,7 @@ static inline bool is_space_character(unicode_char ch)
// character a possible line break?
//-------------------------------------------------
static inline bool is_breakable_char(unicode_char ch)
inline bool is_breakable_char(unicode_char ch)
{
// regular spaces and hyphens are breakable
if (is_space_character(ch) || ch == '-')

View File

@ -93,6 +93,8 @@ private:
size_t span;
};
// this should really be "positioned glyph" as glyphs != characters, but
// we'll get there eventually
struct positioned_char
{
unicode_char character;