double MyDoubleSpinBox::GetDefault() { if (parameterContainer && !gotDefault) { QString type = GetType(objectName()); if (type == QString("spinbox3") || type == QString("spinboxd3")) { char lastChar = (parameterName.at(parameterName.length() - 1)).toLatin1(); QString nameVect = parameterName.left(parameterName.length() - 2); CVector3 val = parameterContainer->GetDefault<CVector3>(nameVect); defaultValue = val.itemByName(lastChar); gotDefault = true; setToolTipText(); } else if (type == QString("spinbox4") || type == QString("spinboxd4")) { char lastChar = (parameterName.at(parameterName.length() - 1)).toLatin1(); QString nameVect = parameterName.left(parameterName.length() - 2); CVector4 val = parameterContainer->GetDefault<CVector4>(nameVect); defaultValue = val.itemByName(lastChar); gotDefault = true; setToolTipText(); } else { defaultValue = parameterContainer->GetDefault<double>(parameterName); gotDefault = true; setToolTipText(); } } return defaultValue; }
QString MyLineEdit::GetDefault() { if (parameterContainer && !gotDefault) { QString type = GetType(objectName()); if (type == QString("vect3") || type == QString("logvect3")) { char lastChar = (parameterName.at(parameterName.length() - 1)).toLatin1(); QString nameVect = parameterName.left(parameterName.length() - 2); CVector3 val = parameterContainer->GetDefault<CVector3>(nameVect); QString valS = QString("%L1").arg(val.itemByName(lastChar), 0, 'g', 16); defaultText = valS; gotDefault = true; } else if (type == QString("vect4") || type == QString("logvect3")) { char lastChar = (parameterName.at(parameterName.length() - 1)).toLatin1(); QString nameVect = parameterName.left(parameterName.length() - 2); CVector4 val = parameterContainer->GetDefault<CVector4>(nameVect); QString valS = QString("%L1").arg(val.itemByName(lastChar), 0, 'g', 16); defaultText = valS; gotDefault = true; } else { QString val = parameterContainer->GetDefault<QString>(parameterName); defaultText = val; gotDefault = true; } setToolTipText(); } return defaultText; }
bool MyCheckBox::GetDefault() { if (parameterContainer && !gotDefault) { defaultValue = parameterContainer->GetDefault<bool>(parameterName); gotDefault = true; setToolTipText(); } return defaultValue; }
QString FileSelectWidget::GetDefault() { if (parameterContainer && !gotDefault) { QString val = parameterContainer->GetDefault<QString>(parameterName); defaultValue = val; gotDefault = true; setToolTipText(); } return defaultValue; }
int cMaterialSelector::GetDefault() { if (parameterContainer && !gotDefault) { int val = parameterContainer->GetDefault<int>(parameterName); defaultValue = val; gotDefault = true; setToolTipText(); } return defaultValue; }
int MySpinBox::GetDefault() { if (parameterContainer && !gotDefault) { int val = parameterContainer->GetDefault<int>(parameterName); defaultValue = val; gotDefault = true; setToolTipText(); } return defaultValue; }
bool GUITable::OnEvent(const SEvent &event) { if (!isEnabled()) return IGUIElement::OnEvent(event); if (event.EventType == EET_KEY_INPUT_EVENT) { if (event.KeyInput.PressedDown && ( event.KeyInput.Key == KEY_DOWN || event.KeyInput.Key == KEY_UP || event.KeyInput.Key == KEY_HOME || event.KeyInput.Key == KEY_END || event.KeyInput.Key == KEY_NEXT || event.KeyInput.Key == KEY_PRIOR)) { s32 offset = 0; switch (event.KeyInput.Key) { case KEY_DOWN: offset = 1; break; case KEY_UP: offset = -1; break; case KEY_HOME: offset = - (s32) m_visible_rows.size(); break; case KEY_END: offset = m_visible_rows.size(); break; case KEY_NEXT: offset = AbsoluteRect.getHeight() / m_rowheight; break; case KEY_PRIOR: offset = - (s32) (AbsoluteRect.getHeight() / m_rowheight); break; default: break; } s32 old_selected = m_selected; s32 rowcount = m_visible_rows.size(); if (rowcount != 0) { m_selected = rangelim(m_selected + offset, 0, rowcount-1); autoScroll(); } if (m_selected != old_selected) sendTableEvent(0, false); return true; } else if (event.KeyInput.PressedDown && ( event.KeyInput.Key == KEY_LEFT || event.KeyInput.Key == KEY_RIGHT)) { // Open/close subtree via keyboard if (m_selected >= 0) { int dir = event.KeyInput.Key == KEY_LEFT ? -1 : 1; toggleVisibleTree(m_selected, dir, true); } return true; } else if (!event.KeyInput.PressedDown && ( event.KeyInput.Key == KEY_RETURN || event.KeyInput.Key == KEY_SPACE)) { sendTableEvent(0, true); return true; } else if (event.KeyInput.Key == KEY_ESCAPE || event.KeyInput.Key == KEY_SPACE) { // pass to parent } else if (event.KeyInput.PressedDown && event.KeyInput.Char) { // change selection based on text as it is typed s32 now = getTimeMs(); if (now - m_keynav_time >= 500) m_keynav_buffer = L""; m_keynav_time = now; // add to key buffer if not a key repeat if (!(m_keynav_buffer.size() == 1 && m_keynav_buffer[0] == event.KeyInput.Char)) { m_keynav_buffer.append(event.KeyInput.Char); } // find the selected item, starting at the current selection // don't change selection if the key buffer matches the current item s32 old_selected = m_selected; s32 start = MYMAX(m_selected, 0); s32 rowcount = m_visible_rows.size(); for (s32 k = 1; k < rowcount; ++k) { s32 current = start + k; if (current >= rowcount) current -= rowcount; if (doesRowStartWith(getRow(current), m_keynav_buffer)) { m_selected = current; break; } } autoScroll(); if (m_selected != old_selected) sendTableEvent(0, false); return true; } } if (event.EventType == EET_MOUSE_INPUT_EVENT) { core::position2d<s32> p(event.MouseInput.X, event.MouseInput.Y); if (event.MouseInput.Event == EMIE_MOUSE_WHEEL) { m_scrollbar->setPos(m_scrollbar->getPos() + (event.MouseInput.Wheel < 0 ? -3 : 3) * - (s32) m_rowheight / 2); return true; } // Find hovered row and cell bool really_hovering = false; s32 row_i = getRowAt(p.Y, really_hovering); const Cell *cell = NULL; if (really_hovering) { s32 cell_j = getCellAt(p.X, row_i); if (cell_j >= 0) cell = &(getRow(row_i)->cells[cell_j]); } // Update tooltip setToolTipText(cell ? m_strings[cell->tooltip_index].c_str() : L""); // Fix for #1567/#1806: // IGUIScrollBar passes double click events to its parent, // which we don't want. Detect this case and discard the event if (event.MouseInput.Event != EMIE_MOUSE_MOVED && m_scrollbar->isVisible() && m_scrollbar->isPointInside(p)) return true; if (event.MouseInput.isLeftPressed() && (isPointInside(p) || event.MouseInput.Event == EMIE_MOUSE_MOVED)) { s32 sel_column = 0; bool sel_doubleclick = (event.MouseInput.Event == EMIE_LMOUSE_DOUBLE_CLICK); bool plusminus_clicked = false; // For certain events (left click), report column // Also open/close subtrees when the +/- is clicked if (cell && ( event.MouseInput.Event == EMIE_LMOUSE_PRESSED_DOWN || event.MouseInput.Event == EMIE_LMOUSE_DOUBLE_CLICK || event.MouseInput.Event == EMIE_LMOUSE_TRIPLE_CLICK)) { sel_column = cell->reported_column; if (cell->content_type == COLUMN_TYPE_TREE) plusminus_clicked = true; } if (plusminus_clicked) { if (event.MouseInput.Event == EMIE_LMOUSE_PRESSED_DOWN) { toggleVisibleTree(row_i, 0, false); } } else { // Normal selection s32 old_selected = m_selected; m_selected = row_i; autoScroll(); if (m_selected != old_selected || sel_column >= 1 || sel_doubleclick) { sendTableEvent(sel_column, sel_doubleclick); } // Treeview: double click opens/closes trees if (m_has_tree_column && sel_doubleclick) { toggleVisibleTree(m_selected, 0, false); } } } return true; } if (event.EventType == EET_GUI_EVENT && event.GUIEvent.EventType == gui::EGET_SCROLL_BAR_CHANGED && event.GUIEvent.Caller == m_scrollbar) { // Don't pass events from our scrollbar to the parent return true; } return IGUIElement::OnEvent(event); }
ChEXPORT XlHLinkToolTip::~XlHLinkToolTip() { setToolTipArea(NULL); setToolTipText(NULL); }