46 #if !defined (USE_FINAL_H) && !defined (COMPILE_FINAL_CUT)    47   #error "Only <final/final.h> can be included directly."    52 #include <unordered_map>    55 #include "final/fwidget.h"    71     using FWidget::setGeometry;
    72     using FWidget::setVisibleCursor;
    73     using FWidget::unsetVisibleCursor;
    76     enum class LabelOrientation
   109     template <
typename typeT>
   110     auto operator << (
const typeT&) -> 
FLineEdit&;
   111     auto operator << (UniChar) -> 
FLineEdit&;
   112     auto operator << (
const wchar_t) -> 
FLineEdit&;
   121     auto getClassName() 
const -> 
FString override;
   122     auto getAlignment() 
const noexcept -> Align;
   123     auto getText() 
const -> 
FString;
   124     auto getMaxLength() 
const noexcept -> std::size_t;
   125     auto getCursorPosition() 
const noexcept -> std::size_t;
   126     auto getLabelObject() 
const -> 
FLabel*;
   127     auto getLabelOrientation() 
const -> LabelOrientation;
   130     void setAlignment (Align) noexcept;
   132     void inputText (
const FString&);
   133     void deletesCharacter();
   134     void setInputFilter (
const FString&);
   135     void clearInputFilter();
   136     void setMaxLength (std::size_t);
   137     void setCursorPosition (std::size_t);
   138     void moveCursorToBegin();
   139     void moveCursorToEnd();
   140     void stepCursorForward (std::size_t = 1);
   141     void stepCursorBackward (std::size_t = 1);
   142     void setLabelText (
const FString&);
   143     void setInputType (
const InputType);
   144     void setOverwriteMode (
bool = 
true);
   145     void setLabelOrientation (
const LabelOrientation);
   146     void setLabelAssociatedWidget (
FWidget*);
   147     void resetColors() 
override;
   148     void setSize (
const FSize&, 
bool = 
true) 
override;
   150                                     , 
bool = 
true ) 
override;
   151     void setEnable (
bool = 
true) 
override;
   152     void unsetEnable() 
override;
   153     void setDisable() 
override;
   154     void setShadow (
bool = 
true);
   156     void setReadOnly (
bool = 
true);
   157     void unsetReadOnly();
   160     auto hasShadow() 
const -> bool;
   161     auto isReadOnly() 
const noexcept -> bool;
   164     void hide() 
override;
   181     void adjustSize() 
override;
   185     using offsetPair = std::pair<std::size_t, std::size_t>;
   186     using KeyMap = std::unordered_map<FKey, std::function<void()>, 
EnumHash<FKey>>;
   189     static constexpr 
auto NOT_SET = 
static_cast<std::size_t
>(-1);
   190     static constexpr 
auto NOT_FOUND = 
static_cast<std::size_t
>(-1);
   194     void mapKeyFunctions();
   195     auto hasHotkey() 
const -> bool;
   196     auto getAlignOffset (
const std::size_t) 
const -> std::size_t;
   197     void draw() 
override;
   198     void drawInputField();
   199     void initializeDrawing();
   200     void finalizingDrawing() 
const;
   201     void printTrailingSpaces (std::size_t x_pos);
   202     auto choosePrintMethod() -> std::tuple<std::size_t, std::size_t>;
   203     auto printTextField() -> std::tuple<std::size_t, std::size_t>;
   204     auto printPassword() -> std::tuple<std::size_t, std::size_t>;
   206     auto getCursorColumnPos() 
const -> std::size_t;
   207     auto getPasswordText() 
const -> 
FString;
   208     auto isPasswordField() 
const -> bool;
   209     auto isFullwidthChar (std::size_t) 
const -> bool;
   210     auto getColumnWidthWithErrorHandling ( FString::const_reference
   211                                          , std::size_t = 0 ) 
const ->std::size_t;
   212     auto endPosToOffset (std::size_t) -> offsetPair;
   213     auto clickPosToCursorPos (std::size_t) -> std::size_t;
   214     void setCursorPositionByMouseClick (
const FMouseEvent*);
   216     void handleLeftDragScroll();
   217     void handleRightDragScroll();
   218     void adjustTextOffset();
   223     void deleteCurrentCharacter();
   224     void deletePreviousCharacter();
   225     void switchInsertMode();
   227     auto keyInput (FKey) -> bool;
   228     auto characterFilter (
const wchar_t) 
const -> wchar_t;
   229     void processActivate();
   230     void processChanged() 
const;
   237     FWidget*         label_associated_widget{
this};
   238     std::wstring     input_filter{};
   240     DragScrollMode   drag_scroll{DragScrollMode::None};
   241     LabelOrientation label_orientation{LabelOrientation::Left};
   242     InputType        input_type{InputType::Textfield};
   243     int              scroll_repeat{100};
   244     bool             scroll_timer{
false};
   245     bool             insert_mode{
true};
   246     bool             read_only{
false};
   247     Align            alignment{Align::Left};
   248     std::size_t      align_offset{0};
   249     std::size_t      cursor_pos{NOT_SET};
   250     std::size_t      text_offset{0};
   251     std::size_t      char_width_offset{0};
   252     std::size_t      max_length{std::numeric_limits<std::size_t>::max()};
   258 template <
typename typeT>
   259 inline auto FLineEdit::operator << (
const typeT& s) -> 
FLineEdit&
   268 inline auto FLineEdit::getClassName() 
const -> 
FString   269 { 
return "FLineEdit"; }
   272 inline auto FLineEdit::getAlignment() 
const noexcept -> Align
   273 { 
return alignment; }
   276 inline auto FLineEdit::getText() 
const -> 
FString   280 inline auto FLineEdit::getMaxLength() 
const noexcept -> std::size_t
   281 { 
return max_length; }
   284 inline auto FLineEdit::getCursorPosition() 
const noexcept -> std::size_t
   285 { 
return cursor_pos; }
   288 inline auto FLineEdit::getLabelObject() 
const -> 
FLabel*
   292 inline auto FLineEdit::getLabelOrientation() 
const -> LabelOrientation
   293 { 
return label_orientation; }
   296 inline void FLineEdit::setInputFilter (
const FString& regex_string)
   297 { input_filter = regex_string.toWString(); }
   300 inline void FLineEdit::clearInputFilter()
   301 { input_filter.clear(); }
   304 inline void FLineEdit::setInputType (
const InputType type)
   305 { input_type = type; }
   308 inline void FLineEdit::setLabelAssociatedWidget (
FWidget* w)
   309 { label_associated_widget = w; }
   312 inline void FLineEdit::unsetEnable()
   313 { setEnable(
false); }
   316 inline void FLineEdit::setDisable()
   317 { setEnable(
false); }
   320 inline void FLineEdit::unsetShadow()
   321 { setShadow(
false); }
   324 inline void FLineEdit::unsetReadOnly()
   325 { setReadOnly(
true); }
   328 inline auto FLineEdit::hasShadow() 
const -> 
bool   329 { 
return getFlags().shadow.shadow; }
   332 inline auto FLineEdit::isReadOnly() 
const noexcept -> 
bool   333 { 
return read_only; }
   337 #endif  // FLINEEDIT_H 
Definition: class_template.cpp:25
 
Definition: flineedit.h:67