KiCad PCB EDA Suite
CONDITIONAL_MENU::ENTRY Class Reference

< Helper class to organize menu entries. Inserts the entry, preserving the requested order. More...

Public Types

enum  ENTRY_TYPE { ACTION, MENU, WXITEM, SEPARATOR }
 

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, BITMAPS aBitmap, SELECTION_CONDITION aCondition, int aOrder, bool aCheckmark)
 
 ENTRY (SELECTION_CONDITION aCondition, int aOrder)
 
 ENTRY (const ENTRY &aEntry)
 
 ~ENTRY ()
 Possible entry types. More...
 
ENTRY_TYPE Type () const
 
BITMAPS GetIcon () 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
 
BITMAPS m_icon
 
union {
   const TOOL_ACTION *   action
 
   ACTION_MENU *   menu
 
   wxMenuItem *   wxItem
 
m_data
 Condition to be fulfilled to show the entry in menu. More...
 
SELECTION_CONDITION m_condition
 Order number, the higher the number the lower position it takes it is in the menu. More...
 
int m_order
 
bool m_isCheckmarkEntry
 

Detailed Description

< Helper class to organize menu entries. Inserts the entry, preserving the requested order.

Definition at line 120 of file conditional_menu.h.

Member Enumeration Documentation

◆ ENTRY_TYPE

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 123 of file conditional_menu.h.

124  :
125  m_type( ACTION ), m_icon( static_cast<BITMAPS>( 0 ) ),
126  m_condition( aCondition ),
127  m_order( aOrder ),
128  m_isCheckmarkEntry( aCheckmark )
129  {
130  m_data.action = aAction;
131  }
union CONDITIONAL_MENU::ENTRY::@31 m_data
Condition to be fulfilled to show the entry in menu.
SELECTION_CONDITION m_condition
Order number, the higher the number the lower position it takes it is in the menu.

◆ ENTRY() [2/5]

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

Definition at line 133 of file conditional_menu.h.

133  :
134  m_type( MENU ), m_icon( static_cast<BITMAPS>( 0 ) ),
135  m_condition( aCondition ),
136  m_order( aOrder ),
137  m_isCheckmarkEntry( false )
138  {
139  m_data.menu = aMenu;
140  }
union CONDITIONAL_MENU::ENTRY::@31 m_data
Condition to be fulfilled to show the entry in menu.
SELECTION_CONDITION m_condition
Order number, the higher the number the lower position it takes it is in the menu.

◆ ENTRY() [3/5]

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

Definition at line 142 of file conditional_menu.h.

143  :
144  m_type( WXITEM ), m_icon( aBitmap ),
145  m_condition( aCondition ),
146  m_order( aOrder ),
147  m_isCheckmarkEntry( aCheckmark )
148  {
149  m_data.wxItem = new wxMenuItem( nullptr, aItem.GetId(), aItem.GetItemLabel(),
150  aItem.GetHelp(), aItem.GetKind() );
151  }
union CONDITIONAL_MENU::ENTRY::@31 m_data
Condition to be fulfilled to show the entry in menu.
SELECTION_CONDITION m_condition
Order number, the higher the number the lower position it takes it is in the menu.

◆ ENTRY() [4/5]

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

Definition at line 154 of file conditional_menu.h.

154  :
155  m_type( SEPARATOR ), m_icon( static_cast<BITMAPS>( 0 ) ),
156  m_condition( aCondition ),
157  m_order( aOrder ),
158  m_isCheckmarkEntry( false )
159  {
160  }
SELECTION_CONDITION m_condition
Order number, the higher the number the lower position it takes it is in the menu.

◆ ENTRY() [5/5]

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

Definition at line 213 of file conditional_menu.cpp.

214 {
215  m_type = aEntry.m_type;
216  m_icon = aEntry.m_icon;
217 
218  switch( aEntry.m_type )
219  {
220  case ACTION:
221  m_data.action = aEntry.m_data.action;
222  break;
223  case MENU:
224  m_data.menu = aEntry.m_data.menu;
225  break;
226  case WXITEM:
227  // We own the wxItem, so we need to make a new one for the new object
228  m_data.wxItem = new wxMenuItem( nullptr,
229  aEntry.m_data.wxItem->GetId(),
230  aEntry.m_data.wxItem->GetItemLabel(),
231  aEntry.m_data.wxItem->GetHelp(),
232  aEntry.m_data.wxItem->GetKind() );
233  break;
234  case SEPARATOR:
235  break; //No data to copy
236  }
237  m_condition = aEntry.m_condition;
238  m_order = aEntry.m_order;
239  m_isCheckmarkEntry = aEntry.m_isCheckmarkEntry;
240 }
union CONDITIONAL_MENU::ENTRY::@31 m_data
Condition to be fulfilled to show the entry in menu.
SELECTION_CONDITION m_condition
Order number, the higher the number the lower position it takes it is in the menu.

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 ( )

Possible entry types.

Definition at line 242 of file conditional_menu.cpp.

243 {
244  if( WXITEM == m_type )
245  delete m_data.wxItem;
246 }
union CONDITIONAL_MENU::ENTRY::@31 m_data
Condition to be fulfilled to show the entry in menu.

Member Function Documentation

◆ Action()

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

Definition at line 184 of file conditional_menu.h.

185  {
186  assert( m_type == ACTION );
187  return m_data.action;
188  }
union CONDITIONAL_MENU::ENTRY::@31 m_data
Condition to be fulfilled to show the entry in menu.

◆ Condition()

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

Definition at line 207 of file conditional_menu.h.

208  {
209  return m_condition;
210  }
SELECTION_CONDITION m_condition
Order number, the higher the number the lower position it takes it is in the menu.

◆ GetIcon()

BITMAPS CONDITIONAL_MENU::ENTRY::GetIcon ( ) const
inline

Definition at line 179 of file conditional_menu.h.

180  {
181  return m_icon;
182  }

◆ IsCheckmarkEntry()

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

Definition at line 202 of file conditional_menu.h.

203  {
204  return m_isCheckmarkEntry;
205  }

◆ Menu()

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

Definition at line 190 of file conditional_menu.h.

191  {
192  assert( m_type == MENU );
193  return m_data.menu;
194  }
union CONDITIONAL_MENU::ENTRY::@31 m_data
Condition to be fulfilled to show the entry in menu.

◆ Order()

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

Definition at line 212 of file conditional_menu.h.

213  {
214  return m_order;
215  }

Referenced by CONDITIONAL_MENU::addEntry().

◆ SetOrder()

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

Definition at line 217 of file conditional_menu.h.

218  {
219  m_order = aOrder;
220  }

Referenced by CONDITIONAL_MENU::addEntry().

◆ Type()

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

Definition at line 174 of file conditional_menu.h.

175  {
176  return m_type;
177  }

◆ wxItem()

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

Definition at line 196 of file conditional_menu.h.

197  {
198  assert( m_type == WXITEM );
199  return m_data.wxItem;
200  }
union CONDITIONAL_MENU::ENTRY::@31 m_data
Condition to be fulfilled to show the entry in menu.

Member Data Documentation

◆ action

const TOOL_ACTION* CONDITIONAL_MENU::ENTRY::action

Definition at line 229 of file conditional_menu.h.

Referenced by ENTRY().

◆ m_condition

SELECTION_CONDITION CONDITIONAL_MENU::ENTRY::m_condition
private

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

Definition at line 235 of file conditional_menu.h.

Referenced by ENTRY().

◆ m_data

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

Condition to be fulfilled to show the entry in menu.

Referenced by ENTRY().

◆ m_icon

BITMAPS CONDITIONAL_MENU::ENTRY::m_icon
private

Definition at line 224 of file conditional_menu.h.

Referenced by ENTRY().

◆ m_isCheckmarkEntry

bool CONDITIONAL_MENU::ENTRY::m_isCheckmarkEntry
private

Definition at line 240 of file conditional_menu.h.

Referenced by ENTRY().

◆ m_order

int CONDITIONAL_MENU::ENTRY::m_order
private

Definition at line 238 of file conditional_menu.h.

Referenced by ENTRY().

◆ m_type

ENTRY_TYPE CONDITIONAL_MENU::ENTRY::m_type
private

Definition at line 223 of file conditional_menu.h.

Referenced by ENTRY().

◆ menu

ACTION_MENU* CONDITIONAL_MENU::ENTRY::menu

Definition at line 230 of file conditional_menu.h.

Referenced by ENTRY().

◆ wxItem

wxMenuItem* CONDITIONAL_MENU::ENTRY::wxItem

Definition at line 231 of file conditional_menu.h.

Referenced by ENTRY().


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