Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
magicseteditor
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
magicseteditor
Commits
eaf81aed
Commit
eaf81aed
authored
Jan 07, 2011
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
escape key clears card filter box
parent
54de7cf9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
6 deletions
+21
-6
src/gui/set/cards_panel.cpp
src/gui/set/cards_panel.cpp
+21
-6
No files found.
src/gui/set/cards_panel.cpp
View file @
eaf81aed
...
@@ -40,7 +40,8 @@ DECLARE_TYPEOF_COLLECTION(AddCardsScriptP);
...
@@ -40,7 +40,8 @@ DECLARE_TYPEOF_COLLECTION(AddCardsScriptP);
class
TextCtrlWithFocus
:
public
wxTextCtrl
{
class
TextCtrlWithFocus
:
public
wxTextCtrl
{
public:
public:
DECLARE_EVENT_TABLE
();
DECLARE_EVENT_TABLE
();
void
forwardEvent
(
wxFocusEvent
&
);
void
forwardFocusEvent
(
wxFocusEvent
&
);
void
forwardKeyEvent
(
wxKeyEvent
&
);
};
};
/// A search/filter textbox
/// A search/filter textbox
...
@@ -49,7 +50,7 @@ class FilterCtrl : public wxControl {
...
@@ -49,7 +50,7 @@ class FilterCtrl : public wxControl {
FilterCtrl
(
wxWindow
*
parent
,
int
id
);
FilterCtrl
(
wxWindow
*
parent
,
int
id
);
/// Set the filter text
/// Set the filter text
void
setFilter
(
const
String
&
filter
,
bool
event
=
false
);
void
setFilter
(
const
String
&
filter
,
bool
event
=
false
);
void
clearFilter
(
)
{
setFilter
(
String
()
);
}
void
clearFilter
(
bool
event
=
false
)
{
setFilter
(
String
(),
event
);
}
bool
hasFilter
()
const
{
return
!
value
.
empty
();
}
bool
hasFilter
()
const
{
return
!
value
.
empty
();
}
String
const
&
getFilter
()
const
{
return
value
;
}
String
const
&
getFilter
()
const
{
return
value
;
}
...
@@ -68,6 +69,7 @@ class FilterCtrl : public wxControl {
...
@@ -68,6 +69,7 @@ class FilterCtrl : public wxControl {
void
onChangeEvent
(
wxCommandEvent
&
);
void
onChangeEvent
(
wxCommandEvent
&
);
void
onClear
(
wxCommandEvent
&
);
void
onClear
(
wxCommandEvent
&
);
void
onSizeEvent
(
wxSizeEvent
&
);
void
onSizeEvent
(
wxSizeEvent
&
);
void
onChar
(
wxKeyEvent
&
);
void
onSize
();
void
onSize
();
public:
public:
void
onSetFocus
(
wxFocusEvent
&
);
void
onSetFocus
(
wxFocusEvent
&
);
...
@@ -124,9 +126,17 @@ void FilterCtrl::onChangeEvent(wxCommandEvent&) {
...
@@ -124,9 +126,17 @@ void FilterCtrl::onChangeEvent(wxCommandEvent&) {
setFilter
(
filter_ctrl
->
GetValue
(),
true
);
setFilter
(
filter_ctrl
->
GetValue
(),
true
);
}
}
}
}
void
FilterCtrl
::
onChar
(
wxKeyEvent
&
ev
)
{
if
(
ev
.
GetKeyCode
()
==
WXK_ESCAPE
)
{
// escape clears the filter box
clearFilter
(
true
);
}
else
{
ev
.
Skip
();
}
}
void
FilterCtrl
::
onClear
(
wxCommandEvent
&
)
{
void
FilterCtrl
::
onClear
(
wxCommandEvent
&
)
{
setFilter
(
String
(),
true
);
clearFilter
(
true
);
}
}
void
FilterCtrl
::
onSizeEvent
(
wxSizeEvent
&
)
{
void
FilterCtrl
::
onSizeEvent
(
wxSizeEvent
&
)
{
...
@@ -160,15 +170,20 @@ BEGIN_EVENT_TABLE(FilterCtrl, wxControl)
...
@@ -160,15 +170,20 @@ BEGIN_EVENT_TABLE(FilterCtrl, wxControl)
EVT_SIZE
(
FilterCtrl
::
onSizeEvent
)
EVT_SIZE
(
FilterCtrl
::
onSizeEvent
)
EVT_SET_FOCUS
(
FilterCtrl
::
onSetFocus
)
EVT_SET_FOCUS
(
FilterCtrl
::
onSetFocus
)
EVT_KILL_FOCUS
(
FilterCtrl
::
onKillFocus
)
EVT_KILL_FOCUS
(
FilterCtrl
::
onKillFocus
)
EVT_CHAR
(
FilterCtrl
::
onChar
)
END_EVENT_TABLE
()
END_EVENT_TABLE
()
void
TextCtrlWithFocus
::
forwardEvent
(
wxFocusEvent
&
ev
)
{
void
TextCtrlWithFocus
::
forwardFocusEvent
(
wxFocusEvent
&
ev
)
{
GetParent
()
->
HandleWindowEvent
(
ev
);
}
void
TextCtrlWithFocus
::
forwardKeyEvent
(
wxKeyEvent
&
ev
)
{
GetParent
()
->
HandleWindowEvent
(
ev
);
GetParent
()
->
HandleWindowEvent
(
ev
);
}
}
BEGIN_EVENT_TABLE
(
TextCtrlWithFocus
,
wxTextCtrl
)
BEGIN_EVENT_TABLE
(
TextCtrlWithFocus
,
wxTextCtrl
)
EVT_SET_FOCUS
(
TextCtrlWithFocus
::
forwardEvent
)
EVT_SET_FOCUS
(
TextCtrlWithFocus
::
forwardFocusEvent
)
EVT_KILL_FOCUS
(
TextCtrlWithFocus
::
forwardEvent
)
EVT_KILL_FOCUS
(
TextCtrlWithFocus
::
forwardFocusEvent
)
EVT_CHAR
(
TextCtrlWithFocus
::
forwardKeyEvent
)
END_EVENT_TABLE
()
END_EVENT_TABLE
()
// ----------------------------------------------------------------------------- : CardsPanel
// ----------------------------------------------------------------------------- : CardsPanel
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment