improve text_editor
improve user experience
This commit is contained in:
parent
5917b1eb36
commit
17153b991f
@ -19,7 +19,6 @@
|
|||||||
#include "text_editor_part.hpp"
|
#include "text_editor_part.hpp"
|
||||||
#include <nana/unicode_bidi.hpp>
|
#include <nana/unicode_bidi.hpp>
|
||||||
|
|
||||||
//#include <nana/paint/graphics.hpp>
|
|
||||||
#include <nana/gui/detail/general_events.hpp>
|
#include <nana/gui/detail/general_events.hpp>
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
@ -163,7 +162,7 @@ namespace nana{ namespace widgets
|
|||||||
bool select(bool);
|
bool select(bool);
|
||||||
|
|
||||||
/// Sets the end position of a selected string.
|
/// Sets the end position of a selected string.
|
||||||
void set_end_caret();
|
void set_end_caret(bool stay_in_view);
|
||||||
|
|
||||||
bool hit_text_area(const point&) const;
|
bool hit_text_area(const point&) const;
|
||||||
bool hit_select_area(nana::upoint pos, bool ignore_when_select_all) const;
|
bool hit_select_area(nana::upoint pos, bool ignore_when_select_all) const;
|
||||||
@ -197,7 +196,7 @@ namespace nana{ namespace widgets
|
|||||||
void move_ns(bool to_north); //Moves up and down
|
void move_ns(bool to_north); //Moves up and down
|
||||||
void move_left();
|
void move_left();
|
||||||
void move_right();
|
void move_right();
|
||||||
const upoint& mouse_caret(const point& screen_pos);
|
const upoint& mouse_caret(const point& screen_pos, bool stay_in_view);
|
||||||
const upoint& caret() const;
|
const upoint& caret() const;
|
||||||
point caret_screen_pos() const;
|
point caret_screen_pos() const;
|
||||||
bool scroll(bool upwards, bool vertical);
|
bool scroll(bool upwards, bool vertical);
|
||||||
@ -223,12 +222,8 @@ namespace nana{ namespace widgets
|
|||||||
|
|
||||||
bool _m_accepts(char_type) const;
|
bool _m_accepts(char_type) const;
|
||||||
::nana::color _m_bgcolor() const;
|
::nana::color _m_bgcolor() const;
|
||||||
bool _m_scroll_text(bool vertical);
|
|
||||||
void _m_scrollbar();
|
|
||||||
|
|
||||||
::nana::rectangle _m_text_area() const;
|
void _m_reset_content_size();
|
||||||
|
|
||||||
void _m_get_scrollbar_size();
|
|
||||||
void _m_reset();
|
void _m_reset();
|
||||||
::nana::upoint _m_put(::std::wstring);
|
::nana::upoint _m_put(::std::wstring);
|
||||||
::nana::upoint _m_erase_select();
|
::nana::upoint _m_erase_select();
|
||||||
@ -245,6 +240,7 @@ namespace nana{ namespace widgets
|
|||||||
bool _m_move_select(bool record_undo);
|
bool _m_move_select(bool record_undo);
|
||||||
|
|
||||||
int _m_text_top_base() const;
|
int _m_text_top_base() const;
|
||||||
|
int _m_text_topline() const;
|
||||||
|
|
||||||
/// Returns the logical position that text starts of a specified line in x-axis
|
/// Returns the logical position that text starts of a specified line in x-axis
|
||||||
int _m_text_x(const text_section&) const;
|
int _m_text_x(const text_section&) const;
|
||||||
@ -258,10 +254,7 @@ namespace nana{ namespace widgets
|
|||||||
//@return: true if caret overs the border
|
//@return: true if caret overs the border
|
||||||
bool _m_update_caret_line(std::size_t secondary_before);
|
bool _m_update_caret_line(std::size_t secondary_before);
|
||||||
|
|
||||||
void _m_offset_y(int y);
|
|
||||||
|
|
||||||
unsigned _m_char_by_pixels(const unicode_bidi::entity&, unsigned pos) const;
|
unsigned _m_char_by_pixels(const unicode_bidi::entity&, unsigned pos) const;
|
||||||
|
|
||||||
unsigned _m_pixels_by_char(const ::std::wstring&, ::std::size_t pos) const;
|
unsigned _m_pixels_by_char(const ::std::wstring&, ::std::size_t pos) const;
|
||||||
void _m_handle_move_key(const arg_keyboard& arg);
|
void _m_handle_move_key(const arg_keyboard& arg);
|
||||||
|
|
||||||
@ -294,27 +287,24 @@ namespace nana{ namespace widgets
|
|||||||
{
|
{
|
||||||
nana::rectangle area;
|
nana::rectangle area;
|
||||||
|
|
||||||
bool captured;
|
bool captured{ false };
|
||||||
unsigned tab_space;
|
unsigned tab_space{ 4 };
|
||||||
unsigned scroll_pixels;
|
|
||||||
unsigned vscroll;
|
|
||||||
unsigned hscroll;
|
|
||||||
}text_area_;
|
}text_area_;
|
||||||
|
|
||||||
struct selection
|
struct selection
|
||||||
{
|
{
|
||||||
enum class mode{ no_selected, mouse_selected, method_selected, move_selected };
|
enum class mode{ no_selected, mouse_selected, method_selected, move_selected, move_selected_take_effect };
|
||||||
|
|
||||||
|
bool ignore_press{ false };
|
||||||
|
bool move_to_end{ false };
|
||||||
|
mode mode_selection{ mode::no_selected };
|
||||||
|
text_focus_behavior behavior{text_focus_behavior::none};
|
||||||
|
|
||||||
text_focus_behavior behavior;
|
|
||||||
bool move_to_end;
|
|
||||||
mode mode_selection;
|
|
||||||
bool ignore_press;
|
|
||||||
nana::upoint a, b;
|
nana::upoint a, b;
|
||||||
}select_;
|
}select_;
|
||||||
|
|
||||||
struct coordinate
|
struct coordinate
|
||||||
{
|
{
|
||||||
nana::point offset; //x stands for pixels, y for lines
|
|
||||||
nana::upoint caret; //position of caret by text, it specifies the position of a new character
|
nana::upoint caret; //position of caret by text, it specifies the position of a new character
|
||||||
nana::upoint shift_begin_caret;
|
nana::upoint shift_begin_caret;
|
||||||
unsigned xpos{0}; //This data is used for move up/down
|
unsigned xpos{0}; //This data is used for move up/down
|
||||||
|
@ -27,6 +27,7 @@ namespace nana
|
|||||||
: public ::nana::widget_geometrics
|
: public ::nana::widget_geometrics
|
||||||
{
|
{
|
||||||
color_proxy selection{ static_cast<color_rgb>(0x3399FF) };
|
color_proxy selection{ static_cast<color_rgb>(0x3399FF) };
|
||||||
|
color_proxy selection_unfocused{ static_cast<color_rgb>(0xF0F0F0) };
|
||||||
color_proxy selection_text{colors::white};
|
color_proxy selection_text{colors::white};
|
||||||
|
|
||||||
parameters::mouse_wheel mouse_wheel; ///< The number of lines/characters to scroll when the vertical/horizontal mouse wheel is moved.
|
parameters::mouse_wheel mouse_wheel; ///< The number of lines/characters to scroll when the vertical/horizontal mouse wheel is moved.
|
||||||
|
@ -55,7 +55,7 @@ namespace skeletons
|
|||||||
bool scroll(bool forwards, bool horz);
|
bool scroll(bool forwards, bool horz);
|
||||||
bool turn_page(bool forwards, bool horz);
|
bool turn_page(bool forwards, bool horz);
|
||||||
|
|
||||||
void disp_area(const rectangle& da, const point& skew_horz, const point& skew_vert, const size& extra_px, bool try_update = true);
|
void disp_area(const rectangle& da, const point& skew_horz_bar, const point& skew_vert_bar, const size& extra_px, bool try_update = true);
|
||||||
|
|
||||||
void content_size(const size& sz, bool try_update = true);
|
void content_size(const size& sz, bool try_update = true);
|
||||||
const size& content_size() const;
|
const size& content_size() const;
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user