void iARenderer::setAreaPicker() { auto areaPicker = vtkSmartPointer<vtkAreaPicker>::New(); interactor->SetPicker(areaPicker); auto style = vtkSmartPointer<MouseInteractorStyle>::New(); interactor->SetInteractorStyle(style); auto keyPressCallback = vtkSmartPointer<vtkCallbackCommand>::New(); keyPressCallback->SetCallback(KeyPressCallbackFunction); keyPressCallback->SetClientData(this); interactor->AddObserver(vtkCommand::KeyReleaseEvent, keyPressCallback, 1.0); auto pickCallback = vtkSmartPointer<vtkCallbackCommand>::New(); pickCallback->SetCallback(PickCallbackFunction); pickCallback->SetClientData(this); areaPicker->AddObserver(vtkCommand::EndPickEvent, pickCallback, 1.0); finalSelection = vtkSmartPointer<vtkUnstructuredGrid>::New(); selectedMapper = vtkSmartPointer<vtkDataSetMapper>::New(); selectedMapper->SetScalarModeToUseCellData(); selectedMapper->SetInputData(finalSelection); selectedActor = vtkSmartPointer<vtkActor>::New(); QColor c(255, 0, 0); selectedActor->SetMapper(selectedMapper); selectedActor->GetProperty()->SetColor(c.redF(), c.greenF(), c.blueF()); selectedActor->GetProperty()->SetRepresentationToWireframe(); selectedActor->GetProperty()->EdgeVisibilityOn(); selectedActor->GetProperty()->SetEdgeColor(c.redF(), c.greenF(), c.blueF()); selectedActor->GetProperty()->SetLineWidth(3); }
RSMainFrame::RSMainFrame(wxWindow* parent) : MainFrame(parent) { m_db = new AppDB("", "", "dbname.sqlite", "", ""); SetClientData(m_db); }
void wxChoice::SetString(unsigned int n, const wxString& s) { wxCHECK_RET( IsValid(n), wxT("invalid item index in wxChoice::SetString") ); // we have to delete and add back the string as there is no way to change a // string in place // we need to preserve the client data manually void *oldData = NULL; wxClientData *oldObjData = NULL; if ( HasClientUntypedData() ) oldData = GetClientData(n); else if ( HasClientObjectData() ) oldObjData = GetClientObject(n); // and also the selection if we're going to delete the item that was // selected const bool wasSelected = static_cast<int>(n) == GetSelection(); ::SendMessage(GetHwnd(), CB_DELETESTRING, n, 0); ::SendMessage(GetHwnd(), CB_INSERTSTRING, n, (LPARAM)s.wx_str() ); // restore the client data if ( oldData ) SetClientData(n, oldData); else if ( oldObjData ) SetClientObject(n, oldObjData); // and the selection if ( wasSelected ) SetSelection(n); // the width could have changed so the best size needs to be recomputed InvalidateBestSize(); }
void wxItemContainer::AssignNewItemClientData(unsigned int pos, void **clientData, unsigned int n, wxClientDataType type) { switch ( type ) { case wxClientData_Object: SetClientObject ( pos, (reinterpret_cast<wxClientData **>(clientData))[n] ); break; case wxClientData_Void: SetClientData(pos, clientData[n]); break; default: wxFAIL_MSG( wxT("unknown client data type") ); wxFALLTHROUGH; case wxClientData_None: // nothing to do break; } }
void wxChoice::SetString(unsigned int n, const wxString& s) { wxCHECK_RET( IsValid(n), wxT("invalid item index in wxChoice::SetString") ); // we have to delete and add back the string as there is no way to change a // string in place // we need to preserve the client data manually void *oldData = NULL; wxClientData *oldObjData = NULL; if ( HasClientUntypedData() ) oldData = GetClientData(n); else if ( HasClientObjectData() ) oldObjData = GetClientObject(n); ::SendMessage(GetHwnd(), CB_DELETESTRING, n, 0); ::SendMessage(GetHwnd(), CB_INSERTSTRING, n, (LPARAM)s.wx_str() ); // restore the client data if ( oldData ) SetClientData(n, oldData); else if ( oldObjData ) SetClientObject(n, oldObjData); InvalidateBestSize(); }
void wxListBox::SetString(unsigned int n, const wxString& rsString) { wxCHECK_RET( IsValid(n), wxT("invalid index in wxListBox::SetString") ); // // Remember the state of the item // bool bWasSelected = IsSelected(n); void* pOldData = NULL; wxClientData* pOldObjData = NULL; if ( HasClientUntypedData() ) pOldData = GetClientData(n); else if ( HasClientObjectData() ) pOldObjData = GetClientObject(n); // // Delete and recreate it // ::WinSendMsg( GetHwnd() ,LM_DELETEITEM ,(MPARAM)n ,(MPARAM)0 ); int nNewN = n; if (n == (m_nNumItems - 1)) nNewN = -1; ::WinSendMsg( GetHwnd() ,LM_INSERTITEM ,(MPARAM)nNewN ,(MPARAM)rsString.wx_str() ); // // Restore the client data // if (pOldData) SetClientData(n, pOldData); else if (pOldObjData) SetClientObject(n, pOldObjData); // // We may have lost the selection // if (bWasSelected) Select(n); #if wxUSE_OWNER_DRAWN if (m_windowStyle & wxLB_OWNERDRAW) // // Update item's text // m_aItems[n]->SetName(rsString); #endif //USE_OWNER_DRAWN } // end of wxListBox::SetString
int wxItemContainer::Insert(const wxString& item, int pos, void *clientData) { int n = DoInsert(item, pos); if ( n != wxNOT_FOUND ) SetClientData(n, clientData); return n; }
void wxSingleChoiceDialog::OnOK(wxCommandEvent& WXUNUSED(event)) { m_selection = m_listbox->GetSelection(); m_stringSelection = m_listbox->GetStringSelection(); if ( m_listbox->HasClientUntypedData() ) SetClientData(m_listbox->GetClientData(m_selection)); EndModal(wxID_OK); }
int wxBitmapComboBox::Insert(const wxString& item, const wxBitmap& bitmap, unsigned int pos, void *clientData) { int n = DoInsertWithImage(item, bitmap, pos); if ( n != wxNOT_FOUND ) SetClientData(n, clientData); return n; }
void wxSingleChoiceDialog::DoChoice() { m_selection = m_listbox->GetSelection(); m_stringSelection = m_listbox->GetStringSelection(); if ( m_listbox->HasClientUntypedData() ) SetClientData(m_listbox->GetClientData(m_selection)); EndModal(wxID_OK); }
void wxRearrangeList::Swap(int pos1, int pos2) { // update the internally stored order wxSwap(m_order[pos1], m_order[pos2]); // and now also swap all the attributes of the items // first the label const wxString stringTmp = GetString(pos1); SetString(pos1, GetString(pos2)); SetString(pos2, stringTmp); // then the checked state const bool checkedTmp = IsChecked(pos1); wxCheckListBox::Check(pos1, IsChecked(pos2)); wxCheckListBox::Check(pos2, checkedTmp); // and finally the client data, if necessary switch ( GetClientDataType() ) { case wxClientData_None: // nothing to do break; case wxClientData_Object: { wxClientData * const dataTmp = DetachClientObject(pos1); SetClientObject(pos1, DetachClientObject(pos2)); SetClientObject(pos2, dataTmp); } break; case wxClientData_Void: { void * const dataTmp = GetClientData(pos1); SetClientData(pos1, GetClientData(pos2)); SetClientData(pos2, dataTmp); } break; } }
void MaxCheckListBox::Delete(unsigned int n) { if (HasClientUntypedData()) { void * data = GetClientData(n); if (data) { BBRELEASE((BBObject*)data); SetClientData(n, 0); } } wxCheckListBox::Delete(n); }
void MaxCheckListBox::Clear() { // we need to free any items int count = GetCount(); if (HasClientUntypedData()) { for (int i = 0; i < count; i++) { void * data = GetClientData(i); if (data) { BBRELEASE((BBObject*)data); SetClientData(i, 0); } } } wxCheckListBox::Clear(); }
wxFastComboEditor::wxFastComboEditor(size_t count, const wxString choices[], bool allowOthers) : m_allowOthers(allowOthers) { SetClientData((void*)&m_pointActivate); if ( count ) { m_choices.Alloc(count); for (size_t n = 0; n < count; n++ ) { m_choices.Add(choices[n]); } } }
void wxListBox::DoSetItems( const wxArrayString& items, void **clientData) { Clear(); DoInsertItems(items, 0); if ( clientData ) { unsigned int count = items.GetCount(); for ( unsigned int n = 0; n < count; n++ ) { SetClientData(n, clientData[n]); } } }
void wxListBox::DoSetItems(const wxArrayString& choices, void** clientData) { // avoid flicker - but don't need to do this for a hidden listbox bool hideAndShow = IsShown(); if ( hideAndShow ) { ShowWindow(GetHwnd(), SW_HIDE); } ListBox_ResetContent(GetHwnd()); m_noItems = choices.GetCount(); int i; for (i = 0; i < m_noItems; i++) { ListBox_AddString(GetHwnd(), choices[i]); if ( clientData ) { SetClientData(i, clientData[i]); } } #if wxUSE_OWNER_DRAWN if ( m_windowStyle & wxLB_OWNERDRAW ) { // first delete old items WX_CLEAR_ARRAY(m_aItems); // then create new ones for ( size_t ui = 0; ui < (size_t)m_noItems; ui++ ) { wxOwnerDrawn *pNewItem = CreateLboxItem(ui); pNewItem->SetName(choices[ui]); m_aItems.Add(pNewItem); ListBox_SetItemData(GetHwnd(), ui, pNewItem); } } #endif // wxUSE_OWNER_DRAWN SetHorizontalExtent(); if ( hideAndShow ) { // show the listbox back if we hid it ShowWindow(GetHwnd(), SW_SHOW); } InvalidateBestSize(); }
void wxListBox::SetString(unsigned int n, const wxString& s) { wxCHECK_RET( IsValid(n), wxT("invalid index in wxListBox::SetString") ); // remember the state of the item bool wasSelected = IsSelected(n); void *oldData = NULL; wxClientData *oldObjData = NULL; if ( m_clientDataItemsType == wxClientData_Void ) oldData = GetClientData(n); else if ( m_clientDataItemsType == wxClientData_Object ) oldObjData = GetClientObject(n); // delete and recreate it SendMessage(GetHwnd(), LB_DELETESTRING, n, 0); int newN = n; if ( n == (m_noItems - 1) ) newN = -1; ListBox_InsertString(GetHwnd(), newN, s); // restore the client data if ( oldData ) SetClientData(n, oldData); else if ( oldObjData ) SetClientObject(n, oldObjData); #if wxUSE_OWNER_DRAWN if ( m_windowStyle & wxLB_OWNERDRAW ) { // update item's text m_aItems[n]->SetName(s); // reassign the item's data ListBox_SetItemData(GetHwnd(), n, m_aItems[n]); } #endif //USE_OWNER_DRAWN // we may have lost the selection if ( wasSelected ) Select(n); SetHorizontalExtent(); }
void wxListBox::SetString(int N, const wxString& s) { wxCHECK_RET( N >= 0 && N < m_noItems, wxT("invalid index in wxListBox::SetString") ); // remember the state of the item bool wasSelected = IsSelected(N); void *oldData = NULL; wxClientData *oldObjData = NULL; if ( m_clientDataItemsType == wxClientData_Void ) oldData = GetClientData(N); else if ( m_clientDataItemsType == wxClientData_Object ) oldObjData = GetClientObject(N); // delete and recreate it SendMessage(GetHwnd(), LB_DELETESTRING, N, 0); int newN = N; if ( N == m_noItems - 1 ) newN = -1; ListBox_InsertString(GetHwnd(), newN, s); // restore the client data if ( oldData ) SetClientData(N, oldData); else if ( oldObjData ) SetClientObject(N, oldObjData); #if wxUSE_OWNER_DRAWN if ( m_windowStyle & wxLB_OWNERDRAW ) { // update item's text m_aItems[N]->SetName(s); // reassign the item's data ListBox_SetItemData(GetHwnd(), N, m_aItems[N]); } #endif //USE_OWNER_DRAWN // we may have lost the selection if ( wasSelected ) Select(N); InvalidateBestSize(); }
void wxListBox::SetString(unsigned int n, const wxString& s) { wxCHECK_RET( IsValid(n), wxT("invalid index in wxListBox::SetString") ); // remember the state of the item bool wasSelected = IsSelected(n); void *oldData = NULL; wxClientData *oldObjData = NULL; if ( HasClientUntypedData() ) oldData = GetClientData(n); else if ( HasClientObjectData() ) oldObjData = GetClientObject(n); // delete and recreate it SendMessage(GetHwnd(), LB_DELETESTRING, n, 0); int newN = n; if ( n == (m_noItems - 1) ) newN = -1; ListBox_InsertString(GetHwnd(), newN, s.wx_str()); // restore the client data if ( oldData ) SetClientData(n, oldData); else if ( oldObjData ) SetClientObject(n, oldObjData); // we may have lost the selection if ( wasSelected ) Select(n); MSWOnItemsChanged(); }
void wxBitmapComboBox::RecreateControl() { // // Recreate control so that WM_MEASUREITEM gets called again. // Can't use CBS_OWNERDRAWVARIABLE because it has odd // mouse-wheel behaviour. // wxString value = GetValue(); wxPoint pos = GetPosition(); wxSize size = GetSize(); size.y = GetBestSize().y; const wxArrayString strings = GetStrings(); const unsigned numItems = strings.size(); unsigned i; // Save the client data pointers before clearing the control, if any. const wxClientDataType clientDataType = GetClientDataType(); wxVector<wxClientData*> objectClientData; wxVector<void*> voidClientData; switch ( clientDataType ) { case wxClientData_None: break; case wxClientData_Object: objectClientData.reserve(numItems); for ( i = 0; i < numItems; ++i ) objectClientData.push_back(GetClientObject(i)); break; case wxClientData_Void: voidClientData.reserve(numItems); for ( i = 0; i < numItems; ++i ) voidClientData.push_back(GetClientData(i)); break; } wxComboBox::DoClear(); HWND hwnd = GetHwnd(); DissociateHandle(); ::DestroyWindow(hwnd); if ( !MSWCreateControl(wxT("COMBOBOX"), wxEmptyString, pos, size) ) return; // initialize the controls contents for ( i = 0; i < numItems; i++ ) { wxComboBox::Append(strings[i]); if ( !objectClientData.empty() ) SetClientObject(i, objectClientData[i]); else if ( !voidClientData.empty() ) SetClientData(i, voidClientData[i]); } // and make sure it has the same attributes as before if ( m_hasFont ) { // calling SetFont(m_font) would do nothing as the code would // notice that the font didn't change, so force it to believe // that it did wxFont font = m_font; m_font = wxNullFont; SetFont(font); } if ( m_hasFgCol ) { wxColour colFg = m_foregroundColour; m_foregroundColour = wxNullColour; SetForegroundColour(colFg); } if ( m_hasBgCol ) { wxColour colBg = m_backgroundColour; m_backgroundColour = wxNullColour; SetBackgroundColour(colBg); } else { SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); } ::SendMessage(GetHwnd(), CB_SETITEMHEIGHT, 0, MeasureItem(0)); // Revert the old string value if ( !HasFlag(wxCB_READONLY) ) ChangeValue(value); }
void wxListBox::SetString( int N , const wxString& rsString ) { wxCHECK_RET( N >= 0 && N < m_nNumItems, wxT("invalid index in wxListBox::SetString") ); // // Remember the state of the item // bool bWasSelected = IsSelected(N); void* pOldData = NULL; wxClientData* pOldObjData = NULL; if (m_clientDataItemsType == wxClientData_Void) pOldData = GetClientData(N); else if (m_clientDataItemsType == wxClientData_Object) pOldObjData = GetClientObject(N); // // Delete and recreate it // ::WinSendMsg( GetHwnd() ,LM_DELETEITEM ,(MPARAM)N ,(MPARAM)0 ); int nNewN = N; if (N == m_nNumItems - 1) nNewN = -1; ::WinSendMsg( GetHwnd() ,LM_INSERTITEM ,(MPARAM)nNewN ,(MPARAM)rsString.c_str() ); // // Restore the client data // if (pOldData) SetClientData( N ,pOldData ); else if (pOldObjData) SetClientObject( N ,pOldObjData ); // // We may have lost the selection // if (bWasSelected) Select(N); #if wxUSE_OWNER_DRAWN if (m_windowStyle & wxLB_OWNERDRAW) // // Update item's text // m_aItems[N]->SetName(rsString); #endif //USE_OWNER_DRAWN } // end of wxListBox::SetString