void GLCanvas::OnLeftDown(wxMouseEvent &event) { SetFocus(); wxSize size = GetSize(); wxPoint pos = event.GetPosition(); bool showMenu = false; if (pos.x > size.x - _buttonSize && pos.y < _numButtons * _buttonSize) { int index = pos.y / _buttonSize; switch (index) { case 0: _style = _style & DRAW_GRID ? _style & ~DRAW_GRID : _style | DRAW_GRID; break; case 1: _style = _style & DRAW_AABB ? _style & ~DRAW_AABB : _style | DRAW_AABB; break; case 2: _style = _style & DRAW_LOCAL_COORDINATE_SYSTEM ? _style & ~DRAW_LOCAL_COORDINATE_SYSTEM : _style | DRAW_LOCAL_COORDINATE_SYSTEM; break; case 3: _style = _style & DRAW_JOINT_CONSTRAINTS ? _style & ~DRAW_JOINT_CONSTRAINTS : _style | DRAW_JOINT_CONSTRAINTS; break; case 4: _style = _style & DRAW_ROTATION_AXIS ? _style & ~DRAW_ROTATION_AXIS : _style | DRAW_ROTATION_AXIS; break; case 5: _style = _style & DRAW_LABEL ? _style & ~DRAW_LABEL : _style | DRAW_LABEL; break; case 6: if (_skeleton != nullptr) { _cameraPosition = _skeleton->getPosition() - 3.0f*_cameraFront; } else { _cameraPosition = Vector3(0.0f, 1.0f, 3.0f); } break; case 7: showMenu = true; break; default: break; } if (showMenu) { GLCanvasDialog dialog(this); dialog.setBackgroundColor(_backgroundColor); dialog.setLineWidth(_lineWidth); dialog.setSkeleton(_skeleton); dialog.setTraceLength(_traceLength); std::vector<int> boneIds; for (auto it = _boneIdsWithTracePoints.begin(); it != _boneIdsWithTracePoints.end(); ++it) { boneIds.push_back(it->first); } dialog.setBonesWithTrace(boneIds); if (dialog.ShowModal() == wxID_OK) { _backgroundColor = dialog.getBackgroundColor(); glClearColor(float(_backgroundColor.Red())/255.0f, float(_backgroundColor.Green())/255.0f, float(_backgroundColor.Blue())/255.0f, 0.0); _lineWidth = dialog.getLineWidth(); _traceLength = dialog.getTraceLength(); _tracePos = 0; _boneIdsWithTracePoints.clear(); boneIds = dialog.getBonesWithTrace(); for (size_t i = 0; i < boneIds.size(); ++i) { _boneIdsWithTracePoints[boneIds[i]] = std::vector<Vector3>(); } Refresh(); } } return; } if (!HasCapture()) { CaptureMouse(); } _lClicked = true; _prevMousePos = pos; SetCursor(wxCURSOR_BLANK); event.Skip(); }
unsigned GetWidth() const { return GetSize().cx; }
PrefsDialog::PrefsDialog(wxWindow * parent) : wxDialog(parent, wxID_ANY, wxString(_("Audacity Preferences")), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) { ShuttleGui S(this, eIsCreating); S.StartVerticalLay(true); { S.StartHorizontalLay(wxALIGN_LEFT | wxEXPAND, true); { mCategories = new wxTreebookExt(this, wxID_ANY); S.Prop(1); S.AddWindow(mCategories, wxEXPAND); wxWindow *w; // Parameters are: AddPage(page, name, IsSelected, imageId). w = new DevicePrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0); w = new PlaybackPrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0); w = new RecordingPrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0); #ifdef EXPERIMENTAL_MIDI_OUT w = new MidiIOPrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0); #endif w = new QualityPrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0); w = new GUIPrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0); w = new TracksPrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0); w = new ImportExportPrefs(mCategories);mCategories->AddPage(w, w->GetName(), false, 0); w = new ExtImportPrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0); w = new ProjectsPrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0); #if !defined(DISABLE_DYNAMIC_LOADING_FFMPEG) || !defined(DISABLE_DYNAMIC_LOADING_LAME) w = new LibraryPrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0); #endif w = new SpectrumPrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0); w = new DirectoriesPrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0); w = new WarningsPrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0); w = new EffectsPrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0); #ifdef EXPERIMENTAL_THEME_PREFS w = new ThemePrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0); #endif // w = new BatchPrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0); w = new KeyConfigPrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0); w = new MousePrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0); #ifdef EXPERIMENTAL_MODULE_PREFS w = new ModulePrefs(mCategories); mCategories->AddPage(w, w->GetName(), false, 0); #endif } S.EndHorizontalLay(); } S.EndVerticalLay(); S.AddStandardButtons(eOkButton | eCancelButton); /* long is signed, size_t is unsigned. On some platforms they are different * lengths as well. So we must check that the stored category is both > 0 * and within the possible range of categories, making the first check on the * _signed_ value to avoid issues when converting an unsigned one. */ size_t selected; long prefscat = gPrefs->Read(wxT("/Prefs/PrefsCategory"), 0L); if (prefscat > 0L ) selected = prefscat; // only assign if number will fit else selected = 0; // use 0 if value can't be assigned if (selected >= mCategories->GetPageCount()) selected = 0; // clamp to available range of tabs mCategories->SetSelection(selected); #if defined(__WXGTK__) mCategories->GetTreeCtrl()->EnsureVisible(mCategories->GetTreeCtrl()->GetRootItem()); #endif // mCategories->SetSizeHints(-1, -1, 790, 600); // 790 = 800 - (border * 2) Layout(); Fit(); wxSize sz = GetSize(); wxASSERT_MSG(sz.x <= 800 && sz.y <= 600, wxT("Preferences dialog exceeds max size")); if (sz.x > 800) { sz.x = 800; } if (sz.y > 600) { sz.y = 600; } // Set the minimum height to be slightly bigger than default, as fix for bug 161. // The magic number 7 was determined by Ed's experimentation. // Frankly, this is a hack to work around a bug in wxTreebook, and // will have to be revisited if we add another category to mCategories. // JKC later added a category and 20 onto the 7. SetSizeHints(sz.x, sz.y + 7 + 20, 800, 600); // Center after all that resizing, but make sure it doesn't end up // off-screen CentreOnParent(); }
void Background::Draw() { GetContext()->GetSkin().DrawBackgroundNormal(Point(), GetSize()); Single::Draw(); }
wxObject * MaxSplitterWindowXmlHandler::DoCreateResource() { XRC_MAKE_INSTANCE(splitter, MaxSplitterWindow); splitter->Create(m_parentAsWindow, GetID(), GetPosition(), GetSize(), GetStyle(wxT("style"), wxSP_3D), GetName()); splitter->MaxBind(_wx_wxsplitterwindow_wxSplitterWindow__xrcNew(splitter)); SetupWindow(splitter); long sashpos = GetLong(wxT("sashpos"), 0); long minpanesize = GetLong(wxT("minsize"), -1); float gravity = GetFloat(wxT("gravity"), 0.0); if (minpanesize != -1) splitter->SetMinimumPaneSize(minpanesize); if (gravity != 0.0) splitter->SetSashGravity(gravity); wxWindow *win1 = NULL, *win2 = NULL; wxXmlNode *n = m_node->GetChildren(); while (n) { if ((n->GetType() == wxXML_ELEMENT_NODE) && (n->GetName() == wxT("object") || n->GetName() == wxT("object_ref"))) { wxObject *created = CreateResFromNode(n, splitter, NULL); wxWindow *win = wxDynamicCast(created, wxWindow); if (win1 == NULL) { win1 = win; } else { win2 = win; break; } } n = n->GetNext(); } if (win1 == NULL) wxLogError(wxT("wxSplitterWindow node must contain at least one window.")); bool horizontal = (GetParamValue(wxT("orientation")) != wxT("vertical")); if (win1 && win2) { if (horizontal) splitter->SplitHorizontally(win1, win2, sashpos); else splitter->SplitVertically(win1, win2, sashpos); } else { splitter->Initialize(win1); } return splitter; }
ProcessesDialog::ProcessesDialog( wxWindow* parent ) : wxDialog( parent, wxID_ANY, _("Processes"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ) { wxFlexGridSizer* fgSizer2; fgSizer2 = new wxFlexGridSizer( 1, 1, 0, 0 ); fgSizer2->AddGrowableCol( 0 ); fgSizer2->AddGrowableRow( 0 ); fgSizer2->SetFlexibleDirection( wxBOTH ); wxStaticBoxSizer* sbSizer1; sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( this, -1, wxT("Available Processes") ), wxHORIZONTAL ); wxFlexGridSizer* fgSizer1; fgSizer1 = new wxFlexGridSizer( 2, 1, 0, 0 ); fgSizer1->AddGrowableCol( 0 ); fgSizer1->AddGrowableRow( 0 ); fgSizer1->SetFlexibleDirection( wxBOTH ); m_processList = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxSize(400, 300), wxLC_REPORT | wxLC_SINGLE_SEL); m_processList->InsertColumn(0, "Process"); m_processList->InsertColumn(1, "ID"); m_processList->InsertColumn(2, "Title"); m_processList->SetColumnWidth(0, 100); m_processList->SetColumnWidth(1, 50); m_processList->SetColumnWidth(2, 350); fgSizer1->Add( m_processList, 0, wxALL|wxEXPAND, 5 ); sbSizer1->Add( fgSizer1, 1, wxEXPAND, 5 ); fgSizer2->Add( sbSizer1, 1, wxALL|wxEXPAND, 5 ); wxBoxSizer* bSizer1; bSizer1 = new wxBoxSizer( wxHORIZONTAL ); m_refresh = new wxButton( this, ID_Refresh, wxT("&Refresh"), wxDefaultPosition, wxDefaultSize, 0 ); bSizer1->Add( m_refresh, 0, wxALL, 5 ); m_attach = new wxButton( this, wxID_OK, wxT("&Attach"), wxDefaultPosition, wxDefaultSize, 0 ); bSizer1->Add( m_attach, 0, wxALL, 5 ); m_close = new wxButton( this, wxID_CANCEL, wxT("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); bSizer1->Add( m_close, 0, wxALL, 5 ); fgSizer2->Add( bSizer1, 1, wxALL | wxALIGN_RIGHT, 5 ); SetSizer( fgSizer2 ); wxSize minSize = fgSizer2->GetMinSize(); SetClientSize(minSize); SetMinSize(GetSize()); Layout(); m_sortColumn = 0; m_sortForward = true; Refresh(); }
T& operator[](int i) { assert(i >= 0 && i < GetCapacity() && i < GetSize()); return m_astData[i]; }
DIALOG_CREATE_ARRAY::DIALOG_CREATE_ARRAY( PCB_BASE_FRAME* aParent, bool enableNumbering, wxPoint aOrigPos ) : DIALOG_CREATE_ARRAY_BASE( aParent ), m_settings( NULL ), m_hSpacing( aParent, m_labelDx, m_entryDx, m_unitLabelDx ), m_vSpacing( aParent, m_labelDy, m_entryDy, m_unitLabelDy ), m_hOffset( aParent, m_labelOffsetX, m_entryOffsetX, m_unitLabelOffsetX ), m_vOffset( aParent, m_labelOffsetY, m_entryOffsetY, m_unitLabelOffsetY ), m_hCentre( aParent, m_labelCentreX, m_entryCentreX, m_unitLabelCentreX ), m_vCentre( aParent, m_labelCentreY, m_entryCentreY, m_unitLabelCentreY ), m_circRadius( aParent, m_labelCircRadius, m_valueCircRadius, m_unitLabelCircRadius ), m_circAngle( aParent, m_labelCircAngle, m_entryCircAngle, m_unitLabelCircAngle ), m_cfg_persister( saved_array_options.m_optionsSet ), m_originalItemPosition( aOrigPos ), m_numberingEnabled( enableNumbering ) { // Set up numbering scheme drop downs // // character set // NOTE: do not change the order of this relative to the NUMBERING_TYPE_T enum const wxString charSetDescriptions[] = { _( "Numerals (0,1,2,...,9,10)" ), _( "Hexadecimal (0,1,...,F,10,...)" ), _( "Alphabet, minus IOSQXZ" ), _( "Alphabet, full 26 characters" ) }; m_choicePriAxisNumbering->Set( arrayDim( charSetDescriptions ), charSetDescriptions ); m_choiceSecAxisNumbering->Set( arrayDim( charSetDescriptions ), charSetDescriptions ); m_choicePriAxisNumbering->SetSelection( 0 ); m_choiceSecAxisNumbering->SetSelection( 0 ); m_circAngle.SetUnits( EDA_UNITS_T::DEGREES ); // bind grid options to persister m_cfg_persister.Add( *m_entryNx, saved_array_options.m_gridNx ); m_cfg_persister.Add( *m_entryNy, saved_array_options.m_gridNy ); m_cfg_persister.Add( m_hSpacing, saved_array_options.m_gridDx ); m_cfg_persister.Add( m_vSpacing, saved_array_options.m_gridDy ); m_cfg_persister.Add( m_hOffset, saved_array_options.m_gridOffsetX ); m_cfg_persister.Add( m_vOffset, saved_array_options.m_gridOffsetY ); m_cfg_persister.Add( *m_entryStagger, saved_array_options.m_gridStagger ); m_cfg_persister.Add( *m_radioBoxGridStaggerType, saved_array_options.m_gridStaggerType ); m_cfg_persister.Add( *m_radioBoxGridNumberingAxis, saved_array_options.m_gridNumberingAxis ); m_cfg_persister.Add( *m_checkBoxGridReverseNumbering, saved_array_options.m_gridNumberingReverseAlternate ); m_cfg_persister.Add( *m_rbGridStartNumberingOpt, saved_array_options.m_gridNumberingStartSet ); m_cfg_persister.Add( *m_radioBoxGridNumberingScheme, saved_array_options.m_grid2dArrayNumbering ); m_cfg_persister.Add( *m_choicePriAxisNumbering, saved_array_options.m_gridPriAxisNumScheme ); m_cfg_persister.Add( *m_choiceSecAxisNumbering, saved_array_options.m_gridSecAxisNumScheme ); m_cfg_persister.Add( *m_entryGridPriNumberingOffset, saved_array_options.m_gridPriNumberingOffset ); m_cfg_persister.Add( *m_entryGridSecNumberingOffset, saved_array_options.m_gridSecNumberingOffset ); // bind circular options to persister m_cfg_persister.Add( m_hCentre, saved_array_options.m_circCentreX ); m_cfg_persister.Add( m_vCentre, saved_array_options.m_circCentreY ); m_cfg_persister.Add( m_circAngle, saved_array_options.m_circAngle ); m_cfg_persister.Add( *m_entryCircCount, saved_array_options.m_circCount ); m_cfg_persister.Add( *m_entryRotateItemsCb, saved_array_options.m_circRotate ); m_cfg_persister.Add( *m_rbCircStartNumberingOpt, saved_array_options.m_circNumberingStartSet ); m_cfg_persister.Add( *m_entryCircNumberingStart, saved_array_options.m_circNumberingOffset ); m_cfg_persister.Add( *m_gridTypeNotebook, saved_array_options.m_arrayTypeTab ); m_cfg_persister.RestoreConfigToControls(); // Run the callbacks once to process the dialog contents setControlEnablement(); calculateCircularArrayProperties(); m_stdButtonsOK->SetDefault(); Fit(); SetMinSize( GetSize() ); }
const TargetPhrase &TargetPhraseCollection::GetTargetPhrase(size_t ind) const { assert(ind < GetSize()); return *m_coll[ind]; }
/** * @brief Starts the camera capture in snapshot mode. * @param buff: pointer to the camera output buffer * @retval None */ void BSP_CAMERA_SnapshotStart(uint8_t *buff) { /* Start the camera capture */ HAL_DCMI_Start_DMA(&hdcmi_eval, DCMI_MODE_SNAPSHOT, (uint32_t)buff, GetSize(current_resolution)); }
void AppPreview::Layout() { sb.SetTotal(line.GetCount()); sb.SetPage(GetSize().cy / CourierZ(12).GetHeight()); }
/** * @brief Starts the camera capture in continuous mode. * @param buff: pointer to the camera output buffer * @retval None */ void BSP_CAMERA_ContinuousStart(uint8_t *buff) { /* Start the camera capture */ HAL_DCMI_Start_DMA(&hdcmi_eval, DCMI_MODE_CONTINUOUS, (uint32_t)buff, GetSize(current_resolution)); }
GameStatsMenu::GameStatsMenu(int level) : MenuClass() { calculateScore(level); // set up window SDL_Surface *surf; surf = pGFXManager->getUIGraphic(UI_GameStatsBackground); SetBackground(surf,false); Resize(surf->w,surf->h); SetWindowWidget(&WindowWidget); TextScore.SetTextColor(COLOR_WHITE, COLOR_BLACK); TextScore.SetText(strprintf(pTextManager->getDuneText(DuneText_Score).c_str(), totalScore)); WindowWidget.AddWidget(&TextScore, (GetSize()/2) + Point(-175, -173), TextScore.GetSize()); TextTime.SetTextColor(COLOR_WHITE, COLOR_BLACK); TextTime.SetText(strprintf(pTextManager->getDuneText(DuneText_Time).c_str(), totalTime/3600, (totalTime%3600)/60)); WindowWidget.AddWidget(&TextTime, (GetSize()/2) + Point(+180 - TextTime.GetSize().x, -173), TextTime.GetSize()); TextYourRank.SetAlignment(Alignment_HCenter); TextYourRank.SetTextColor(COLOR_WHITE, COLOR_BLACK); TextYourRank.SetText(pTextManager->getDuneText(DuneText_You_have_attained_the_rank)); WindowWidget.AddWidget(&TextYourRank, (GetSize()/2) + Point(-TextYourRank.GetSize().x/2, -127), TextYourRank.GetSize()); TextRank.SetAlignment(Alignment_HCenter); TextRank.SetText(rank); WindowWidget.AddWidget(&TextRank, (GetSize()/2) + Point(-TextRank.GetSize().x/2, -105), TextRank.GetSize()); TextSpiceHarvestedBy.SetTextColor(COLOR_WHITE, COLOR_BLACK, COLOR_THICKSPICE); TextSpiceHarvestedBy.SetAlignment(Alignment_HCenter); TextSpiceHarvestedBy.SetText(pTextManager->getDuneText(DuneText_SpiceHarvestedBy)); WindowWidget.AddWidget(&TextSpiceHarvestedBy, (GetSize()/2) + Point(-TextSpiceHarvestedBy.GetSize().x/2, -40), TextSpiceHarvestedBy.GetSize()); TextUnitsDestroyedBy.SetTextColor(COLOR_WHITE, COLOR_BLACK, COLOR_THICKSPICE); TextUnitsDestroyedBy.SetAlignment(Alignment_HCenter); TextUnitsDestroyedBy.SetText(pTextManager->getDuneText(DuneText_UnitsDestroyedBy)); WindowWidget.AddWidget(&TextUnitsDestroyedBy, (GetSize()/2) + Point(-TextUnitsDestroyedBy.GetSize().x/2, 34), TextUnitsDestroyedBy.GetSize()); TextBuildingsDestroyedBy.SetTextColor(COLOR_WHITE, COLOR_BLACK, COLOR_THICKSPICE); TextBuildingsDestroyedBy.SetAlignment(Alignment_HCenter); TextBuildingsDestroyedBy.SetText(pTextManager->getDuneText(DuneText_BuildingsDestroyedBy)); WindowWidget.AddWidget(&TextBuildingsDestroyedBy, (GetSize()/2) + Point(-TextBuildingsDestroyedBy.GetSize().x/2, 108), TextBuildingsDestroyedBy.GetSize()); // spice statistics TextYou1.SetTextColor(COLOR_WHITE, COLOR_BLACK); TextYou1.SetAlignment(Alignment_Right); TextYou1.SetText(pTextManager->getDuneText(DuneText_You)); WindowWidget.AddWidget(&TextYou1, (GetSize()/2) + Point(-229 - TextYou1.GetSize().x, -23), TextYou1.GetSize()); ProgressSpiceYouShadow.SetColor(COLOR_BLACK); ProgressSpiceYouShadow.SetProgress(0.0); WindowWidget.AddWidget(&ProgressSpiceYouShadow, (GetSize()/2) + Point(-228 + 2, -15 + 2), Point(440,12)); ProgressSpiceYou.SetColor(houseColor[pLocalHouse->getHouseID()] + 1); ProgressSpiceYou.SetProgress(0.0); WindowWidget.AddWidget(&ProgressSpiceYou, (GetSize()/2) + Point(-228, -15), Point(440,12)); TextSpiceYou.SetTextColor(COLOR_WHITE, COLOR_BLACK); TextSpiceYou.SetAlignment(Alignment_HCenter); TextSpiceYou.SetVisible(false); WindowWidget.AddWidget(&TextSpiceYou, (GetSize()/2) + Point(222, -21), Point(66,21)); TextEnemy1.SetTextColor(COLOR_WHITE, COLOR_BLACK); TextEnemy1.SetAlignment(Alignment_Right); TextEnemy1.SetText(pTextManager->getDuneText(DuneText_Enemy)); WindowWidget.AddWidget(&TextEnemy1, (GetSize()/2) + Point(-229 - TextEnemy1.GetSize().x, -5), TextEnemy1.GetSize()); ProgressSpiceEnemyShadow.SetColor(COLOR_BLACK); ProgressSpiceEnemyShadow.SetProgress(0.0); WindowWidget.AddWidget(&ProgressSpiceEnemyShadow, (GetSize()/2) + Point(-228 + 2, 3 + 2), Point(440,12)); ProgressSpiceEnemy.SetColor(COLOR_SARDAUKAR + 1); ProgressSpiceEnemy.SetProgress(0.0); WindowWidget.AddWidget(&ProgressSpiceEnemy, (GetSize()/2) + Point(-228, 3), Point(440,12)); TextSpiceEnemy.SetTextColor(COLOR_WHITE, COLOR_BLACK); TextSpiceEnemy.SetAlignment(Alignment_HCenter); TextSpiceEnemy.SetVisible(false); WindowWidget.AddWidget(&TextSpiceEnemy, (GetSize()/2) + Point(222, -3), Point(66,21)); // unit kill statistics TextYou2.SetTextColor(COLOR_WHITE, COLOR_BLACK); TextYou2.SetAlignment(Alignment_Right); TextYou2.SetText(pTextManager->getDuneText(DuneText_You)); WindowWidget.AddWidget(&TextYou2, (GetSize()/2) + Point(-229 - TextYou2.GetSize().x, 51), TextYou2.GetSize()); ProgressUnitsYouShadow.SetColor(COLOR_BLACK); ProgressUnitsYouShadow.SetProgress(0.0); WindowWidget.AddWidget(&ProgressUnitsYouShadow, (GetSize()/2) + Point(-228 + 2, 59 + 2), Point(440,12)); ProgressUnitsYou.SetColor(houseColor[pLocalHouse->getHouseID()] + 1); ProgressUnitsYou.SetProgress(0.0); WindowWidget.AddWidget(&ProgressUnitsYou, (GetSize()/2) + Point(-228, 59), Point(440,12)); TextUnitsYou.SetTextColor(COLOR_WHITE, COLOR_BLACK); TextUnitsYou.SetAlignment(Alignment_HCenter); TextUnitsYou.SetVisible(false); WindowWidget.AddWidget(&TextUnitsYou, (GetSize()/2) + Point(222, 53), Point(66,21)); TextEnemy2.SetTextColor(COLOR_WHITE, COLOR_BLACK); TextEnemy2.SetAlignment(Alignment_Right); TextEnemy2.SetText(pTextManager->getDuneText(DuneText_Enemy)); WindowWidget.AddWidget(&TextEnemy2, (GetSize()/2) + Point(-229 - TextEnemy2.GetSize().x, 69), TextEnemy2.GetSize()); ProgressUnitsEnemyShadow.SetColor(COLOR_BLACK); ProgressUnitsEnemyShadow.SetProgress(0.0); WindowWidget.AddWidget(&ProgressUnitsEnemyShadow, (GetSize()/2) + Point(-228 + 2, 77 + 2), Point(440,12)); ProgressUnitsEnemy.SetColor(COLOR_SARDAUKAR + 1); ProgressUnitsEnemy.SetProgress(0.0); WindowWidget.AddWidget(&ProgressUnitsEnemy, (GetSize()/2) + Point(-228, 77), Point(440,12)); TextUnitsEnemy.SetTextColor(COLOR_WHITE, COLOR_BLACK); TextUnitsEnemy.SetAlignment(Alignment_HCenter); TextUnitsEnemy.SetVisible(false); WindowWidget.AddWidget(&TextUnitsEnemy, (GetSize()/2) + Point(222, 71), Point(66,21)); // buildings kill statistics TextYou3.SetTextColor(COLOR_WHITE, COLOR_BLACK); TextYou3.SetAlignment(Alignment_Right); TextYou3.SetText(pTextManager->getDuneText(DuneText_You)); WindowWidget.AddWidget(&TextYou3, (GetSize()/2) + Point(-229 - TextYou3.GetSize().x, 125), TextYou3.GetSize()); ProgressBuildingsYouShadow.SetColor(COLOR_BLACK); ProgressBuildingsYouShadow.SetProgress(0.0); WindowWidget.AddWidget(&ProgressBuildingsYouShadow, (GetSize()/2) + Point(-228 + 2, 133 + 2), Point(440,12)); ProgressBuildingsYou.SetColor(houseColor[pLocalHouse->getHouseID()] + 1); ProgressBuildingsYou.SetProgress(0.0); WindowWidget.AddWidget(&ProgressBuildingsYou, (GetSize()/2) + Point(-228, 133), Point(440,12)); TextBuildingsYou.SetTextColor(COLOR_WHITE, COLOR_BLACK); TextBuildingsYou.SetAlignment(Alignment_HCenter); TextBuildingsYou.SetVisible(false); WindowWidget.AddWidget(&TextBuildingsYou, (GetSize()/2) + Point(222, 127), Point(66,21)); TextEnemy3.SetTextColor(COLOR_WHITE, COLOR_BLACK); TextEnemy3.SetAlignment(Alignment_Right); TextEnemy3.SetText(pTextManager->getDuneText(DuneText_Enemy)); WindowWidget.AddWidget(&TextEnemy3, (GetSize()/2) + Point(-229 - TextEnemy2.GetSize().x, 143), TextEnemy3.GetSize()); ProgressBuildingsEnemyShadow.SetColor(COLOR_BLACK); ProgressBuildingsEnemyShadow.SetProgress(0.0); WindowWidget.AddWidget(&ProgressBuildingsEnemyShadow, (GetSize()/2) + Point(-228 + 2, 151 + 2), Point(440,12)); ProgressBuildingsEnemy.SetColor(COLOR_SARDAUKAR + 1); ProgressBuildingsEnemy.SetProgress(0.0); WindowWidget.AddWidget(&ProgressBuildingsEnemy, (GetSize()/2) + Point(-228, 151), Point(440,12)); TextBuildingsEnemy.SetTextColor(COLOR_WHITE, COLOR_BLACK); TextBuildingsEnemy.SetAlignment(Alignment_HCenter); TextBuildingsEnemy.SetVisible(false); WindowWidget.AddWidget(&TextBuildingsEnemy, (GetSize()/2) + Point(222, 145), Point(66,21)); }
void GLCanvas::OnMouseMove(wxMouseEvent &event) { wxSize size = GetSize(); wxPoint pos = event.GetPosition(); if (pos.x > size.x - _buttonSize && pos.y < _numButtons * _buttonSize) { wxString tooltip; int index = pos.y / _buttonSize; switch (index) { case 0: tooltip = _("Show grid"); break; case 1: tooltip = _("Show bounding box"); break; case 2: tooltip = _("Show coordinate system"); break; case 3: tooltip = _("Show joint constraints"); break; case 4: tooltip = _("Show rotation axis"); break; case 5: tooltip = _("Show label"); break; case 6: tooltip = _("Move to skeleton"); break; case 7: tooltip = _("Settings"); break; default: tooltip = _(""); break; } wxToolTip* prevToolTip = GetToolTip(); if (prevToolTip == nullptr || prevToolTip->GetTip() != tooltip) { SetToolTip(tooltip); } } else if (GetToolTip() != nullptr) { UnsetToolTip(); } if (_style & SINGLE_SENSOR_MODE) { return; } // get the delta of the mouse movement wxPoint delta = pos - _prevMousePos; _prevMousePos = pos; if (_rClicked) { _xRotation -= 0.1f * M_PI/180.0f * float(delta.y); if (_xRotation > M_PI/2.0) { _xRotation = M_PI/2.0; } else if (_xRotation < -M_PI/2.0) { _xRotation = -M_PI/2.0; } _yRotation -= 0.1f * M_PI/180.0f * float(delta.x); _cameraFront = Vector3(cos(_xRotation) * sin(_yRotation), sin(_xRotation), cos(_xRotation) * cos(_yRotation)).normalized(); _cameraUp = Vector3(sin(_yRotation - M_PI/2.0f), 0.0f, cos(_yRotation - M_PI/2.0f)).cross(_cameraFront).normalized(); _cameraRight = _cameraFront.cross(_cameraUp).normalized(); //_prevMousePos = event.GetPosition(); // wxPoint cursorPos = ClientToScreen(_prevMousePos); // WarpPointer(_prevMousePos.x, _prevMousePos.y); // SetCursorPos(cursorPos.x, cursorPos.y); Refresh(); } if (_lClicked) { _cameraPosition -= _cameraSpeed * float(delta.x) * _cameraRight; _cameraPosition += _cameraSpeed * float(delta.y) * _cameraUp; //_cameraPosition.y() += _cameraSpeed * float(delta.y); // _prevMousePos = event.GetPosition(); // warp pointer causes glcanvas to freeze (under linux). Consider not hiding the cursor // WarpPointer(_prevMousePos.x, _prevMousePos.y); Refresh(); } }
uint_t GetLoop() const { return Loop < 0 ? GetSize() : Loop; }
void MinimapWindow::OnPaint(wxPaintEvent& event) { wxBufferedPaintDC pdc(this); pdc.SetBackground(*wxBLACK_BRUSH); pdc.Clear(); if(!g_gui.IsEditorOpen()) return; Editor& editor = *g_gui.GetCurrentEditor(); int window_width = GetSize().GetWidth(); int window_height = GetSize().GetHeight(); //printf("W:%d\tH:%d\n", window_width, window_height); int center_x, center_y; MapCanvas* canvas = g_gui.GetCurrentMapTab()->GetCanvas(); canvas->GetScreenCenter(¢er_x, ¢er_y); int start_x, start_y; int end_x, end_y; start_x = center_x - window_width/2; start_y = center_y - window_height/2; end_x = center_x + window_width/2; end_y = center_y + window_height/2; if(start_x < 0) { start_x = 0; end_x = window_width; } else if(end_x > editor.map.getWidth()) { start_x = editor.map.getWidth() - window_width; end_x = editor.map.getWidth(); } if(start_y < 0) { start_y = 0; end_y = window_height; } else if(end_y > editor.map.getHeight()) { start_y = editor.map.getHeight() - window_height; end_y = editor.map.getHeight(); } start_x = max(start_x, 0); start_y = max(start_y, 0); end_x = min(end_x, editor.map.getWidth()); end_y = min(end_y, editor.map.getHeight()); last_start_x = start_x; last_start_y = start_y; int floor = g_gui.GetCurrentFloor(); //printf("Draw from %d:%d to %d:%d\n", start_x, start_y, end_x, end_y); uint8_t last = 0; if(g_gui.IsRenderingEnabled()) { for(int y = start_y, window_y = 0; y <= end_y; ++y, ++window_y) { for(int x = start_x, window_x = 0; x <= end_x; ++x, ++window_x) { Tile* tile = editor.map.getTile(x, y, floor); if(tile) { uint8_t color = tile->getMiniMapColor(); if(color) { if(last != color) { pdc.SetPen(*pens[color]); last = color; } pdc.DrawPoint(window_x, window_y); } } } } if(g_settings.getInteger(Config::MINIMAP_VIEW_BOX)) { pdc.SetPen(*wxWHITE_PEN); // Draw the rectangle on the minimap // Some view info int screensize_x, screensize_y; int view_scroll_x, view_scroll_y; canvas->GetViewBox(&view_scroll_x, &view_scroll_y, &screensize_x, &screensize_y); // bounds of the view int view_start_x, view_start_y; int view_end_x, view_end_y; int tile_size = int(TILE_SIZE / canvas->GetZoom()); // after zoom int floor_offset = (floor > GROUND_LAYER ? 0 : (GROUND_LAYER - floor)); view_start_x = view_scroll_x / TILE_SIZE + floor_offset; view_start_y = view_scroll_y / TILE_SIZE + floor_offset; view_end_x = view_start_x + screensize_x / tile_size + 1; view_end_y = view_start_y + screensize_y / tile_size + 1; for(int x = view_start_x; x <= view_end_x; ++x) { pdc.DrawPoint(x - start_x, view_start_y - start_y); pdc.DrawPoint(x - start_x, view_end_y - start_y); } for(int y = view_start_y; y < view_end_y; ++y) { pdc.DrawPoint(view_start_x - start_x, y - start_y); pdc.DrawPoint(view_end_x - start_x, y - start_y); } } } }
std::size_t GetUsedSize() const { return sizeof(RawObject) + std::min<std::size_t>(GetSize() * sizeof(Line), 256); }
wxObject *ctlColourPickerXmlHandler::DoCreateResource() { ctlColourPicker *ctl = new ctlColourPicker(m_parentAsWindow, GetID(), GetPosition(), GetSize()); SetupWindow(ctl); return ctl; }
// ---------------------------------------------------------------------------- void ThreadSearchFrame::OnClose(wxCloseEvent &event) // ---------------------------------------------------------------------------- { this->Show(false); //avoid fragmented disappearing windows // memorize current ThreadSearchFrame position ConfigManager* pCfg = Manager::Get()->GetConfigManager(_T("SnippetsSearch")); int xPos, yPos, width, height; GetPosition(&xPos,&yPos); GetSize(&width,&height); pCfg->Write(wxT("/FramePosX"), xPos ); pCfg->Write(wxT("/FramePosY"), yPos); pCfg->Write(wxT("/FrameWidth"), width); pCfg->Write(wxT("/FrameHeight"), height); //-if (GetConfig()->IsApplication()) { // we have to close all open editors or we'll crash // in wxAuiNoteBook::GetPageCount(). EditoManager call wxAuiNotebook // to close 'em, but wxAuiNotebook has alread been deleted by // wxWidgets Destory(). SEditorManager* pEdMan = GetConfig()->GetEditorManager(this); if (pEdMan) { ScbEditor* ed; int knt = pEdMan->GetEditorsCount(); for ( int i=knt; i>0; --i ) { ed = (ScbEditor*)pEdMan->GetEditor(i-1); if ( ed ) ed->Close(); } } }//if // reverse splitterwindow switches and reparenting if (m_pThreadSearch){ RemoveEventHandler(m_pThreadSearch); m_pThreadSearch->OnRelease(true); } // free separate editor manager SEditorManager* m_pEdMan = GetConfig()->GetEditorManager(this); if ( m_pEdMan ) { RemoveEventHandler( m_pEdMan ); // *do this or crash @ Destroy()* delete m_pEdMan; GetConfig()->RemoveEditorManager((wxFrame*)this); } // free ThreadSearch plugin/evtHandler if ( m_pThreadSearch ){ delete m_pThreadSearch; // deletes ThreadSearch wxEvtHandler object m_pThreadSearch = 0; } // release memory in FileLinks array used by ThreadSearch GetConfig()->ClearFileLinksMapArray(); //- write the configuation file //- Don't free Manager unless we initialized it. which we didn't. //-Manager::Free(); //-GetConfig()->GetSnippetsWindow()->CloseThreadSearchFrame(); Destroy(); }
void wxMoldeoLineCtrl::OnMouseEvent( wxMouseEvent & event ) { //wxMessageBox("wxMoldeoLineCtrl::Mouse event"); if ( event.Entering() ) { //SHINE!!! } /* if (event.LeftDown() && !m_bLeftSizeDragging) { m_bLeftSizeDragging = (-1<=event.GetX() && event.GetX()<=3); Refresh(); } if (event.LeftUp() && m_bLeftSizeDragging) { m_bLeftSizeDragging = false; Refresh(); } if (event.LeftDown() && !m_bRightSizeDragging) { m_bRightSizeDragging = ( (GetSize().GetX()-5)<event.GetX() && event.GetX()<=(GetSize().GetX()+2) ); Refresh(); } if (event.LeftUp() && m_bRightSizeDragging) { m_bRightSizeDragging = false; Refresh(); } */ if (event.LeftDown() && !m_bMovingDragging) { m_bMovingDragging = ( 3<event.GetX() && event.GetX()<=(GetSize().GetX()-3) ) && ( 3<event.GetY() && event.GetY()<=(GetSize().GetY()-3) ); Px = event.GetX(); Py = event.GetY(); Refresh(); } if (event.LeftUp() && m_bMovingDragging) { m_bMovingDragging = false; Refresh(); } /* if ((0<event.GetX() && event.GetX()<=3) || ( (GetSize().GetX()-3)<event.GetX() && event.GetX()<=(GetSize().GetX()+2) )) { // //m_bRightSizeDragging = false; //m_bLeftSizeDragging = true; this->SetCursor( wxCursor(wxCURSOR_SIZEWE) ); } else this->SetCursor( wxCursor() ); */ /* else if ( (GetSize().GetX()-3)<event.GetX() && event.GetX()<=GetSize().GetX() ) { m_bRightSizeDragging = true; m_bLeftSizeDragging = false; } else { m_bRightSizeDragging = false; m_bLeftSizeDragging = false; }*/ /*if ( m_bLeftSizeDragging || m_bRightSizeDragging ) { this->SetCursor( wxCursor(wxCURSOR_SIZEWE) ); } else this->SetCursor( wxCursor() ); */ /* if (event.Button(wxMOUSE_BTN_RIGHT )) { SetValue( SlideValue( event.GetX() ) ); Refresh(); } if (event.Button(wxMOUSE_BTN_LEFT )) { SetPlayValue( GetSlideValueToPlayValue( SlideValue( event.GetX() ) ) ); //moSetDuration( m_play_value ); //moAbstract::MODebug2->Push( IntToStr(m_play_value) ); Refresh(); }*/ if (event.Dragging()) { /*if (event.RightIsDown()) { (if (m_bStartDragging==false) { m_bStartDragging = true; wxWindow::CaptureMouse(); } SetValue( SlideValue( event.GetX() ) ); Refresh(); }*/ if (event.LeftIsDown()) { if (m_bStartDragging==false) { m_bStartDragging = true; //m_bRightSizeDragging = ( (GetSize().GetX()-3)<event.GetX() && event.GetX()<=GetSize().GetX() ); //wxWindow::CaptureMouse(); wxCommandEvent event( wxEVT_MOLDEOLINE_BEGINDRAGLEFT, m_windowId ); event.SetClientData( NULL ); event.SetEventObject( this ); GetParent()->GetParent()->AddPendingEvent( event ); } wxCommandEvent event( wxEVT_MOLDEOLINE_DRAGLEFT, m_windowId ); event.SetClientData( NULL ); event.SetEventObject( this ); GetParent()->GetParent()->AddPendingEvent( event ); wxPoint PW = GetPosition(); wxSize SW = GetSize(); /* if ( (SW.GetX()-event.GetX())>0 && m_bLeftSizeDragging) { SetSize( PW.x+event.GetX(), PW.y, SW.GetX()-event.GetX(), SW.GetY() ); } if ( event.GetX()>0 && m_bRightSizeDragging) { SetSize( PW.x, PW.y, event.GetX(), SW.GetY() ); } */ //if ( m_bMovingDragging) { //SetSize( GetParent()->ScreenToClient(wxGetMousePosition()).x-Px, GetParent()->ScreenToClient(wxGetMousePosition()).y-Py, SW.GetX(), SW.GetY() ); //} //SetPlayValue( GetSlideValueToPlayValue( SlideValue( event.GetX() ) ) ); //moSetDuration( m_play_value ); Refresh(); } } /*if (!event.Dragging()) { if (m_bStartDragging==true) { m_bStartDragging = false; wxCommandEvent event( wxEVT_MOLDEOLINE_ENDDRAGLEFT, m_windowId ); event.SetClientData( NULL ); event.SetEventObject( this ); GetParent()->GetParent()->AddPendingEvent( event ); //wxWindow::ReleaseMouse(); } }*/ event.Skip(); }
WideString CPDF_Stream::GetUnicodeText() const { auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(this); pAcc->LoadAllDataFiltered(); return PDF_DecodeText(pAcc->GetData(), pAcc->GetSize()); }
void wxMoldeoLineCtrl::OnPaint(wxPaintEvent& event) { //wxBufferedPaintDC dc(this); wxPoint PW = GetPosition(); wxSize SW = GetSize(); //sdc.StartDrawingOnTop(this); //wxBufferedPaintDC dc(this); //wxPoint Triangle[3]; //dc.Clear(); //dc.SetBrush( wxBrush( wxColour(0,255,0), wxSOLID ) ); //wxBitmap bmp(wxT(“toucan.png”), wxBITMAP_TYPE_PNG); wxBufferedPaintDC dc(this); dc.DrawBitmap(bitmap, 0, 0, true); //dc.DrawLine( ClientToScreen(PW).x, ClientToScreen(PW).y, ClientToScreen(PW).x+SW.x, ClientToScreen(PW).y+SW.y); dc.DrawLine( 0, 0, SW.x, SW.y); //sdc.EndDrawingOnTop(); //wxBufferedPaintDC bdc(this); //bdc.DrawBitmap( bitmap, wxCoord(10), wxCoord(0) ); ///background /* dc.SetPen( wxPen( wxColour(255,255,255), 0, wxTRANSPARENT ) ); dc.DrawRectangle( 0, 0, GetSize().x, GetSize().y ); dc.SetPen( wxPen( wxColour(255,255,255), 1, wxSOLID ) ); dc.DrawRectangle( GetSize().x - 4, GetSize().y/2 - 2, 4 , 4 ); */ ///gauge /* dc.SetBrush( wxBrush( wxColour(170,170,0), wxSOLID) ); dc.SetPen( wxPen( wxColour(140,140,140), 1, wxTRANSPARENT ) ); dc.DrawRectangle( 1, 1, SlidePosition()-2, GetSize().y-2 ); */ ///leftgrab /* if (m_bLeftSizeDragging) { dc.SetBrush( wxBrush( wxColour(0,255,0), wxSOLID ) ); dc.SetPen( wxPen( wxColour(255,255,255), 1, wxTRANSPARENT ) ); } else { dc.SetBrush( wxBrush( wxColour(255,255,255), wxSOLID ) ); dc.SetPen( wxPen( wxColour(255,255,255), 1, wxTRANSPARENT ) ); }*/ /* Triangle[0].x = 0; Triangle[0].y = 0; Triangle[1].x = 0; Triangle[1].y = GetSize().y; Triangle[2].x = 4; Triangle[2].y = GetSize().y/2; dc.DrawPolygon( 3, Triangle, 0, 0 ); */ ///rightgrab /* if (m_bRightSizeDragging) { dc.SetBrush( wxBrush( wxColour(0,255,0), wxSOLID ) ); dc.SetPen( wxPen( wxColour(255,255,255), 1, wxTRANSPARENT ) ); } else { dc.SetBrush( wxBrush( wxColour(255,255,255), wxSOLID ) ); dc.SetPen( wxPen( wxColour(255,255,255), 1, wxTRANSPARENT ) ); } */ /* Triangle[0].x = GetSize().x-1; Triangle[0].y = 0; Triangle[1].x = GetSize().x-1; Triangle[1].y = GetSize().y; Triangle[2].x = GetSize().x-5; Triangle[2].y = GetSize().y/2; dc.DrawPolygon( 3, Triangle, 0, 0 ); */ ///ticks /* dc.SetBrush( wxBrush( wxColour(128,128,128), wxTRANSPARENT ) ); dc.SetPen( wxPen( wxColour(255,255,255), 1, wxSOLID ) ); int nticks = 100; float dticks = ((float)GetSize().x / (float)nticks ); int ysize; for(int i =0; i<nticks; i++ ) { ( i % 10 ) == 0 ? ysize = GetSize().y - 4 : ysize = GetSize().y / 2; dc.DrawLine( i*dticks, 0, i*dticks, ysize ); } */ ///marks /* dc.SetBrush( wxBrush( wxColour(60,60,60), wxSOLID ) ); dc.SetPen( wxPen( wxColour(255,255,255), 1, wxSOLID ) ); Triangle[0].x = SlidePosition(); Triangle[0].y = GetSize().y / 3; Triangle[1].x = SlidePosition()-5; Triangle[1].y = GetSize().y; Triangle[2].x = SlidePosition()+5; Triangle[2].y = GetSize().y; dc.DrawPolygon( 3, Triangle, 0, 0 ); */ ///PLAY mark /* dc.SetBrush( wxBrush( wxColour(255,60,60), wxSOLID ) ); dc.SetPen( wxPen( wxColour(255,255,255), 2, wxSOLID ) ); Triangle[0].x = PlayValueToSlidePosition( m_play_value ); Triangle[0].y = GetSize().y / 3; Triangle[1].x = PlayValueToSlidePosition( m_play_value )-5; Triangle[1].y = GetSize().y; Triangle[2].x = PlayValueToSlidePosition( m_play_value )+5; Triangle[2].y = GetSize().y; dc.DrawPolygon( 3, Triangle, 0, 0 ); */ //wxString deb; //deb.Printf(GetName()+": %i",GetSize().GetX()); //deb = this->GetLabelText(); //dc.SetFont(wxFont( 8, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL )); //dc.DrawText(deb,4,4); /* if ( m_bMovingDragging) { wxPoint PW = GetPosition(); wxSize SW = GetSize(); //SetSize( GetParent()->ScreenToClient(wxGetMousePosition()).x-Px, GetParent()->ScreenToClient(wxGetMousePosition()).y-Py, SW.GetX(), SW.GetY() ); dc.DrawLine( ScreenToClient(wxGetMousePosition()).x, ScreenToClient(wxGetMousePosition()).y, SW.GetX()-2, SW.GetY()/2 ); } */ }
wxObject *wxChoicebookXmlHandler::DoCreateResource() { if (m_class == wxT("choicebookpage")) { wxXmlNode *n = GetParamNode(wxT("object")); if ( !n ) n = GetParamNode(wxT("object_ref")); if (n) { bool old_ins = m_isInside; m_isInside = false; wxObject *item = CreateResFromNode(n, m_choicebook, NULL); m_isInside = old_ins; wxWindow *wnd = wxDynamicCast(item, wxWindow); if (wnd) { m_choicebook->AddPage(wnd, GetText(wxT("label")), GetBool(wxT("selected"))); if ( HasParam(wxT("bitmap")) ) { wxBitmap bmp = GetBitmap(wxT("bitmap"), wxART_OTHER); wxImageList *imgList = m_choicebook->GetImageList(); if ( imgList == NULL ) { imgList = new wxImageList( bmp.GetWidth(), bmp.GetHeight() ); m_choicebook->AssignImageList( imgList ); } int imgIndex = imgList->Add(bmp); m_choicebook->SetPageImage(m_choicebook->GetPageCount()-1, imgIndex ); } else if ( HasParam(wxT("image")) ) { if ( m_choicebook->GetImageList() ) { m_choicebook->SetPageImage(m_choicebook->GetPageCount()-1, GetLong(wxT("image")) ); } else // image without image list? { ReportError(n, "image can only be used in conjunction " "with imagelist"); } } } else { ReportError(n, "choicebookpage child must be a window"); } return wnd; } else { ReportError("choicebookpage must have a window child"); return NULL; } } else { XRC_MAKE_INSTANCE(nb, wxChoicebook) nb->Create(m_parentAsWindow, GetID(), GetPosition(), GetSize(), GetStyle(wxT("style")), GetName()); wxImageList *imagelist = GetImageList(); if ( imagelist ) nb->AssignImageList(imagelist); wxChoicebook *old_par = m_choicebook; m_choicebook = nb; bool old_ins = m_isInside; m_isInside = true; CreateChildren(m_choicebook, true/*only this handler*/); m_isInside = old_ins; m_choicebook = old_par; return nb; } }
void EffectAutoDuckPanel::OnPaint(wxPaintEvent & WXUNUSED(evt)) { int clientWidth, clientHeight; GetSize(&clientWidth, &clientHeight); if (!mBackgroundBitmap || mBackgroundBitmap->GetWidth() != clientWidth || mBackgroundBitmap->GetHeight() != clientHeight) { mBackgroundBitmap = std::make_unique<wxBitmap>(clientWidth, clientHeight); } wxMemoryDC dc; dc.SelectObject(*mBackgroundBitmap); dc.SetBrush(*wxWHITE_BRUSH); dc.SetPen(*wxBLACK_PEN); dc.DrawRectangle(0, 0, clientWidth, clientHeight); dc.SetFont(wxFont(10, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL)); dc.SetTextForeground(*wxBLACK); dc.SetTextBackground(*wxWHITE); double duckAmountDb = 0; double innerFadeDownLen = 0; double innerFadeUpLen = 0; double outerFadeDownLen = 0; double outerFadeUpLen = 0; mEffect->mDuckAmountDbBox->GetValue().ToDouble(&duckAmountDb); mEffect->mInnerFadeDownLenBox->GetValue().ToDouble(&innerFadeDownLen); mEffect->mInnerFadeUpLenBox->GetValue().ToDouble(&innerFadeUpLen); mEffect->mOuterFadeDownLenBox->GetValue().ToDouble(&outerFadeDownLen); mEffect->mOuterFadeUpLenBox->GetValue().ToDouble(&outerFadeUpLen); if (innerFadeDownLen < MIN_InnerFadeDownLen || innerFadeDownLen > MAX_InnerFadeDownLen || innerFadeUpLen < MIN_InnerFadeUpLen || innerFadeUpLen > MAX_InnerFadeUpLen || outerFadeDownLen < MIN_OuterFadeDownLen || outerFadeDownLen > MAX_OuterFadeDownLen || outerFadeUpLen < MIN_OuterFadeUpLen || outerFadeUpLen > MAX_OuterFadeUpLen || duckAmountDb < MIN_DuckAmountDb || duckAmountDb > MAX_DuckAmountDb) { // values are out of range, no preview available wxString message = _("Preview not available"); int textWidth = 0, textHeight = 0; dc.GetTextExtent(message, &textWidth, &textHeight); dc.DrawText(message, (clientWidth - textWidth) / 2, (clientHeight - textHeight) / 2); ResetControlPoints(); } else { // draw preview dc.SetBrush(*wxTRANSPARENT_BRUSH); dc.SetPen(wxPen(theTheme.Colour(clrGraphLines), 3, wxSOLID)); wxPoint points[6]; points[0].x = 10; points[0].y = DUCK_AMOUNT_START; points[1].x = FADE_DOWN_START - (int)(outerFadeDownLen * FADE_SCALE); points[1].y = DUCK_AMOUNT_START; points[2].x = FADE_DOWN_START + (int)(innerFadeDownLen * FADE_SCALE); points[2].y = DUCK_AMOUNT_START - (int)(duckAmountDb * DUCK_AMOUNT_SCALE); points[3].x = FADE_UP_START - (int)(innerFadeUpLen * FADE_SCALE); points[3].y = DUCK_AMOUNT_START - (int)(duckAmountDb * DUCK_AMOUNT_SCALE); points[4].x = FADE_UP_START + (int)(outerFadeUpLen * FADE_SCALE); points[4].y = DUCK_AMOUNT_START; points[5].x = clientWidth - 10; points[5].y = DUCK_AMOUNT_START; dc.DrawLines(6, points); dc.SetPen(wxPen(*wxBLACK, 1, wxDOT)); AColor::Line(dc, FADE_DOWN_START, 10, FADE_DOWN_START, clientHeight - 10); AColor::Line(dc, FADE_UP_START, 10, FADE_UP_START, clientHeight - 10); dc.SetPen(AColor::envelopePen); dc.SetBrush(*wxWHITE_BRUSH); mControlPoints[outerFadeDown] = points[1]; mControlPoints[innerFadeDown] = points[2]; mControlPoints[innerFadeUp] = points[3]; mControlPoints[outerFadeUp] = points[4]; mControlPoints[duckAmount] = wxPoint( (points[2].x + points[3].x) / 2, points[2].y); for (int i = 0; i < AUTO_DUCK_PANEL_NUM_CONTROL_POINTS; i++) { EControlPoint cp = (EControlPoint)i; int digits; float value; if (cp == innerFadeDown) { value = innerFadeDownLen; digits = 2; } else if (cp == innerFadeUp) { value = innerFadeUpLen; digits = 2; } else if (cp == outerFadeDown) { value = outerFadeDownLen; digits = 2; } else if (cp == outerFadeUp) { value = outerFadeUpLen; digits = 2; } else { value = duckAmountDb; digits = 1; } wxString valueStr = Internat::ToDisplayString(value, digits); valueStr += wxT(" "); if (cp == duckAmount) /* i18n-hint: short form of 'decibels'.*/ valueStr += _("dB"); else /* i18n-hint: short form of 'seconds'.*/ valueStr += _("s"); int textWidth = 0, textHeight = 0; GetTextExtent(valueStr, &textWidth, &textHeight); int textPosX = mControlPoints[i].x - textWidth / 2; int textPosY = mControlPoints[i].y; if (cp == duckAmount || cp == outerFadeDown || cp == outerFadeUp) textPosY -= TEXT_DISTANCE + textHeight; else textPosY += TEXT_DISTANCE; dc.DrawText(valueStr, textPosX, textPosY); dc.DrawEllipse(mControlPoints[i].x - 3, mControlPoints[i].y - 3, 6, 6); } } // copy background buffer to paint dc wxPaintDC paintDC(this); paintDC.Blit(0, 0, clientWidth, clientHeight, &dc, 0, 0); // clean up: necessary to free resources on Windows dc.SetPen(wxNullPen); dc.SetBrush(wxNullBrush); dc.SetFont(wxNullFont); dc.SelectObject(wxNullBitmap); }
void ImageWidget::Layout() { BaseWidget::Layout(); m_sprite->SetSize(GetSize()); }
virtual void doPaint(wxDC* dc) { if (!m_imgHandle.getImg() || !m_imgHandle->IsOk()) { dc->SetTextForeground(wxColor(0,0,0)); dc->Clear(); return; } dc->SetFont(GetFont()); dc->SetTextBackground(GetBackgroundColour()); if (m_bHovering) dc->SetTextForeground(m_colHover); else if (m_bSelected) dc->SetTextForeground(m_colSelected); else dc->SetTextForeground(m_colNormal); int h = GetSize().GetHeight(); int w = GetSize().GetWidth(); int iw = m_imgHandle->GetSize().GetWidth(); wxBitmap tmpBmp(w, h); wxMemoryDC tmpDC(tmpBmp); tmpDC.SetBrush(wxBrush(wxColor(255,0,255))); tmpDC.SetPen( wxPen(wxColor(255,0,255),1) ); tmpDC.DrawRectangle(0,0,w,h); wxImage scaled = m_imgHandle->Scale(iw, h); wxBitmap left; wxBitmap right; wxBitmap centerImg = GetGCThemeManager()->getSprite(scaled, "playlist_button", "fill"); if (m_uiPos == LEFT) { left = GetGCThemeManager()->getSprite(scaled, "playlist_button", "left"); } else { left = GetGCThemeManager()->getSprite(scaled, "playlist_button", "fill"); } if (m_uiPos == RIGHT) { right = GetGCThemeManager()->getSprite(scaled, "playlist_button", "right"); } else { right = GetGCThemeManager()->getSprite(scaled, "playlist_button", "seperator"); } wxBitmap center(w-(left.GetWidth()+right.GetWidth()),h); wxColor c(255,0,255); gcImage::tileImg(center, centerImg, &c); tmpDC.DrawBitmap(left, 0,0,true); tmpDC.DrawBitmap(center, left.GetWidth(),0,true); tmpDC.DrawBitmap(right, w-right.GetWidth(),0,true); tmpDC.SelectObject(wxNullBitmap); dc->DrawBitmap(tmpBmp, 0,0, true); if (m_bTransEnabled) { wxRegion region = wxRegion(tmpBmp, wxColor(255,0,255), 1); SetShape(region, this); } wxString lab = GetLabel(); long x = (w - dc->GetTextExtent(lab).GetWidth())/2; long y = (h - dc->GetTextExtent(lab).GetHeight())/2; dc->DrawText(lab, x, y); }
unsigned GetHeight() const { return GetSize().cy; }
wxObject *CGCheckList::DoCreateResource() { if (m_class == wxT("wxCheckListBox") || m_class == wxT("wxCheckList") ) { if (m_class == wxT("wxCheckList")) wxLogDebug(wxT("'wxCheckList' name is deprecated, use 'wxCheckListBox' instead.")); // need to build the list of strings from children m_insideBox = true; CreateChildrenPrivately(NULL, GetParamNode(wxT("content"))); XRC_MAKE_INSTANCE(control, wxCheckListBox) control->Create(m_parentAsWindow, GetID(), GetPosition(), GetSize(), strList, GetStyle(), wxDefaultValidator, GetName()); // step through children myself (again.) wxXmlNode *n = GetParamNode(wxT("content")); if (n) n = n->GetChildren(); int i = 0; while (n) { if (n->GetType() != wxXML_ELEMENT_NODE || n->GetName() != wxT("item")) { n = n->GetNext(); continue; } // checking boolean is a bit ugly here (see GetBool() ) wxString v = n->GetAttribute(wxT("checked"), wxEmptyString); v.MakeLower(); if (!v.IsEmpty() && (v == wxT("1"))) control->Check( i, true ); i++; n = n->GetNext(); } SetupWindow(control); strList.Clear(); // dump the strings return control; } else { // on the inside now. // handle <item checked="boolean">Label</item> // add to the list wxString str = GetNodeContent(m_node); if (m_resource->GetFlags() & wxXRC_USE_LOCALE) str = wxGetTranslation(str, m_resource->GetDomain()); strList.Add(str); return NULL; } }
void ctlSQLResult::DisplayData(bool single) { if (!thread || !thread->DataValid()) return; if (thread->ReturnCode() != PGRES_TUPLES_OK) return; rowcountSuppressed = single; Freeze(); /* * Resize and repopulate by informing it to delete all the rows and * columns, then append the correct number of them. Probably is a * better way to do this. */ wxGridTableMessage *msg; sqlResultTable *table = (sqlResultTable *)GetTable(); msg = new wxGridTableMessage(table, wxGRIDTABLE_NOTIFY_ROWS_DELETED, 0, GetNumberRows()); ProcessTableMessage(*msg); delete msg; msg = new wxGridTableMessage(table, wxGRIDTABLE_NOTIFY_COLS_DELETED, 0, GetNumberCols()); ProcessTableMessage(*msg); delete msg; msg = new wxGridTableMessage(table, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, NumRows()); ProcessTableMessage(*msg); delete msg; msg = new wxGridTableMessage(table, wxGRIDTABLE_NOTIFY_COLS_APPENDED, thread->DataSet()->NumCols()); ProcessTableMessage(*msg); delete msg; if (single) { int w, h; if (colSizes.GetCount() == 1) w = colSizes.Item(0); else GetSize(&w, &h); colNames.Add(thread->DataSet()->ColName(0)); colTypes.Add(wxT("")); colTypClasses.Add(0L); SetColSize(0, w); } else { wxString colName, colType; int w; size_t hdrIndex = 0; long col, nCols = thread->DataSet()->NumCols(); for (col = 0 ; col < nCols ; col++) { colName = thread->DataSet()->ColName(col); colType = thread->DataSet()->ColFullType(col); colNames.Add(colName); colTypes.Add(colType); colTypClasses.Add(thread->DataSet()->ColTypClass(col)); wxString colHeader = colName + wxT("\n") + colType; if (hdrIndex < colHeaders.GetCount() && colHeaders.Item(hdrIndex) == colHeader) w = colSizes.Item(hdrIndex++); else w = -1; SetColSize(col, w); } } Thaw(); }
void GLCanvas::drawUserInterface(wxDC &dc) const { wxSize size = GetSize(); wxPoint pos(0, 0); pos.x = size.x - _buttonSize; wxSize buttonSize(_buttonSize, _buttonSize); wxPen whitePen(wxColour(255, 255, 255)); whitePen.SetWidth(1); wxPen blackPen(wxColour(0, 0, 0)); blackPen.SetWidth(1); wxPen greenPen(wxColour(0, 255, 0)); wxBrush brush; dc.SetPen(blackPen); brush.SetColour(wxColour(0, 0, 0)); dc.SetBrush(brush); // draw black background behind all buttons dc.DrawRectangle(pos.x - 1, pos.y, _buttonSize + 1, _numButtons * _buttonSize + 1); // draw grit if (_style & DRAW_GRID) { dc.SetPen(greenPen); } else { dc.SetPen(whitePen); } dc.DrawRectangle(pos.x + 1, pos.y + 1, _buttonSize - 2, _buttonSize - 2); dc.DrawLine(pos.x + _buttonSizeHalf, pos.y + 1, pos.x + _buttonSizeHalf, pos.y + _buttonSize - 1); dc.DrawLine(pos.x + 1, pos.y + _buttonSizeHalf, size.x - 1, pos.y + _buttonSizeHalf); pos.y += _buttonSize; // draw a cube for showing AABB if (_style & DRAW_AABB) { dc.SetPen(greenPen); } else { dc.SetPen(whitePen); } dc.DrawRectangle(pos.x + _buttonSizeHalf - 3, pos.y + 3, _buttonSizeHalf, _buttonSizeHalf); dc.DrawRectangle(pos.x + 2, pos.y + _buttonSizeHalf - 2, _buttonSizeHalf, _buttonSizeHalf); dc.DrawLine(pos.x + 2, pos.y + _buttonSizeHalf - 2, pos.x + _buttonSizeHalf - 3, pos.y + 3); dc.DrawLine(pos.x + 2 + _buttonSizeHalf, pos.y + _buttonSizeHalf - 2, pos.x + _buttonSize - 3, pos.y + 3); dc.DrawLine(pos.x + 2 + _buttonSizeHalf, pos.y + _buttonSize - 3, pos.x + _buttonSize - 3, pos.y + _buttonSizeHalf + 2); pos.y += _buttonSize; // draw coordinate system if (_style & DRAW_LOCAL_COORDINATE_SYSTEM) { dc.SetPen(greenPen); } else { dc.SetPen(whitePen); } dc.DrawLine(pos.x + 2, pos.y + 3, pos.x + 2, pos.y + _buttonSize - 2); dc.DrawLine(pos.x + 2, pos.y + _buttonSize - 2, size.x - 3, pos.y + _buttonSize - 2); dc.DrawLine(pos.x + 2, pos.y + _buttonSize - 2, pos.x + _buttonSize - 6, pos.y + _buttonSizeHalf + 2); pos.y += _buttonSize; // draw joint constraints if (_style & DRAW_JOINT_CONSTRAINTS) { dc.SetPen(greenPen); } else { dc.SetPen(whitePen); } //dc.DrawCircle(pos.x + _buttonSizeHalf, pos.y + _buttonSizeHalf, _buttonSizeHalf - 3); //dc.DrawArc(pos.x + 4, pos.y + 5, pos.x + 4, pos.y + _buttonSize - 5, pos.x + _buttonSizeHalf + 2, pos.y + _buttonSizeHalf); //dc.DrawCircle(pos.x + 6, pos.y + _buttonSizeHalf, 3); dc.DrawEllipse(pos.x + 4, pos.y + 3, _buttonSizeHalf - 5, _buttonSizeHalf + 4); dc.DrawLine(pos.x + 8, pos.y + 3, pos.x + _buttonSizeHalf + 5, pos.y + _buttonSizeHalf); dc.DrawLine(pos.x + 8, pos.y + _buttonSizeHalf + 7, pos.x + _buttonSizeHalf + 5, pos.y + _buttonSizeHalf); pos.y += _buttonSize; // draw rotation axis if (_style & DRAW_ROTATION_AXIS) { dc.SetPen(greenPen); } else { dc.SetPen(whitePen); } dc.DrawArc(pos.x + _buttonSizeHalf + 2, pos.y + _buttonSize - 2, pos.x + _buttonSizeHalf, pos.y + _buttonSizeHalf + 1, pos.x + 2, pos.y + _buttonSize - 2); //dc.DrawEllipse(pos.x + 6, pos.y + 5, _buttonSize - 12, _buttonSize - 10); //dc.DrawCircle(pos.x + _buttonSizeHalf + 2, pos.y + _buttonSizeHalf - 2, 3); dc.DrawLine(pos.x + 2, pos.y + _buttonSize - 2, pos.x + _buttonSize - 2, pos.y + 2); dc.DrawLine(pos.x + 2, pos.y + _buttonSize - 2, pos.x + _buttonSize - 2, pos.y + _buttonSize - 2); pos.y += _buttonSize; // draw label if (_style & DRAW_LABEL) { dc.SetPen(greenPen); } else { dc.SetPen(whitePen); } dc.DrawRoundedRectangle(pos.x + 4, pos.y + 3, _buttonSize - 5, _buttonSizeHalf, 3.0); dc.DrawSpline(pos.x + 4, pos.y + _buttonSizeHalf - 3, pos.x + 1, pos.y + _buttonSizeHalf + 4, pos.x + _buttonSizeHalf + 4, pos.y + _buttonSizeHalf + 6); pos.y += _buttonSize; // draw locate skeleton button dc.SetPen(whitePen); dc.DrawLine(pos.x + _buttonSizeHalf, pos.y + 2, pos.x + _buttonSizeHalf, pos.y + _buttonSize - 1); dc.DrawLine(pos.x + 2, pos.y + _buttonSizeHalf, size.x - 1, pos.y + _buttonSizeHalf); dc.DrawCircle(pos.x + _buttonSizeHalf, pos.y + _buttonSizeHalf, _buttonSizeHalf - 4); brush.SetColour(wxColour(255, 255, 255)); dc.SetBrush(brush); dc.DrawCircle(pos.x + _buttonSizeHalf, pos.y + _buttonSizeHalf, _buttonSizeHalf - 8); pos.y += _buttonSize; // draw settings button dc.DrawCircle(pos.x + _buttonSizeHalf, pos.y + _buttonSizeHalf, _buttonSizeHalf - 3); dc.SetPen(blackPen); brush.SetColour(wxColour(0, 0, 0)); dc.SetBrush(brush); dc.DrawCircle(pos.x + _buttonSizeHalf + 6, pos.y + _buttonSizeHalf, 2); dc.DrawCircle(pos.x + _buttonSizeHalf - 6, pos.y + _buttonSizeHalf, 2); dc.DrawCircle(pos.x + _buttonSizeHalf, pos.y + _buttonSizeHalf + 6, 2); dc.DrawCircle(pos.x + _buttonSizeHalf, pos.y + _buttonSizeHalf - 6, 2); dc.SetPen(whitePen); dc.DrawCircle(pos.x + _buttonSizeHalf, pos.y + _buttonSizeHalf, _buttonSizeHalf - 7); }