#include <ndk++.h>
Inheritance diagram for NDK_XX::MenuBar:
Public Methods | |
MenuBar (int id, const string &title,int lines, int cols, int y, int x,char orient='h',int style=hidden|tabstop|notify) | |
~MenuBar () | |
char | get_orientation () const |
we are wide-oriented or tall-oriented? | |
int | execute () |
int | add_item (MenuItemData *new_item) |
int | add_item (const string &text) |
void | items_owner (bool t_or_f=true) |
Public Attributes | |
bool | is_main_menu |
Protected Methods | |
int | move_up () |
int | move_down () |
int | move_left () |
int | move_right () |
int | driver (int key) |
int | execute_current_item (int key) |
void | find_clicked () |
mouse support | |
int | get_next_item_y () |
Calculate the position of the next item to be inserted. | |
int | get_next_item_x () |
Protected Attributes | |
bool | b_own_items |
char | orientation |
Should we delete the added items? | |
string | titlePos |
|
MenuBar Constructor
Definition at line 1364 of file ndk++.h. References NDK_XX::Control::framed, NDK_XX::Control::notify, NDK_XX::Control::tabstop, and NDK_XX::Control::title.
|
|
Definition at line 1374 of file ndk++.h.
01376 : public MenuBar 01377 { 01378 public: |
|
If we get only a text, then the assumed intention is to place a placeholder (i.e. a non implemented yet label Definition at line 1403 of file ndk++.h. References orientation. |
|
specialized add_item: a MenuBar, as oposed to a ListBox adds the visible item at the same time as the data item (implicit to this is that you should not add more data items than the visible ones. This limitation is which allows us to deploy the items each one at its own position. (By now, anyway. Later we may add the ability to scroll items, but it's unlikely we will ever want to...) Definition at line 1391 of file ndk++.h. References orientation. Referenced by NDK_XX::PopUpMenu::action().
01392 { 01393 if(orientation=='h') 01394 return true; 01395 return MenuBar::move_up(); 01396 }; 01397 int move_down(){ 01398 if(orientation=='h') 01399 return true; |
|
get a chance at processing the key, before parent does Reimplemented from NDK_XX::ListBox. Definition at line 1650 of file ndk++.cc. References NDK_XX::DialogBox::do_modal(), execute_current_item(), EXIT_APP, find_clicked(), NDK_XX::Control::get_param(), IDYES, KEY_ENTER, KEY_ESC, and NDK_XX::ListBox::refresh(). Referenced by execute().
01651 { 01652 int result = false; 01653 switch(key) { 01654 case EXIT_APP: 01655 { 01656 string prompt(get_param("exit app","prompt","Esta seguro que quiere salir de la aplicacion?")); 01657 YesNoBox mb(Application::get_application()->get_title(),prompt); 01658 int req =mb.do_modal(); 01659 refresh(); 01660 if(req==IDYES){ 01661 result=true; 01662 } 01663 break; 01664 } 01665 case KEY_ESC: 01666 if(is_main_menu) ///in this case, KEY_ESC is like EXIT_APP 01667 result = driver(EXIT_APP); 01668 else result =true; 01669 break; 01670 case KEY_ENTER: 01671 result = execute_current_item(key); 01672 switch(result) { 01673 case EXIT_APP: 01674 case KEY_ESC: 01675 case KEY_LEFT: 01676 case KEY_RIGHT: 01677 return driver(result); 01678 default: 01679 break; 01680 } 01681 break; 01682 #ifdef NCURSES_MOUSE_VERSION 01683 case KEY_MOUSE: 01684 { 01685 MEVENT event; 01686 getmouse(&event); 01687 if (event.bstate & (BUTTON1_CLICKED)){ 01688 if( wenclose(w,event.y, event.x)) 01689 { // we react only if the click was in the userwin, that means 01690 // inside the menu display area or at the decoration window. 01691 find_clicked(); 01692 result = execute_current_item(key); 01693 switch(result) { 01694 case EXIT_APP: 01695 case KEY_ESC: 01696 case KEY_LEFT: 01697 case KEY_RIGHT: 01698 return driver(result); 01699 default: 01700 break; 01701 } 01702 } 01703 else result = true; 01704 } 01705 break; 01706 } 01707 #endif /* NCURSES_MOUSE_VERSION */ 01708 default: 01709 result = ListBox::driver(key); 01710 break; 01711 } 01712 return result; 01713 } |
|
Definition at line 1634 of file ndk++.cc. References driver(), NDK_XX::ListBox::hide(), NDK_XX::ListBox::refresh(), and NDK_XX::ListBox::show(). Referenced by NDK_XX::PopUpMenu::action().
|
|
Definition at line 1717 of file ndk++.cc. References NDK_XX::ListBox::curr_item, NDK_XX::ListBox::data, NDK_XX::MenuItem::driver(), NDK_XX::ListBox::refresh(), and NDK_XX::ListBox::visible_item(). Referenced by driver().
|
|
mouse support
Definition at line 1765 of file ndk++.cc. References NDK_XX::Control::clicked_inside(), NDK_XX::ListBox::first_visible, NDK_XX::ListBox::items, and NDK_XX::ListBox::set_cur_pos(). Referenced by driver().
01766 { 01767 MEVENT event; 01768 getmouse(&event); 01769 int ry = event.y, rx = event.x; /* screen coordinates */ 01770 01771 if (mouse_trafo(&ry,&rx,FALSE)){ 01772 if(clicked_inside(ry,rx)){ 01773 for(int i=0;i<items.size();i++){ 01774 if(items[i]->clicked_inside(ry,rx)) 01775 set_cur_pos(first_visible + i ); 01776 } 01777 } 01778 } 01779 } |
|
Definition at line 1732 of file ndk++.cc. References NDK_XX::ListBox::items, orientation, and NDK_XX::ListBox::pos_x.
01733 { 01734 int result = 0; 01735 if(orientation=='v'){ 01736 result = pos_x; 01737 } 01738 else{ 01739 VisibleItems::iterator it; 01740 for(it=items.begin();it!=items.end();it++){ 01741 result += (*it)->width(); 01742 } 01743 } 01744 return result; 01745 01746 } |
|
Calculate the position of the next item to be inserted.
Definition at line 1750 of file ndk++.cc. References NDK_XX::Control::has_frame(), NDK_XX::ListBox::items, orientation, and NDK_XX::ListBox::pos_y.
01751 { 01752 int result = 0; 01753 if(orientation=='h'){ 01754 result = pos_y; 01755 } 01756 else{ 01757 result = items.size(); 01758 } 01759 return result+has_frame(); 01760 01761 } |
|
we are wide-oriented or tall-oriented?
Definition at line 1381 of file ndk++.h. References NDK_XX::Control::framed, NDK_XX::Control::notify, NDK_XX::Control::tabstop, and NDK_XX::Control::title.
|
|
Definition at line 1405 of file ndk++.h. Referenced by NDK_XX::PopUpMenu::action().
01407 { |
|
Reimplemented from NDK_XX::ListBox. Reimplemented in NDK_XX::SubMenu. Definition at line 1423 of file ndk++.h. References NDK_XX::PopUpMenu::cur_sel, NDK_XX::PopUpMenu::S, and NDK_XX::ListItemData::text.
01423 : MenuItemData(text),S(0),cur_sel(-1){ } 01424 ~PopUpMenu(); 01425 01426 int action(); 01427 01428 int largest_name_len()const; |
|
move_left and move_right: if arrow_is_tab == true, they return false, so the owner can process KEY_LEFT and KEY_RIGHT, and properly move to previous or next control. Reimplemented from NDK_XX::Control. Reimplemented in NDK_XX::SubMenu. Definition at line 1429 of file ndk++.h. References NDK_XX::PopUpMenu::items, NDK_XX::ListItems, NDK_XX::PopUpMenu::S, and NDK_XX::PopUpMenu::sub_menu_label. Referenced by NDK_XX::CheckListBox::CheckListBox().
|
|
Reimplemented from NDK_XX::Control. Reimplemented in NDK_XX::SubMenu. Definition at line 1435 of file ndk++.h. References NDK_XX::PopUpMenu::cur_sel.
01445 : public Control |
|
Reimplemented from NDK_XX::ListBox. Reimplemented in NDK_XX::SubMenu. Definition at line 1417 of file ndk++.h.
01420 : public MenuItemData 01421 { 01422 public: |
|
Definition at line 1412 of file ndk++.h. Referenced by NDK_XX::CheckListBox::CheckListBox(), and NDK_XX::SelectionBox::SelectionBox(). |
|
This one si for processing of the ESC key. On the main menu, you MUST treat ESC as EXIT_APP, don't you...? This flag lets the driver know what behavior is intended Definition at line 1410 of file ndk++.h. Referenced by NDK_XX::CheckListBox::CheckListBox(), and NDK_XX::SelectionBox::SelectionBox(). |
|
Should we delete the added items?
Definition at line 1413 of file ndk++.h. Referenced by add_item(), NDK_XX::CheckListBox::CheckListBox(), get_next_item_x(), get_next_item_y(), and NDK_XX::SelectionBox::SelectionBox(). |
|
Definition at line 1415 of file ndk++.h. Referenced by NDK_XX::CheckListBox::CheckListBox(). |