KiCad PCB EDA Suite
CONDITIONAL_MENU::ENTRY Class Reference

Helper class to organize menu entries.

More...

Public Types

enum  ENTRY_TYPE { ACTION, MENU, WXITEM, SEPARATOR }
 

Possible entry types.

More...
 

Public Member Functions

 ENTRY (const TOOL_ACTION *aAction, SELECTION_CONDITION aCondition, int aOrder, bool aCheckmark)
 
 ENTRY (ACTION_MENU *aMenu, SELECTION_CONDITION aCondition, int aOrder)
 
 ENTRY (const wxMenuItem &aItem, const BITMAP_OPAQUE *aWxMenuBitmap, SELECTION_CONDITION aCondition, int aOrder, bool aCheckmark)
 
 ENTRY (SELECTION_CONDITION aCondition, int aOrder)
 
 ENTRY (const ENTRY &aEntry)
 
 ~ENTRY ()
 
ENTRY_TYPE Type () const
 
const BITMAP_OPAQUEGetIcon () const
 
const TOOL_ACTIONAction () const
 
ACTION_MENUMenu () const
 
wxMenuItem * wxItem () const
 
bool IsCheckmarkEntry () const
 
const SELECTION_CONDITIONCondition () const
 
int Order () const
 
void SetOrder (int aOrder)
 

Private Attributes

ENTRY_TYPE m_type
 
const BITMAP_OPAQUEm_icon
 
union {
   const TOOL_ACTION *   action
 
   ACTION_MENU *   menu
 
