OpenMoHAA 0.82.0
Loading...
Searching...
No Matches
uimledit.h
1/*
2===========================================================================
3Copyright (C) 2015 the OpenMoHAA team
4
5This file is part of OpenMoHAA source code.
6
7OpenMoHAA source code is free software; you can redistribute it
8and/or modify it under the terms of the GNU General Public License as
9published by the Free Software Foundation; either version 2 of the License,
10or (at your option) any later version.
11
12OpenMoHAA source code is distributed in the hope that it will be
13useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with OpenMoHAA source code; if not, write to the Free Software
19Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20===========================================================================
21*/
22
23#pragma once
24
25typedef struct selectionpoint_s {
26 int line;
27 int column;
28} selectionpoint_t;
29
30typedef struct selection_s {
31 selectionpoint_s begin;
33} selection_t;
34
35typedef struct dragState_s {
36 UIPoint2D lastPos;
37} dragState_t;
38
39class UIMultiLineEdit : public UIWidget
40{
41protected:
42 selection_s m_selection;
43 dragState_s m_dragState;
44 UList<str> m_lines;
45 UIVertScroll *m_vertscroll;
46 mouseState_t m_mouseState;
47 bool m_shiftForcedDown;
48 bool m_edit;
49 bool m_changed;
50
51public:
52 CLASS_PROTOTYPE(UIMultiLineEdit);
53
54protected:
55 void FrameInitialized(void) override;
56 void PointToSelectionPoint(const UIPoint2D& p, selectionpoint_t& sel);
57 str& LineFromLineNumber(int num, bool resetpos);
58 void EnsureSelectionPointVisible(selectionpoint_t& point);
59 void BoundSelectionPoint(selectionpoint_t& point);
60 void SortSelection(selectionpoint_t **topsel, selectionpoint_t **botsel);
61 void UpdateCvarEvent(Event *ev);
62 void SetEdit(Event *ev);
63 bool IsSelectionEmpty(void);
64
65public:
66 UIMultiLineEdit();
67
68 void Draw(void) override;
69 qboolean KeyEvent(int key, unsigned int time) override;
70 void CharEvent(int ch) override;
71 UIPoint2D getEndSelPoint(void);
72 void MouseDown(Event *ev);
73 void MouseUp(Event *ev);
74 void MouseDragged(Event *ev);
75 void Scroll(Event *ev);
76 void DragTimer(Event *ev);
77 void SizeChanged(Event *ev);
78 void setData(const char *data);
79 void getData(str& data);
80 void Empty(void);
81 void CopySelection(void);
82 void PasteSelection(void);
83 void DeleteSelection(void);
84 void setChanged(bool b);
85 bool IsChanged(void);
86};
Definition listener.h:246
Definition uipoint2d.h:25
Definition uivertscroll.h:31
Definition ulist.h:36
Definition str.h:77
Definition uimledit.h:35
Definition uimledit.h:30
Definition uimledit.h:25