Build a menu structure for the server and send the necessary messages. Should be called on the root node. If menu_bar is true, a menu_bar menu is built (e.g. on top of the window), if it is false a popup menu is built which gets shown by right clicking on the window. Deletes itself afterwards.
| 119 | // built which gets shown by right clicking on the window. |
| 120 | // Deletes itself afterwards. |
| 121 | void SVMenuNode::BuildMenu(ScrollView* sv, bool menu_bar) { |
| 122 | if ((parent_ != NULL) && (menu_bar)) { |
| 123 | if (is_check_box_entry_) { |
| 124 | sv->MenuItem(parent_->text_.string(), text_.string(), cmd_event_, |
| 125 | toggle_value_); |
| 126 | } else { |
| 127 | sv->MenuItem(parent_->text_.string(), text_.string(), cmd_event_); } |
| 128 | } else if ((parent_ != NULL) && (!menu_bar)) { |
| 129 | if (description_.length() > 0) { |
| 130 | sv->PopupItem(parent_->text_.string(), text_.string(), cmd_event_, |
| 131 | value_.string(), description_.string()); |
| 132 | } else { |
| 133 | sv->PopupItem(parent_->text_.string(), text_.string()); |
| 134 | } |
| 135 | } |
| 136 | if (child_ != NULL) { |
| 137 | child_->BuildMenu(sv, menu_bar); delete child_; |
| 138 | } |
| 139 | if (next_ != NULL) { |
| 140 | next_->BuildMenu(sv, menu_bar); delete next_; |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | #endif // GRAPHICS_DISABLED |
no test coverage detected