A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/ui__command_8cpp_source.html below:

NCBI C++ ToolKit: src/gui/widgets/wx/ui_command.cpp Source File

35 #include <wx/artprov.h> 39 #include <wx/toolbar.h> 40 #include <wx/aui/auibar.h> 55

:

CUIObject

(name, icon_alias, hint, description, help_id),

57

m_MenuLabel(menu_label),

66

m_CmdID(

cmd

.m_CmdID),

67

m_MenuLabel(

cmd

.m_MenuLabel),

72  if

(

cmd

.m_Accelerators.get()) {

91  for

(

size_t i

= 0;

i

< accels->size();

i

++ ) {

92

wxAcceleratorEntry& entry = (*accels)[

i

];

93

entry.Set(entry.GetFlags(), entry.GetKeyCode(), cmd_id);

136  if

( kind == wxITEM_RADIO ){

137  if

( menu.GetMenuItemCount() == 0 ){

153 #if wxUSE_OWNER_DRAWN 154

item->SetOwnerDrawn();

159

item->SetBitmap( image );

183

: m_NextID(start_id),

209  _ASSERT

(cmd_id > 0 && cmd_id < 0xFFFF);

211

TIDToCommand::const_iterator it =

m_IDToCommand

.find(cmd_id);

214  ERR_POST

(

"CUICommandRegistry::RegisterCommand() - attempty to register command "

<<

215  cmd

->GetLabel() <<

" with id"

<< cmd_id <<

" that is already in use - "

);

216  ERR_POST

(

"\n\tpreviously registered as "

<< it->second->GetMenuLabel());

248

hint, description, help_id, kind);

259

TIDToCommand::const_iterator it =

m_IDToCommand

.find( cmd_id );

266  if

( it->second->GetName() == name ){

285

frame->SetAcceleratorTable(wxNullAcceleratorTable);

290

wxAcceleratorTable accel_table(

n

,

entries

);

292

frame->SetAcceleratorTable( accel_table );

295  ERR_POST

(

"CUICommandRegistry::ApplyAccelerators() - frame = NULL, cannot apply accelerators"

);

310  if

( cmd_id == wxID_SEPARATOR ){

311  return

menu.AppendSeparator();

317  return cmd

->AppendMenuItem( menu );

319  return cmd

->AppendMenuItem( menu, kind );

322  ERR_POST

(

"CUICommandRegistry::AppendMenuItem() cannot find command "

<< cmd_id);

332  for

(

int i

= 0;

i

<

count

;

i

++ ) {

341  for

(

size_t i

= 0;

i

< cmd_ids.size();

i

++ ) {

351  if

( !items )

return NULL

;

356

{

return

((insideNcbi && item->IsInternal()) || (!insideNcbi && item->IsExternal()) || item->IsBoth()); };

358  typedef

pair<wxMenu*, wxString>

TPair

;

368

path.push_back(

TPair

(

new

wxMenu, s));

371

wxMenu* submenu = path.back().first;

372  if

(submenu && visF(p_rec))

373

path.push_back(

TPair

(

new

wxMenu, s));

375

path.push_back(

TPair

(

nullptr

, s));

380  TPair

pair = path.back();

384

wxMenu* submenu = path.back().

first

;

392  TPair

pair = path.back();

401

wxMenu* submenu = path.back().first;

402  if

(submenu && visF(p_rec)) {

408 #if wxUSE_OWNER_DRAWN 409

item->SetOwnerDrawn();

411

submenu->Append(item);

415

wxMenu* submenu = path.back().first;

416  if

(submenu && visF(p_rec))

421

wxMenu* submenu = path.back().first;

422  if

(submenu && visF(p_rec))

427

wxMenu* submenu = path.back().first;

428  if

(submenu && visF(p_rec))

433

wxMenu* submenu = path.back().first;

434  if

(submenu && visF(p_rec))

455  const string

& alias =

cmd

->GetIconAlias();

456  if

( ! alias.empty()) {

457

image = wxArtProvider::GetBitmap(

ToWxString

(alias));

459

tool_bar.AddTool(

cmd

->GetCmdID(),

464  const string

& descr =

cmd

->GetDescription();

465  if

( ! descr.empty()) {

466

tool_bar.SetToolLongHelp(cmd_id,

ToWxString

(descr));

469  ERR_POST

(

"CUICommandRegistry::AppendTool() - command with id "

<<

470

cmd_id <<

" is not registered."

);

482  const string

& alias =

cmd

->GetIconAlias();

483  if

( ! alias.empty()) {

484

image = wxArtProvider::GetBitmap(

ToWxString

(alias));

486

tool_bar.AddTool(

cmd

->GetCmdID(),

491  const string

& descr =

cmd

->GetDescription();

492  if

( ! descr.empty()) {

493

tool_bar.SetToolLongHelp(cmd_id,

ToWxString

(descr));

496  ERR_POST

(

"CUICommandRegistry::AppendTool() - command with id "

<<

497

cmd_id <<

" is not registered."

);

CUICommandRegistry is a centralized registry where all application commands should be registered.

static CUICommandRegistry & GetInstance()

the main instance associated with the application

wxMenu * CreateMenu(const SwxMenuItemRec *items)

create a menu from a static definition (see WX_*_MENU macros)

void AppendTool(wxToolBar &tool_bar, TCmdID cmd_id)

int RegisterCommand(CUICommand *cmd)

assumes ownership of the given object returns a command id (useful when registry is used for auto id ...

CUICommandRegistry(TCmdID start_id)

std::unordered_map< int, CUICommand * > TIDToCommand

const CUICommand * FindCommandByID(TCmdID cmd_id) const

returns CUICommand object or NULL

TIDToCommand m_IDToCommand

virtual ~CUICommandRegistry()

void ApplyAccelerators(wxWindow *frame)

apply accumulated accelerators to the specifed frame

void AddAccelerator(const wxAcceleratorEntry &entry)

const CUICommand * FindCommandByName(string name) const

It is expensive function so use it wisely.

static CUICommandRegistry sm_TheRegistry

CUICommandRegistry.

void AppendMenuItems(wxMenu &menu, const TCmdID *cmd_ids, int count) const

vector< wxAcceleratorEntry > m_AccelEntries

wxMenuItem * AppendMenuItem(wxMenu &menu, TCmdID cmd_id) const

const TAccelerators * GetAccelerators() const

const string & GetMenuLabel() const

unique_ptr< TAccelerators > m_Accelerators

wxMenuItem * AppendMenuItem(wxMenu &menu) const

CUICommand(TCmdID cmd_id, string menu_label, string name, string icon_alias, string hint=kEmptyStr, string description=kEmptyStr, string help_id=kEmptyStr, wxItemKind kind=wxITEM_NORMAL)

CUICommand.

void SetCmdID(TCmdID cmd_id)

the class inherits set/get methods from CUIObject

vector< wxAcceleratorEntry > TAccelerators

a collection of wxWidget-style accelerator definitions

void AddAccelerator(int flags, int key_code)

CUIObject - default mix-in implementation of IUIObject.

SStaticPair< const char *, const char * > TPair

#define ITERATE(Type, Var, Cont)

ITERATE macro to sequence through container elements.

#define NON_CONST_ITERATE(Type, Var, Cont)

Non constant version of ITERATE macro.

#define ERR_POST(message)

Error posting with file, line number information but without error codes.

@ eCmdInvalid

marks menu end in array initializers

#define END_NCBI_SCOPE

End previously defined NCBI scope.

#define BEGIN_NCBI_SCOPE

Define ncbi namespace.

static const char label[]

unsigned int

A callback function used to compare two keys in a database.

Template structure SStaticPair is simlified replacement of STL pair<> Main reason of introducing this...

static const int kDefHashSize

static wxAcceleratorEntry entries[3]

void SetMenuItemMarginWidth(wxMenuItem *item, wxBitmap *bmp)

Set margin width for menu item.

void UseDefaultMarginWidth(wxMenu &menu)

Using default menu item margin width.

wxString ToWxString(const string &s)


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4