Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
b1a19b12
Commit
b1a19b12
authored
May 31, 2014
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Setting proper tool for submenus of CONTEXT_MENU class.
parent
3ef78c66
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
6 deletions
+20
-6
context_menu.cpp
common/tool/context_menu.cpp
+17
-0
context_menu.h
include/tool/context_menu.h
+3
-6
No files found.
common/tool/context_menu.cpp
View file @
b1a19b12
...
@@ -193,6 +193,23 @@ void CONTEXT_MENU::onMenuEvent( wxEvent& aEvent )
...
@@ -193,6 +193,23 @@ void CONTEXT_MENU::onMenuEvent( wxEvent& aEvent )
}
}
void
CONTEXT_MENU
::
setTool
(
TOOL_INTERACTIVE
*
aTool
)
{
m_tool
=
aTool
;
for
(
unsigned
i
=
0
;
i
<
GetMenuItemCount
();
++
i
)
{
wxMenuItem
*
item
=
FindItemByPosition
(
i
);
if
(
item
->
IsSubMenu
()
)
{
CONTEXT_MENU
*
menu
=
static_cast
<
CONTEXT_MENU
*>
(
item
->
GetSubMenu
()
);
menu
->
setTool
(
aTool
);
}
}
}
void
CONTEXT_MENU
::
copyItem
(
const
wxMenuItem
*
aSource
,
wxMenuItem
*
aDest
)
const
void
CONTEXT_MENU
::
copyItem
(
const
wxMenuItem
*
aSource
,
wxMenuItem
*
aDest
)
const
{
{
assert
(
!
aSource
->
IsSubMenu
()
);
// it does not transfer submenus
assert
(
!
aSource
->
IsSubMenu
()
);
// it does not transfer submenus
...
...
include/tool/context_menu.h
View file @
b1a19b12
...
@@ -115,17 +115,12 @@ private:
...
@@ -115,17 +115,12 @@ private:
///> Event handler.
///> Event handler.
void
onMenuEvent
(
wxEvent
&
aEvent
);
void
onMenuEvent
(
wxEvent
&
aEvent
);
friend
class
TOOL_INTERACTIVE
;
/**
/**
* Function setTool()
* Function setTool()
* Sets a tool that is the creator of the menu.
* Sets a tool that is the creator of the menu.
* @param aTool is the tool that created the menu.
* @param aTool is the tool that created the menu.
*/
*/
void
setTool
(
TOOL_INTERACTIVE
*
aTool
)
void
setTool
(
TOOL_INTERACTIVE
*
aTool
);
{
m_tool
=
aTool
;
}
///> Flag indicating that the menu title was set up.
///> Flag indicating that the menu title was set up.
bool
m_titleSet
;
bool
m_titleSet
;
...
@@ -147,6 +142,8 @@ private:
...
@@ -147,6 +142,8 @@ private:
/// Custom events handler, allows to translate wxEvents to TOOL_EVENTs.
/// Custom events handler, allows to translate wxEvents to TOOL_EVENTs.
boost
::
function
<
OPT_TOOL_EVENT
(
const
wxEvent
&
aEvent
)
>
m_customHandler
;
boost
::
function
<
OPT_TOOL_EVENT
(
const
wxEvent
&
aEvent
)
>
m_customHandler
;
friend
class
TOOL_INTERACTIVE
;
};
};
#endif
#endif
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