   wxMenuItem *   wxItem
 
m_data
 
SELECTION_CONDITION m_condition
 

Condition to be fulfilled to show the entry in menu.

More...
 
int m_order
 

Order number, the higher the number the lower position it takes it is in the menu.

More...
 
bool m_isCheckmarkEntry
 

Detailed Description

Helper class to organize menu entries.

Definition at line 141 of file conditional_menu.h.

Member Enumeration Documentation

◆ ENTRY_TYPE

Possible entry types.

Enumerator
ACTION 
MENU 
WXITEM 
SEPARATOR 

Definition at line 188 of file conditional_menu.h.

Constructor & Destructor Documentation

◆ ENTRY() [1/5]

CONDITIONAL_MENU::ENTRY::ENTRY ( const TOOL_ACTION aAction,
SELECTION_CONDITION  aCondition,
int  aOrder,
bool  aCheckmark 
)
inline

Definition at line 144 of file conditional_menu.h.

145  :
146  m_type( ACTION ), m_icon(nullptr),
147  m_condition( aCondition ),
148  m_order( aOrder ),
149  m_isCheckmarkEntry( aCheckmark )
150  {
151  m_data.action = aAction;
152  }
union CONDITIONAL_MENU::ENTRY::@36 m_data
SELECTION_CONDITION m_condition
Condition to be fulfilled to show the entry in menu.
int m_order
Order number, the higher the number the lower position it takes it is in the menu.
const BITMAP_OPAQUE * m_icon

References m_data.

◆ ENTRY() [2/5]

CONDITIONAL_MENU::ENTRY::ENTRY ( ACTION_MENU aMenu,
SELECTION_CONDITION  aCondition,
int  aOrder 
)
inline

Definition at line 154 of file conditional_menu.h.

154  :
155  m_type( MENU ), m_icon(nullptr),
156  m_condition( aCondition ),
157  m_order( aOrder ),
158  m_isCheckmarkEntry( false )
159  {
160  m_data.menu = aMenu;
161  }
union CONDITIONAL_MENU::ENTRY::@36 m_data
SELECTION_CONDITION m_condition
Condition to be fulfilled to show the entry in menu.
int m_order
Order number, the higher the number the lower position it takes it is in the menu.
const BITMAP_OPAQUE * m_icon

References m_data.

◆ ENTRY() [3/5]

CONDITIONAL_MENU::ENTRY::ENTRY ( const wxMenuItem &  aItem,
const BITMAP_OPAQUE aWxMenuBitmap,
SELECTION_CONDITION  aCondition,
int  aOrder,
bool  aCheckmark 
)
inline

Definition at line 163 of file conditional_menu.h.

164  :
165  m_type( WXITEM ), m_icon( aWxMenuBitmap ),
166  m_condition( aCondition ),
167  m_order( aOrder ),
168  m_isCheckmarkEntry( aCheckmark )
169  {
170  m_data.wxItem = new wxMenuItem( nullptr, aItem.GetId(), aItem.GetItemLabel(),
171  aItem.GetHelp(), aItem.GetKind() );
172  }
union CONDITIONAL_MENU::ENTRY::@36 m_data
SELECTION_CONDITION m_condition
Condition to be fulfilled to show the entry in menu.
int m_order
Order number, the higher the number the lower position it takes it is in the menu.
const BITMAP_OPAQUE * m_icon

References m_data.

◆ ENTRY() [4/5]

CONDITIONAL_MENU::ENTRY::ENTRY ( SELECTION_CONDITION  aCondition,
int  aOrder 
)
inline

Definition at line 175 of file conditional_menu.h.

175  :
176  m_type( SEPARATOR ), m_icon(nullptr),
177  m_condition( aCondition ),
178  m_order( aOrder ),
179  m_isCheckmarkEntry( false )
180  {
181  }
SELECTION_CONDITION m_condition
Condition to be fulfilled to show the entry in menu.
int m_order
Order number, the higher the number the lower position it takes it is in the menu.
const BITMAP_OPAQUE * m_icon

◆ ENTRY() [5/5]

CONDITIONAL_MENU::ENTRY::ENTRY ( const ENTRY aEntry)

Definition at line 253 of file conditional_menu.cpp.

254 {
255  m_type = aEntry.m_type;
256  m_icon = aEntry.m_icon;
257 
258  switch( aEntry.m_type )
259  {
260  case ACTION:
261  m_data.action = aEntry.m_data.action;
262  break;
263  case MENU:
264  m_data.menu = aEntry.m_data.menu;
265  break;
266  case WXITEM:
267  // We own the wxItem, so we need to make a new one for the new object
268  m_data.wxItem = new wxMenuItem( nullptr,
269  aEntry.m_data.wxItem->GetId(),
270  aEntry.m_data.wxItem->GetItemLabel(),
271  aEntry.m_data.wxItem->GetHelp(),
272  aEntry.m_data.wxItem->GetKind() );
273  break;
274  case SEPARATOR:
275  break; //No data to copy
276  }
277  m_condition = aEntry.m_condition;
278  m_order = aEntry.m_order;
279  m_isCheckmarkEntry = aEntry.m_isCheckmarkEntry;
280 }
union CONDITIONAL_MENU::ENTRY::@36 m_data
SELECTION_CONDITION m_condition
Condition to be fulfilled to show the entry in menu.
int m_order
Order number, the higher the number the lower position it takes it is in the menu.
const BITMAP_OPAQUE * m_icon

References ACTION, action, m_condition, m_data, m_icon, m_isCheckmarkEntry, m_order, m_type, MENU, menu, SEPARATOR, WXITEM, and wxItem.

◆ ~ENTRY()

CONDITIONAL_MENU::ENTRY::~ENTRY ( )

Definition at line 282 of file conditional_menu.cpp.

283 {
284  if( WXITEM == m_type )
285  delete m_data.wxItem;
286 }
union CONDITIONAL_MENU::ENTRY::@36 m_data

Member Function Documentation

◆ Action()

const TOOL_ACTION* CONDITIONAL_MENU::ENTRY::Action ( ) const
inline

Definition at line 205 of file conditional_menu.h.

206  {
207  assert( m_type == ACTION );
208  return m_data.action;
209  }
union CONDITIONAL_MENU::ENTRY::@36 m_data

References ACTION, m_data, and m_type.

◆ Condition()

const SELECTION_CONDITION& CONDITIONAL_MENU::ENTRY::Condition ( ) const
inline

Definition at line 228 of file conditional_menu.h.

229  {
230  return m_condition;
231  }
SELECTION_CONDITION m_condition
Condition to be fulfilled to show the entry in menu.

References m_condition.

◆ GetIcon()

const BITMAP_OPAQUE* CONDITIONAL_MENU::ENTRY::GetIcon ( ) const
inline

Definition at line 200 of file conditional_menu.h.

201  {
202  return m_icon;
203  }
const BITMAP_OPAQUE * m_icon

References m_icon.

◆ IsCheckmarkEntry()

bool CONDITIONAL_MENU::ENTRY::IsCheckmarkEntry ( ) const
inline

Definition at line 223 of file conditional_menu.h.

224  {
225  return m_isCheckmarkEntry;
226  }

References m_isCheckmarkEntry.

◆ Menu()

ACTION_MENU* CONDITIONAL_MENU::ENTRY::Menu ( ) const
inline

Definition at line 211 of file conditional_menu.h.

212  {
213  assert( m_type == MENU );
214  return m_data.menu;
215  }
union CONDITIONAL_MENU::ENTRY::@36 m_data

References m_data, m_type, and MENU.

◆ Order()

int CONDITIONAL_MENU::ENTRY::Order ( ) const
inline

Definition at line 233 of file conditional_menu.h.

234  {
235  return m_order;
236  }
int m_order
Order number, the higher the number the lower position it takes it is in the menu.

References m_order.

Referenced by CONDITIONAL_MENU::addEntry().

◆ SetOrder()

void CONDITIONAL_MENU::ENTRY::SetOrder ( int  aOrder)
inline

Definition at line 238 of file conditional_menu.h.

239  {
240  m_order = aOrder;
241  }
int m_order
Order number, the higher the number the lower position it takes it is in the menu.

References m_order.

Referenced by CONDITIONAL_MENU::addEntry().

◆ Type()

ENTRY_TYPE CONDITIONAL_MENU::ENTRY::Type ( ) const
inline

Definition at line 195 of file conditional_menu.h.

196  {
197  return m_type;
198  }

References m_type.

◆ wxItem()

wxMenuItem* CONDITIONAL_MENU::ENTRY::wxItem ( ) const
inline

Definition at line 217 of file conditional_menu.h.

218  {
219  assert( m_type == WXITEM );
220  return m_data.wxItem;
221  }
union CONDITIONAL_MENU::ENTRY::@36 m_data

References m_data, m_type, and WXITEM.

Member Data Documentation

◆ action

const TOOL_ACTION* CONDITIONAL_MENU::ENTRY::action

Definition at line 250 of file conditional_menu.h.

Referenced by ENTRY().

◆ m_condition

SELECTION_CONDITION CONDITIONAL_MENU::ENTRY::m_condition
private

Condition to be fulfilled to show the entry in menu.

Definition at line 256 of file conditional_menu.h.

Referenced by Condition(), and ENTRY().

◆ m_data

union { ... } CONDITIONAL_MENU::ENTRY::m_data

Referenced by Action(), ENTRY(), Menu(), and wxItem().

◆ m_icon

const BITMAP_OPAQUE* CONDITIONAL_MENU::ENTRY::m_icon
private

Definition at line 245 of file conditional_menu.h.

Referenced by ENTRY(), and GetIcon().

◆ m_isCheckmarkEntry

bool CONDITIONAL_MENU::ENTRY::m_isCheckmarkEntry
private

Definition at line 261 of file conditional_menu.h.

Referenced by ENTRY(), and IsCheckmarkEntry().

◆ m_order

int CONDITIONAL_MENU::ENTRY::m_order
private

Order number, the higher the number the lower position it takes it is in the menu.

Definition at line 259 of file conditional_menu.h.

Referenced by ENTRY(), Order(), and SetOrder().

◆ m_type

ENTRY_TYPE CONDITIONAL_MENU::ENTRY::m_type
private

Definition at line 244 of file conditional_menu.h.

Referenced by Action(), ENTRY(), Menu(), Type(), and wxItem().

◆ menu

ACTION_MENU* CONDITIONAL_MENU::ENTRY::menu

Definition at line 251 of file conditional_menu.h.

Referenced by ENTRY().

◆ wxItem

wxMenuItem* CONDITIONAL_MENU::ENTRY::wxItem

Definition at line 252 of file conditional_menu.h.

Referenced by ENTRY().


The documentation for this class was generated from the following files: