bool CGUIWindowSettings::OnAction(const CAction &action) { if (action.id == ACTION_PREVIOUS_MENU) { g_windowManager.PreviousWindow(); return true; } else if (action.id == ACTION_PARENT_DIR) { g_windowManager.PreviousWindow(); return true; } else if (action.id == ACTION_SELECT_ITEM) { CGUIControl *focusedControl = GetFocusedControl(); if (focusedControl && focusedControl->IsContainer()) { m_iSelectedControl = focusedControl->GetID(); CGUIBaseContainer* container = (CGUIBaseContainer*)focusedControl; m_iSelectedItem = container->GetSelectedItem(); } } return CGUIWindow::OnAction(action); }
int CGUIControlGroup::GetFocusedControlID() const { if (m_focusedControl) return m_focusedControl; CGUIControl *control = GetFocusedControl(); if (control) return control->GetID(); return 0; }
bool Dialog::PreprocessMessage(const KeyMessage& message) { if (message.id == WM_KEYDOWN) { if ((message.GetVirtualKey() == VK_RETURN) || (message.GetVirtualKey() == VK_ESCAPE)) { auto focused_control = GetFocusedControl(); if ((focused_control != nullptr) && focused_control->AcceptKeyMessage(message)) { return false; } if (message.GetVirtualKey() == VK_ESCAPE) { CloseWithResult(DialogResult::Cancel); return true; } //VK_RETURN if (current_default_button_ != nullptr) { if (current_default_button_->GetWindow().get() == this) { current_default_button_->Click(); return true; } } } } return __super::PreprocessMessage(message); }
void CQuickFindBar::OnSelectAll(wxCommandEvent& e) { wxTextCtrl *ctrl = GetFocusedControl(); if ( !ctrl ) { e.Skip(); } else { ctrl->SelectAll(); } }
void CQuickFindBar::OnPaste(wxCommandEvent& e) { wxTextCtrl *ctrl = GetFocusedControl(); if ( !ctrl ) { e.Skip(); return; } if (ctrl->CanPaste()) ctrl->Paste(); }
bool CGUIWindowBoxeeMediaMain::OnAction(const CAction& action) { if (action.id == ACTION_PREVIOUS_MENU || action.id == ACTION_PARENT_DIR) { g_windowManager.PreviousWindow(); return true; } else if (action.id == ACTION_PLAYER_PLAY) { if (GetFocusedControl()) return OnClick(GetFocusedControl()->GetID(), ACTION_PLAYER_PLAY); } else if (action.id == ACTION_SHOW_INFO) { if (GetFocusedControl()) return OnClick(GetFocusedControl()->GetID(), ACTION_SHOW_INFO); } return CGUIWindow::OnAction(action); }
void Dialog::FocusedControlChange(const std::shared_ptr<Control>& previous_focused_control) { __super::FocusedControlChange(previous_focused_control); auto new_focused_button = std::dynamic_pointer_cast<Button>(GetFocusedControl()); if (new_focused_button != nullptr) { SetCurrentDefaultButton(new_focused_button); } else { SetCurrentDefaultButton(default_button_); } }
void CGUIDialogButtonMenu::FrameMove() { // get the label control CGUILabelControl *pLabel = (CGUILabelControl *)GetControl(CONTROL_BUTTON_LABEL); if (pLabel) { // get the active window, and put it's label into the label control const CGUIControl *pControl = GetFocusedControl(); if (pControl && (pControl->GetControlType() == CGUIControl::GUICONTROL_BUTTON || pControl->GetControlType() == CGUIControl::GUICONTROL_TOGGLEBUTTON)) { CGUIButtonControl *pButton = (CGUIButtonControl *)pControl; pLabel->SetLabel(pButton->GetLabel()); } } CGUIDialog::FrameMove(); }
void CQuickFindBar::OnEditUI(wxUpdateUIEvent& e) { wxTextCtrl *ctrl = GetFocusedControl(); if ( !ctrl ) { e.Skip(); return; } switch (e.GetId()) { case wxID_SELECTALL: e.Enable(ctrl->GetValue().IsEmpty() == false); break; case wxID_COPY: e.Enable(ctrl->CanCopy()); break; case wxID_PASTE: e.Enable(ctrl->CanPaste()); break; default: e.Enable(false); break; } }