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
18151ddf
Commit
18151ddf
authored
Jan 10, 2009
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tweaks to set_help_text
parent
1f291bfc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
+11
-3
src/gui/util.cpp
src/gui/util.cpp
+11
-3
No files found.
src/gui/util.cpp
View file @
18151ddf
...
@@ -45,12 +45,20 @@ void set_status_text(Window* wnd, const String& s) {
...
@@ -45,12 +45,20 @@ void set_status_text(Window* wnd, const String& s) {
}
}
// ----------------------------------------------------------------------------- : set_help_text
// The idea is as follows:
// - store the help text of a window in its ClientObject as a StoredStatusString
// - Connect event handlers that use set_status_text
// - The event handlers should be members of an EvtHandler somewhere,
// but it is wasteful to make an object. Instead use nullptr as a 'fake' EvtHandler.
// then the event handling functions will be called with this==nullptr
struct
StoredStatusString
:
public
wxClientData
{
struct
StoredStatusString
:
public
wxClientData
{
String
s
;
String
s
;
};
};
// Don't use this!
// Don't use this!
struct
Fake
WindowClass
:
public
wxWindow
{
struct
Fake
EvtHandlerClass
:
public
wxEvtHandler
{
void
onControlEnter
(
wxMouseEvent
&
ev
)
{
void
onControlEnter
(
wxMouseEvent
&
ev
)
{
wxWindow
*
wnd
=
(
wxWindow
*
)
ev
.
GetEventObject
();
wxWindow
*
wnd
=
(
wxWindow
*
)
ev
.
GetEventObject
();
if
(
wnd
)
{
if
(
wnd
)
{
...
@@ -73,8 +81,8 @@ void set_help_text(Window* wnd, const String& s) {
...
@@ -73,8 +81,8 @@ void set_help_text(Window* wnd, const String& s) {
// first time
// first time
d
=
new
StoredStatusString
;
d
=
new
StoredStatusString
;
wnd
->
SetClientObject
(
d
);
wnd
->
SetClientObject
(
d
);
wnd
->
Connect
(
wxEVT_ENTER_WINDOW
,
wxMouseEventHandler
(
Fake
WindowClass
::
onControlEnter
),
wnd
,
nullptr
);
wnd
->
Connect
(
wxEVT_ENTER_WINDOW
,
wxMouseEventHandler
(
Fake
EvtHandlerClass
::
onControlEnter
),
nullptr
,
nullptr
);
wnd
->
Connect
(
wxEVT_LEAVE_WINDOW
,
wxMouseEventHandler
(
Fake
WindowClass
::
onControlLeave
),
wnd
,
nullptr
);
wnd
->
Connect
(
wxEVT_LEAVE_WINDOW
,
wxMouseEventHandler
(
Fake
EvtHandlerClass
::
onControlLeave
),
nullptr
,
nullptr
);
}
}
d
->
s
=
s
;
d
->
s
=
s
;
}
}
...
...
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