Merge branch 'use-std-containers'
Remove avoidable uses of legacy container classes by replacing them with the standard containers. See #23440.
This commit is contained in:
commit
7824391f64
126 changed files with 959 additions and 1222 deletions
|
|
@ -100,6 +100,14 @@ Changes in behaviour which may result in build errors
|
|||
- wxMotif and wxGTK1 ports have been removed, please use wxWidgets 3.2 if you
|
||||
still need them.
|
||||
|
||||
- Several private container classes that never made part of wxWidgets public
|
||||
API have been removed. If you used any of them (e.g. wxSimpleDataObjectList)
|
||||
in your code, please switch to using std::vector<> or std::list<> instead.
|
||||
Some other legacy "object array" classes (e.g. wxImageArray) still exist, but
|
||||
are now similar to std::vector<> containing the objects -- they remain mostly
|
||||
compatible with the previous wxWidgets versions, but now compare values, and
|
||||
not pointers, in their Index() member function.
|
||||
|
||||
- Generic wxSearchCtrl doesn't provide methods that make sense only for
|
||||
multiline text controls any longer, for consistency with the other ports.
|
||||
|
||||
|
|
|
|||
|
|
@ -21,8 +21,12 @@
|
|||
|
||||
class /*WXDLLIMPEXP_CORE*/ wxANIFrameInfo; // private implementation detail
|
||||
|
||||
WX_DECLARE_EXPORTED_OBJARRAY(wxANIFrameInfo, wxANIFrameInfoArray);
|
||||
WX_DECLARE_EXPORTED_OBJARRAY(wxImage, wxImageArray);
|
||||
// For compatibility purposes, provide wxImageArray class mimicking the legacy
|
||||
// dynamic array which used to be required by wxGIFHandler::SaveAnimation():
|
||||
// now we just take a vector of images there, but we want to keep the existing
|
||||
// code using wxImageArray working (and keep it declared here because this is
|
||||
// where it used to be, even if this doesn't make much sense).
|
||||
using wxImageArray = wxBaseArray<wxImage>;
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// wxANIDecoder class
|
||||
|
|
@ -62,11 +66,11 @@ private:
|
|||
// frames stored as wxImage(s): ANI files are meant to be used mostly for animated
|
||||
// cursors and thus they do not use any optimization to encode differences between
|
||||
// two frames: they are just a list of images to display sequentially.
|
||||
wxImageArray m_images;
|
||||
std::vector<wxImage> m_images;
|
||||
|
||||
// the info about each image stored in m_images.
|
||||
// NB: m_info.GetCount() may differ from m_images.GetCount()!
|
||||
wxANIFrameInfoArray m_info;
|
||||
std::vector<wxANIFrameInfo> m_info;
|
||||
|
||||
// this is the wxCURHandler used to load the ICON chunk of the ANI files
|
||||
static wxCURHandler sm_handler;
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
#include "wx/iconbndl.h"
|
||||
#include "wx/bmpbndl.h"
|
||||
|
||||
class WXDLLIMPEXP_FWD_CORE wxArtProvidersList;
|
||||
class WXDLLIMPEXP_FWD_CORE wxArtProviderCache;
|
||||
class wxArtProvidersList;
|
||||
class wxArtProviderCache;
|
||||
class WXDLLIMPEXP_FWD_CORE wxWindow;
|
||||
|
||||
class wxArtProviderModule;
|
||||
|
|
|
|||
|
|
@ -254,9 +254,7 @@ private:
|
|||
int m_alignment; // sizer alignment flag, defaults to wxCENTER, may be wxEXPAND or any other
|
||||
};
|
||||
|
||||
#ifndef SWIG
|
||||
WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiToolBarItem, wxAuiToolBarItemArray, WXDLLIMPEXP_AUI);
|
||||
#endif
|
||||
using wxAuiToolBarItemArray = wxBaseArray<wxAuiToolBarItem>;
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -109,10 +109,19 @@ public:
|
|||
};
|
||||
|
||||
|
||||
#ifndef SWIG
|
||||
WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiNotebookPage, wxAuiNotebookPageArray, WXDLLIMPEXP_AUI);
|
||||
WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiTabContainerButton, wxAuiTabContainerButtonArray, WXDLLIMPEXP_AUI);
|
||||
#endif
|
||||
// These legacy classes can't be just typedefs as they can be (and are)
|
||||
// forward-declared in the existing code.
|
||||
class wxAuiNotebookPageArray : public wxBaseArray<wxAuiNotebookPage>
|
||||
{
|
||||
public:
|
||||
using wxBaseArray<wxAuiNotebookPage>::wxBaseArray;
|
||||
};
|
||||
|
||||
class wxAuiTabContainerButtonArray : public wxBaseArray<wxAuiTabContainerButton>
|
||||
{
|
||||
public:
|
||||
using wxBaseArray<wxAuiTabContainerButton>::wxBaseArray;
|
||||
};
|
||||
|
||||
|
||||
class WXDLLIMPEXP_AUI wxAuiTabContainer
|
||||
|
|
|
|||
|
|
@ -128,13 +128,11 @@ class wxAuiDockInfo;
|
|||
class wxAuiDockArt;
|
||||
class wxAuiManagerEvent;
|
||||
|
||||
#ifndef SWIG
|
||||
WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiDockInfo, wxAuiDockInfoArray, WXDLLIMPEXP_AUI);
|
||||
WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiDockUIPart, wxAuiDockUIPartArray, WXDLLIMPEXP_AUI);
|
||||
WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiPaneInfo, wxAuiPaneInfoArray, WXDLLIMPEXP_AUI);
|
||||
WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxAuiPaneInfo*, wxAuiPaneInfoPtrArray, class WXDLLIMPEXP_AUI);
|
||||
WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxAuiDockInfo*, wxAuiDockInfoPtrArray, class WXDLLIMPEXP_AUI);
|
||||
#endif // SWIG
|
||||
using wxAuiDockUIPartArray = wxBaseArray<wxAuiDockUIPart>;
|
||||
using wxAuiDockInfoArray = wxBaseArray<wxAuiDockInfo>;
|
||||
using wxAuiPaneInfoArray = wxBaseArray<wxAuiPaneInfo>;
|
||||
using wxAuiDockInfoPtrArray = wxBaseArray<wxAuiDockInfo*>;
|
||||
using wxAuiPaneInfoPtrArray = wxBaseArray<wxAuiPaneInfo*>;
|
||||
|
||||
extern WXDLLIMPEXP_AUI wxAuiDockInfo wxAuiNullDockInfo;
|
||||
extern WXDLLIMPEXP_AUI wxAuiPaneInfo wxAuiNullPaneInfo;
|
||||
|
|
@ -615,6 +613,11 @@ protected:
|
|||
|
||||
void* m_reserved;
|
||||
|
||||
private:
|
||||
// Return the index in m_uiParts corresponding to the current value of
|
||||
// m_actionPart. If m_actionPart is null, returns wxNOT_FOUND.
|
||||
int GetActionPartIndex() const;
|
||||
|
||||
#ifndef SWIG
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
wxDECLARE_CLASS(wxAuiManager);
|
||||
|
|
|
|||
|
|
@ -20,9 +20,11 @@
|
|||
|
||||
#include "wx/string.h"
|
||||
#include "wx/bitmap.h"
|
||||
#include "wx/list.h"
|
||||
#include "wx/arrstr.h"
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
// ============================================================================
|
||||
/*
|
||||
Generic data transfer related classes. The class hierarchy is as follows:
|
||||
|
|
@ -248,8 +250,6 @@ private:
|
|||
// wxDataObject directly.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WX_DECLARE_EXPORTED_LIST(wxDataObjectSimple, wxSimpleDataObjectList);
|
||||
|
||||
class WXDLLIMPEXP_CORE wxDataObjectComposite : public wxDataObject
|
||||
{
|
||||
public:
|
||||
|
|
@ -291,8 +291,8 @@ public:
|
|||
#endif
|
||||
|
||||
private:
|
||||
// the list of all (simple) data objects whose formats we support
|
||||
wxSimpleDataObjectList m_dataObjects;
|
||||
// all (simple) data objects whose formats we support
|
||||
std::vector<std::unique_ptr<wxDataObjectSimple>> m_dataObjects;
|
||||
|
||||
// the index of the preferred one (0 initially, so by default the first
|
||||
// one is the preferred)
|
||||
|
|
|
|||
|
|
@ -1525,7 +1525,7 @@ private:
|
|||
// wxDateTimeArray: array of dates.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WX_DECLARE_USER_EXPORTED_OBJARRAY(wxDateTime, wxDateTimeArray, WXDLLIMPEXP_BASE);
|
||||
using wxDateTimeArray = wxBaseArray<wxDateTime>;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxDateTimeHolidayAuthority: an object of this class will decide whether a
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#include "wx/dynarray.h"
|
||||
#include "wx/vidmode.h"
|
||||
|
||||
WX_DECLARE_EXPORTED_OBJARRAY(wxVideoMode, wxArrayVideoModes);
|
||||
using wxArrayVideoModes = wxBaseArray<wxVideoMode>;
|
||||
|
||||
// default, uninitialized, video mode object
|
||||
extern WXDLLIMPEXP_DATA_CORE(const wxVideoMode) wxDefaultVideoMode;
|
||||
|
|
|
|||
|
|
@ -15,8 +15,6 @@
|
|||
|
||||
#if wxUSE_DOC_VIEW_ARCHITECTURE
|
||||
|
||||
#include "wx/list.h"
|
||||
#include "wx/dlist.h"
|
||||
#include "wx/string.h"
|
||||
#include "wx/frame.h"
|
||||
#include "wx/filehistory.h"
|
||||
|
|
@ -26,6 +24,8 @@
|
|||
#include "wx/print.h"
|
||||
#endif
|
||||
|
||||
#include <list>
|
||||
|
||||
class WXDLLIMPEXP_FWD_CORE wxWindow;
|
||||
class WXDLLIMPEXP_FWD_CORE wxDocument;
|
||||
class WXDLLIMPEXP_FWD_CORE wxView;
|
||||
|
|
@ -218,8 +218,7 @@ protected:
|
|||
|
||||
private:
|
||||
// list of all documents whose m_documentParent is this one
|
||||
typedef wxDList<wxDocument> DocsList;
|
||||
DocsList m_childDocuments;
|
||||
std::list<wxDocument*> m_childDocuments;
|
||||
|
||||
wxDECLARE_ABSTRACT_CLASS(wxDocument);
|
||||
wxDECLARE_NO_COPY_CLASS(wxDocument);
|
||||
|
|
|
|||
|
|
@ -202,9 +202,7 @@ private:
|
|||
friend class wxDynamicLibraryDetailsCreator;
|
||||
};
|
||||
|
||||
WX_DECLARE_USER_EXPORTED_OBJARRAY(wxDynamicLibraryDetails,
|
||||
wxDynamicLibraryDetailsArray,
|
||||
WXDLLIMPEXP_BASE);
|
||||
using wxDynamicLibraryDetailsArray = wxBaseArray<wxDynamicLibraryDetails>;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxDynamicLibrary: represents a handle to a DLL/shared object
|
||||
|
|
|
|||
|
|
@ -21,14 +21,14 @@
|
|||
#if wxUSE_DYNAMIC_LOADER
|
||||
|
||||
#include "wx/dynlib.h"
|
||||
#include "wx/hashmap.h"
|
||||
#include "wx/module.h"
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
class WXDLLIMPEXP_FWD_BASE wxPluginLibrary;
|
||||
|
||||
using wxDLManifest = std::unordered_map<wxString, wxPluginLibrary*>;
|
||||
|
||||
WX_DECLARE_STRING_HASH_MAP_WITH_DECL(wxPluginLibrary *, wxDLManifest,
|
||||
class WXDLLIMPEXP_BASE);
|
||||
typedef wxDLManifest wxDLImports;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
|
@ -128,7 +128,7 @@ public:
|
|||
return m_entry->GetSymbol( symbol, success );
|
||||
}
|
||||
|
||||
static void CreateManifest() { ms_manifest = new wxDLManifest(wxKEY_STRING); }
|
||||
static void CreateManifest() { ms_manifest = new wxDLManifest(); }
|
||||
static void ClearManifest() { delete ms_manifest; ms_manifest = nullptr; }
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -15,11 +15,11 @@
|
|||
|
||||
#if wxUSE_GRID
|
||||
|
||||
#include "wx/hashmap.h"
|
||||
|
||||
#include "wx/scrolwin.h"
|
||||
|
||||
#include <iterator>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
|
|
@ -113,7 +113,7 @@ class WXDLLIMPEXP_FWD_CORE wxSpinCtrl;
|
|||
class WXDLLIMPEXP_FWD_CORE wxDatePickerCtrl;
|
||||
#endif
|
||||
|
||||
class wxGridFixedIndicesSet;
|
||||
using wxGridFixedIndicesSet = std::unordered_set<int>;
|
||||
|
||||
class wxGridOperations;
|
||||
class wxGridRowOperations;
|
||||
|
|
@ -1191,10 +1191,13 @@ extern WXDLLIMPEXP_CORE wxGridCellCoords wxGridNoCellCoords;
|
|||
extern WXDLLIMPEXP_CORE wxGridBlockCoords wxGridNoBlockCoords;
|
||||
extern WXDLLIMPEXP_CORE wxRect wxGridNoCellRect;
|
||||
|
||||
// An array of cell coords...
|
||||
//
|
||||
WX_DECLARE_OBJARRAY_WITH_DECL(wxGridCellCoords, wxGridCellCoordsArray,
|
||||
class WXDLLIMPEXP_CORE);
|
||||
// Define a vector used for passing cell coordinates to the grid.
|
||||
using wxGridCellCoordsVector = std::vector<wxGridCellCoords>;
|
||||
|
||||
// Legacy array of cell coordinates that we still return from wxGrid functions
|
||||
// for compatibility. As it inherits from wxGridCellCoordsVector, it can also
|
||||
// be passed to the functions taking cell coordinates on input.
|
||||
using wxGridCellCoordsArray = wxBaseArray<wxGridCellCoords>;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Grid table classes
|
||||
|
|
@ -1376,10 +1379,10 @@ private:
|
|||
// ------ wxGridStringArray
|
||||
// A 2-dimensional array of strings for data values
|
||||
//
|
||||
|
||||
WX_DECLARE_OBJARRAY_WITH_DECL(wxArrayString, wxGridStringArray,
|
||||
class WXDLLIMPEXP_CORE);
|
||||
|
||||
// This is defined for compatibility only: even if it was never part of wx API,
|
||||
// it is still used outside of it, even if it's not used by wxGridStringTable
|
||||
// itself any longer.
|
||||
using wxGridStringArray = wxBaseArray<wxArrayString>;
|
||||
|
||||
|
||||
// ------ wxGridStringTable
|
||||
|
|
@ -1419,7 +1422,10 @@ public:
|
|||
wxString GetCornerLabelValue() const override;
|
||||
|
||||
private:
|
||||
wxGridStringArray m_data;
|
||||
// This used to be a wxGridStringArray, but we don't really need it, just a
|
||||
// vector of vectors, storing columns data for each row, is enough.
|
||||
using ColData = std::vector<wxString>;
|
||||
std::vector<ColData> m_data;
|
||||
|
||||
// notice that while we don't need to store the number of our rows as it's
|
||||
// always equal to the size of m_data array, we do need to store the number
|
||||
|
|
@ -1453,8 +1459,7 @@ private:
|
|||
// ----------------------------------------------------------------------------
|
||||
|
||||
// hash map to store positions as the keys and sizes as the values
|
||||
WX_DECLARE_HASH_MAP_WITH_DECL( unsigned, int, wxIntegerHash, wxIntegerEqual,
|
||||
wxUnsignedToIntHashMap, class WXDLLIMPEXP_CORE );
|
||||
using wxUnsignedToIntHashMap = std::unordered_map<unsigned, int>;
|
||||
|
||||
struct WXDLLIMPEXP_CORE wxGridSizesInfo
|
||||
{
|
||||
|
|
@ -1618,13 +1623,13 @@ public:
|
|||
|
||||
bool IsFrozen() const;
|
||||
|
||||
void DrawGridCellArea( wxDC& dc , const wxGridCellCoordsArray& cells );
|
||||
void DrawGridCellArea( wxDC& dc , const wxGridCellCoordsVector& cells );
|
||||
void DrawGridSpace( wxDC& dc, wxGridWindow *gridWindow );
|
||||
void DrawCellBorder( wxDC& dc, const wxGridCellCoords& );
|
||||
void DrawAllGridLines();
|
||||
void DrawAllGridWindowLines( wxDC& dc, const wxRegion & reg , wxGridWindow *gridWindow);
|
||||
void DrawCell( wxDC& dc, const wxGridCellCoords& );
|
||||
void DrawHighlight(wxDC& dc, const wxGridCellCoordsArray& cells);
|
||||
void DrawHighlight(wxDC& dc, const wxGridCellCoordsVector& cells);
|
||||
void DrawFrozenBorder( wxDC& dc, wxGridWindow *gridWindow );
|
||||
void DrawLabelFrozenBorder( wxDC& dc, wxWindow *window, bool isRow );
|
||||
|
||||
|
|
@ -2541,8 +2546,8 @@ protected:
|
|||
|
||||
// if a column has a minimal width, it will be the value for it in this
|
||||
// hash table
|
||||
wxLongToLongHashMap m_colMinWidths,
|
||||
m_rowMinHeights;
|
||||
std::unordered_map<int, int> m_colMinWidths,
|
||||
m_rowMinHeights;
|
||||
|
||||
// get the minimal width of the given column/row
|
||||
int GetColMinimalWidth(int col) const;
|
||||
|
|
@ -2976,7 +2981,7 @@ private:
|
|||
void GetRenderSizes( const wxGridCellCoords& topLeft,
|
||||
const wxGridCellCoords& bottomRight,
|
||||
wxPoint& pointOffSet, wxSize& sizeGrid,
|
||||
wxGridCellCoordsArray& renderCells,
|
||||
wxGridCellCoordsVector& renderCells,
|
||||
wxArrayInt& arrayCols, wxArrayInt& arrayRows ) const;
|
||||
|
||||
// Helper of Render(): set the scale to draw the cells at the right size.
|
||||
|
|
|
|||
|
|
@ -9,7 +9,8 @@
|
|||
#ifndef _WX_GTKDATAVIEWCTRL_H_
|
||||
#define _WX_GTKDATAVIEWCTRL_H_
|
||||
|
||||
#include "wx/list.h"
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
class WXDLLIMPEXP_FWD_CORE wxDataViewCtrlInternal;
|
||||
|
||||
|
|
@ -93,9 +94,6 @@ private:
|
|||
void Init(wxAlignment align, int flags, int width);
|
||||
};
|
||||
|
||||
WX_DECLARE_LIST_WITH_DECL(wxDataViewColumn, wxDataViewColumnList,
|
||||
class WXDLLIMPEXP_CORE);
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// wxDataViewCtrl
|
||||
// ---------------------------------------------------------
|
||||
|
|
@ -235,7 +233,10 @@ private:
|
|||
|
||||
GtkWidget *m_treeview;
|
||||
wxDataViewCtrlInternal *m_internal;
|
||||
wxDataViewColumnList m_cols;
|
||||
|
||||
using wxDataViewColumnPtr = std::unique_ptr<wxDataViewColumn>;
|
||||
std::vector<wxDataViewColumnPtr> m_cols;
|
||||
|
||||
wxDataViewItem m_ensureVisibleDefered;
|
||||
|
||||
// By default this is set to -1 and the height of the rows is determined by
|
||||
|
|
|
|||
|
|
@ -10,14 +10,13 @@
|
|||
#ifndef _WX_GTKNOTEBOOK_H_
|
||||
#define _WX_GTKNOTEBOOK_H_
|
||||
|
||||
#include <vector>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// internal class
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_FWD_CORE wxGtkNotebookPage;
|
||||
|
||||
#include "wx/list.h"
|
||||
WX_DECLARE_LIST(wxGtkNotebookPage, wxGtkNotebookPagesList);
|
||||
class wxGtkNotebookPage;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxNotebook
|
||||
|
|
@ -112,9 +111,6 @@ public:
|
|||
// helper function
|
||||
wxGtkNotebookPage* GetNotebookPage(int page) const;
|
||||
|
||||
// the additional page data (the pages themselves are in m_pages array)
|
||||
wxGtkNotebookPagesList m_pagesData;
|
||||
|
||||
// we need to store the old selection since there
|
||||
// is no other way to know about it at the time
|
||||
// of the change selection event
|
||||
|
|
@ -134,6 +130,9 @@ private:
|
|||
// the padding set by SetPadding()
|
||||
int m_padding;
|
||||
|
||||
// the additional page data (the pages themselves are in m_pages array)
|
||||
std::vector<wxGtkNotebookPage> m_pagesData;
|
||||
|
||||
void Init();
|
||||
virtual void AddChildGTK(wxWindowGTK* child) override;
|
||||
|
||||
|
|
|
|||
|
|
@ -11,12 +11,9 @@
|
|||
|
||||
#include "wx/bitmap.h"
|
||||
|
||||
class WXDLLIMPEXP_FWD_CORE wxGTKRadioButtonInfo;
|
||||
|
||||
#include "wx/list.h"
|
||||
|
||||
WX_DECLARE_EXPORTED_LIST(wxGTKRadioButtonInfo, wxRadioBoxButtonsInfoList);
|
||||
#include <vector>
|
||||
|
||||
class wxGTKRadioButtonInfo;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxRadioBox
|
||||
|
|
@ -27,7 +24,7 @@ class WXDLLIMPEXP_CORE wxRadioBox : public wxControl,
|
|||
{
|
||||
public:
|
||||
// ctors and dtor
|
||||
wxRadioBox() { }
|
||||
wxRadioBox();
|
||||
wxRadioBox(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
|
|
@ -38,10 +35,7 @@ public:
|
|||
int majorDim = 0,
|
||||
long style = wxRA_SPECIFY_COLS,
|
||||
const wxValidator& val = wxDefaultValidator,
|
||||
const wxString& name = wxASCII_STR(wxRadioBoxNameStr))
|
||||
{
|
||||
Create( parent, id, title, pos, size, n, choices, majorDim, style, val, name );
|
||||
}
|
||||
const wxString& name = wxASCII_STR(wxRadioBoxNameStr));
|
||||
|
||||
wxRadioBox(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
|
|
@ -52,10 +46,7 @@ public:
|
|||
int majorDim = 0,
|
||||
long style = wxRA_SPECIFY_COLS,
|
||||
const wxValidator& val = wxDefaultValidator,
|
||||
const wxString& name = wxASCII_STR(wxRadioBoxNameStr))
|
||||
{
|
||||
Create( parent, id, title, pos, size, choices, majorDim, style, val, name );
|
||||
}
|
||||
const wxString& name = wxASCII_STR(wxRadioBoxNameStr));
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
|
|
@ -129,7 +120,7 @@ public:
|
|||
virtual void GTKApplyToolTip(const char* tip) override;
|
||||
#endif // wxUSE_TOOLTIPS
|
||||
|
||||
wxRadioBoxButtonsInfoList m_buttonsInfo;
|
||||
std::vector<wxGTKRadioButtonInfo> m_buttonsInfo;
|
||||
|
||||
protected:
|
||||
virtual wxBorder GetDefaultBorder() const override { return wxBORDER_NONE; }
|
||||
|
|
|
|||
|
|
@ -19,7 +19,9 @@
|
|||
|
||||
class WXDLLIMPEXP_FWD_BASE wxInputStream;
|
||||
|
||||
WX_DECLARE_EXPORTED_OBJARRAY(wxIcon, wxIconArray);
|
||||
// This declaration is preserved solely for backwards compatibility, this type
|
||||
// is not used by wxWidgets itself.
|
||||
using wxIconArray = wxBaseArray<wxIcon>;
|
||||
|
||||
// Load icons of multiple sizes from files or resources (MSW-only).
|
||||
class WXDLLIMPEXP_CORE wxIconBundle : public wxGDIObject
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
#include "wx/image.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxGIFHandler
|
||||
|
|
@ -26,7 +28,6 @@
|
|||
|
||||
struct wxRGB;
|
||||
struct GifHashTableType;
|
||||
class WXDLLIMPEXP_FWD_CORE wxImageArray; // anidecod.h
|
||||
|
||||
class WXDLLIMPEXP_CORE wxGIFHandler : public wxImageHandler
|
||||
{
|
||||
|
|
@ -47,7 +48,7 @@ public:
|
|||
bool verbose=true) override;
|
||||
|
||||
// Save animated gif
|
||||
bool SaveAnimation(const wxImageArray& images, wxOutputStream *stream,
|
||||
bool SaveAnimation(const std::vector<wxImage>& images, wxOutputStream *stream,
|
||||
bool verbose = true, int delayMilliSecs = 1000);
|
||||
|
||||
protected:
|
||||
|
|
|
|||
|
|
@ -225,8 +225,9 @@ private:
|
|||
#endif // 0
|
||||
};
|
||||
|
||||
WX_DECLARE_USER_EXPORTED_OBJARRAY(wxFileTypeInfo, wxArrayFileTypeInfo,
|
||||
WXDLLIMPEXP_BASE);
|
||||
// This declaration is preserved solely for backwards compatibility, this type
|
||||
// is not used by wxWidgets itself.
|
||||
using wxArrayFileTypeInfo = wxBaseArray<wxFileTypeInfo>;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxFileType: gives access to all information about the files of given type.
|
||||
|
|
@ -428,7 +429,7 @@ public:
|
|||
// The filetypes array should be terminated by either null entry or an
|
||||
// invalid wxFileTypeInfo (i.e. the one created with default ctor)
|
||||
void AddFallbacks(const wxFileTypeInfo *filetypes);
|
||||
void AddFallback(const wxFileTypeInfo& ft) { m_fallbacks.Add(ft); }
|
||||
void AddFallback(const wxFileTypeInfo& ft) { m_fallbacks.push_back(ft); }
|
||||
|
||||
// create or remove associations
|
||||
|
||||
|
|
@ -450,7 +451,7 @@ private:
|
|||
|
||||
// the fallback info which is used if the information is not found in the
|
||||
// real system database
|
||||
wxArrayFileTypeInfo m_fallbacks;
|
||||
std::vector<wxFileTypeInfo> m_fallbacks;
|
||||
|
||||
// the object working with the system MIME database
|
||||
wxMimeTypesManagerImpl *m_impl;
|
||||
|
|
|
|||
|
|
@ -11,8 +11,6 @@
|
|||
#ifndef _WX_MSW_EVTLOOP_H_
|
||||
#define _WX_MSW_EVTLOOP_H_
|
||||
|
||||
#include "wx/dynarray.h"
|
||||
#include "wx/msw/wrapwin.h"
|
||||
#include "wx/window.h"
|
||||
#include "wx/msw/evtloopconsole.h" // for wxMSWEventLoopBase
|
||||
|
||||
|
|
@ -20,8 +18,6 @@
|
|||
// wxEventLoop
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WX_DECLARE_EXPORTED_OBJARRAY(MSG, wxMSGArray);
|
||||
|
||||
class WXDLLIMPEXP_CORE wxGUIEventLoop : public wxMSWEventLoopBase
|
||||
{
|
||||
public:
|
||||
|
|
@ -63,9 +59,6 @@ private:
|
|||
// non null)
|
||||
static bool IsChildOfCriticalWindow(wxWindowMSW *win);
|
||||
|
||||
// array of messages used for temporary storage by YieldFor()
|
||||
wxMSGArray m_arrMSG;
|
||||
|
||||
// critical window or nullptr
|
||||
static wxWindowMSW *ms_winCritical;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@
|
|||
#include "wx/event.h"
|
||||
#include "wx/cmndata.h"
|
||||
#include "wx/intl.h"
|
||||
#include "wx/hashmap.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
/*
|
||||
* Paper type: see defs.h for wxPaperSize enum.
|
||||
|
|
@ -65,10 +66,6 @@ private:
|
|||
wxDECLARE_DYNAMIC_CLASS(wxPrintPaperType);
|
||||
};
|
||||
|
||||
WX_DECLARE_STRING_HASH_MAP(wxPrintPaperType*, wxStringToPrintPaperTypeHashMap);
|
||||
|
||||
class WXDLLIMPEXP_FWD_CORE wxPrintPaperTypeList;
|
||||
|
||||
class WXDLLIMPEXP_CORE wxPrintPaperDatabase
|
||||
{
|
||||
public:
|
||||
|
|
@ -109,9 +106,14 @@ public:
|
|||
wxPrintPaperType* Item(size_t index) const;
|
||||
size_t GetCount() const;
|
||||
private:
|
||||
wxStringToPrintPaperTypeHashMap* m_map;
|
||||
wxPrintPaperTypeList* m_list;
|
||||
//wxDECLARE_DYNAMIC_CLASS(wxPrintPaperDatabase);
|
||||
// Helper used by the existing functions to keep returning non-const
|
||||
// pointers for compatibility.
|
||||
static wxPrintPaperType* AsNonConstPtr(const wxPrintPaperType& paperType)
|
||||
{
|
||||
return const_cast<wxPrintPaperType*>(&paperType);
|
||||
}
|
||||
|
||||
std::vector<wxPrintPaperType> m_paperTypes;
|
||||
};
|
||||
|
||||
extern WXDLLIMPEXP_DATA_CORE(wxPrintPaperDatabase*) wxThePrintPaperDatabase;
|
||||
|
|
|
|||
|
|
@ -92,9 +92,12 @@ public:
|
|||
bool shown;
|
||||
};
|
||||
|
||||
#ifndef SWIG
|
||||
WX_DECLARE_USER_EXPORTED_OBJARRAY(wxRibbonPageTabInfo, wxRibbonPageTabInfoArray, WXDLLIMPEXP_RIBBON);
|
||||
#endif
|
||||
// This must be a class because it's forward declared.
|
||||
class wxRibbonPageTabInfoArray : public wxBaseArray<wxRibbonPageTabInfo>
|
||||
{
|
||||
public:
|
||||
using wxBaseArray<wxRibbonPageTabInfo>::wxBaseArray;
|
||||
};
|
||||
|
||||
class WXDLLIMPEXP_RIBBON wxRibbonBar : public wxRibbonControl
|
||||
{
|
||||
|
|
|
|||
|
|
@ -100,7 +100,9 @@ private:
|
|||
bool m_bEllipsized;
|
||||
};
|
||||
|
||||
WX_DECLARE_EXPORTED_OBJARRAY(wxStatusBarPane, wxStatusBarPaneArray);
|
||||
// This is preserved for compatibility, but is not supposed to be used by the
|
||||
// application code, consider wxStatusBar::m_panes to be a std::vector instead.
|
||||
using wxStatusBarPaneArray = wxBaseArray<wxStatusBarPane>;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxStatusBar: a window near the bottom of the frame used for status info
|
||||
|
|
@ -119,7 +121,7 @@ public:
|
|||
// set the number of fields and call SetStatusWidths(widths) if widths are
|
||||
// given
|
||||
virtual void SetFieldsCount(int number = 1, const int *widths = nullptr);
|
||||
int GetFieldsCount() const { return (int)m_panes.GetCount(); }
|
||||
int GetFieldsCount() const { return static_cast<int>(m_panes.size()); }
|
||||
|
||||
// field text
|
||||
// ----------
|
||||
|
|
@ -145,7 +147,7 @@ public:
|
|||
virtual void SetStatusWidths(int n, const int widths[]);
|
||||
|
||||
int GetStatusWidth(int n) const
|
||||
{ return m_panes[n].GetWidth(); }
|
||||
{ return m_panes.at(n).GetWidth(); }
|
||||
|
||||
// field styles
|
||||
// ------------
|
||||
|
|
@ -154,7 +156,7 @@ public:
|
|||
virtual void SetStatusStyles(int n, const int styles[]);
|
||||
|
||||
int GetStatusStyle(int n) const
|
||||
{ return m_panes[n].GetStyle(); }
|
||||
{ return m_panes.at(n).GetStyle(); }
|
||||
|
||||
// geometry
|
||||
// --------
|
||||
|
|
@ -176,7 +178,7 @@ public:
|
|||
// -------------
|
||||
|
||||
const wxStatusBarPane& GetField(int n) const
|
||||
{ return m_panes[n]; }
|
||||
{ return m_panes.at(n); }
|
||||
|
||||
// wxWindow overrides:
|
||||
|
||||
|
|
|
|||
|
|
@ -19,10 +19,19 @@
|
|||
|
||||
#include "wx/buffer.h"
|
||||
#include "wx/language.h"
|
||||
#include "wx/hashmap.h"
|
||||
#include "wx/strconv.h"
|
||||
|
||||
// This is a hack, but this header used to include wx/hashmap.h which, in turn,
|
||||
// included wx/wxcrt.h and it turns out quite some existing code relied on it
|
||||
// by using the CRT wrapper functions declared there without explicitly
|
||||
// including that header, so keep including it from here to let it continue to
|
||||
// compile.
|
||||
#include "wx/wxcrt.h"
|
||||
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
|
||||
using wxTranslationsHashMap = std::unordered_map<wxString, wxString>;
|
||||
|
||||
// ============================================================================
|
||||
// global decls
|
||||
|
|
@ -111,7 +120,7 @@ private:
|
|||
wxMsgCatalog *m_pNext;
|
||||
friend class wxTranslations;
|
||||
|
||||
wxStringToStringHashMap m_messages; // all messages in the catalog
|
||||
wxTranslationsHashMap m_messages; // all messages in the catalog
|
||||
wxString m_domain; // name of the domain
|
||||
|
||||
wxPluralFormsCalculatorPtr m_pluralFormsCalculator;
|
||||
|
|
@ -195,7 +204,7 @@ private:
|
|||
// In addition to keeping all the catalogs in the linked list, we also
|
||||
// store them in a hash map indexed by the domain name to allow finding
|
||||
// them by name efficiently.
|
||||
WX_DECLARE_HASH_MAP(wxString, wxMsgCatalog *, wxStringHash, wxStringEqual, wxMsgCatalogMap);
|
||||
using wxMsgCatalogMap = std::unordered_map<wxString, wxMsgCatalog*>;
|
||||
wxMsgCatalogMap m_catalogMap;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -19,8 +19,6 @@
|
|||
|
||||
// fwd declarations
|
||||
class WXDLLIMPEXP_FWD_CORE wxMenuInfo;
|
||||
WX_DECLARE_EXPORTED_OBJARRAY(wxMenuInfo, wxMenuInfoArray);
|
||||
|
||||
class WXDLLIMPEXP_FWD_CORE wxMenuGeometryInfo;
|
||||
class WXDLLIMPEXP_FWD_CORE wxPopupMenuWindow;
|
||||
class WXDLLIMPEXP_FWD_CORE wxRenderer;
|
||||
|
|
@ -141,7 +139,7 @@ class WXDLLIMPEXP_CORE wxMenuBar : public wxMenuBarBase
|
|||
{
|
||||
public:
|
||||
// ctors and dtor
|
||||
wxMenuBar(long WXUNUSED(style) = 0) { Init(); }
|
||||
wxMenuBar(long WXUNUSED(style) = 0);
|
||||
wxMenuBar(size_t n, wxMenu *menus[], const wxString titles[], long style = 0);
|
||||
virtual ~wxMenuBar();
|
||||
|
||||
|
|
@ -213,7 +211,7 @@ protected:
|
|||
bool IsCreated() const { return m_frameLast != nullptr; }
|
||||
|
||||
// "fast" version of GetMenuCount()
|
||||
size_t GetCount() const { return m_menuInfos.GetCount(); }
|
||||
size_t GetCount() const;
|
||||
|
||||
// get the (total) width of the specified menu
|
||||
wxCoord GetItemWidth(size_t pos) const;
|
||||
|
|
@ -249,7 +247,7 @@ protected:
|
|||
bool ReleaseMouseCapture();
|
||||
|
||||
// the array containing extra menu info we need
|
||||
wxMenuInfoArray m_menuInfos;
|
||||
std::vector<wxMenuInfo> m_menuInfos;
|
||||
|
||||
// the current item (only used when menubar has focus)
|
||||
int m_current;
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@
|
|||
|
||||
#include "wx/private/timer.h"
|
||||
|
||||
#include <list>
|
||||
|
||||
// the type used for milliseconds is large enough for microseconds too but
|
||||
// introduce a synonym for it to avoid confusion
|
||||
typedef wxMilliClock_t wxUsecClock_t;
|
||||
|
|
@ -67,7 +69,7 @@ struct wxTimerSchedule
|
|||
};
|
||||
|
||||
// the linked list of all active timers, we keep it sorted by expiration time
|
||||
WX_DECLARE_LIST(wxTimerSchedule, wxTimerList);
|
||||
using wxTimerList = std::list<wxTimerSchedule>;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxTimerScheduler: class responsible for updating all timers
|
||||
|
|
@ -118,13 +120,11 @@ public:
|
|||
private:
|
||||
// ctor and dtor are private, this is a singleton class only created by
|
||||
// Get() and destroyed by Shutdown()
|
||||
wxTimerScheduler() { }
|
||||
~wxTimerScheduler();
|
||||
wxTimerScheduler() = default;
|
||||
~wxTimerScheduler() = default;
|
||||
|
||||
// add the given timer schedule to the list in the right place
|
||||
//
|
||||
// we take ownership of the pointer "s" which must be heap-allocated
|
||||
void DoAddTimer(wxTimerSchedule *s);
|
||||
void DoAddTimer(const wxTimerSchedule& s);
|
||||
|
||||
|
||||
// the list of all currently active timers sorted by expiration
|
||||
|
|
|
|||
|
|
@ -253,9 +253,6 @@ protected:
|
|||
wxString m_name;
|
||||
};
|
||||
|
||||
#include "wx/dynarray.h"
|
||||
WX_DECLARE_OBJARRAY_WITH_DECL(wxVariantBase, wxVariantBaseArray, class WXDLLIMPEXP_BASE);
|
||||
|
||||
|
||||
// templated streaming, every type must have their specialization for these methods
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
// wxVideoMode: a simple struct containing video mode parameters for a display
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
struct WXDLLIMPEXP_CORE wxVideoMode
|
||||
struct wxVideoMode
|
||||
{
|
||||
wxVideoMode(int width = 0, int height = 0, int depth = 0, int freq = 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -106,7 +106,8 @@ protected:
|
|||
#if wxUSE_GUI
|
||||
|
||||
#include "wx/icon.h"
|
||||
#include "wx/iconbndl.h" // only for wxIconArray
|
||||
|
||||
#include <vector>
|
||||
|
||||
enum wxFSIconType
|
||||
{
|
||||
|
|
@ -130,7 +131,7 @@ private:
|
|||
void InitIcons();
|
||||
|
||||
// the different icons for this volume (created on demand)
|
||||
wxIconArray m_icons;
|
||||
std::vector<wxIcon> m_icons;
|
||||
};
|
||||
|
||||
#else // !wxUSE_GUI
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@
|
|||
#define _WX_PRIVATE_H_
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/hashmap.h"
|
||||
#include "wx/utils.h"
|
||||
#if defined( __cplusplus ) && defined( __VMS )
|
||||
#pragma message disable nosimpint
|
||||
|
|
@ -29,6 +28,8 @@
|
|||
|
||||
#include <pango/pango.h>
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
class WXDLLIMPEXP_FWD_CORE wxMouseEvent;
|
||||
class WXDLLIMPEXP_FWD_CORE wxKeyEvent;
|
||||
class WXDLLIMPEXP_FWD_CORE wxWindow;
|
||||
|
|
@ -38,7 +39,7 @@ class WXDLLIMPEXP_FWD_CORE wxWindow;
|
|||
// corresponding to the window for this widget
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WX_DECLARE_HASH_MAP(Window, wxWindow *, wxIntegerHash, wxIntegerEqual, wxWindowHash);
|
||||
using wxWindowHash = std::unordered_map<Window, wxWindow*>;
|
||||
|
||||
// these hashes are defined in app.cpp
|
||||
extern wxWindowHash *wxWidgetHashTable;
|
||||
|
|
|
|||
|
|
@ -16,6 +16,9 @@
|
|||
#include "wx/archive.h"
|
||||
#include "wx/filename.h"
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
// some methods from wxZipInputStream and wxZipOutputStream stream do not get
|
||||
// exported/imported when compiled with Mingw versions before 3.4.2. So they
|
||||
// are imported/exported individually as a workaround
|
||||
|
|
@ -287,8 +290,6 @@ private:
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// wxZipOutputStream
|
||||
|
||||
WX_DECLARE_LIST_WITH_DECL(wxZipEntry, wxZipEntryList_, class WXDLLIMPEXP_BASE);
|
||||
|
||||
class WXDLLIMPEXP_BASE wxZipOutputStream : public wxArchiveOutputStream
|
||||
{
|
||||
public:
|
||||
|
|
@ -354,7 +355,7 @@ private:
|
|||
class wxStoredOutputStream *m_store;
|
||||
class wxZlibOutputStream2 *m_deflate;
|
||||
class wxZipStreamLink *m_backlink;
|
||||
wxZipEntryList_ m_entries;
|
||||
std::vector<std::unique_ptr<wxZipEntry>> m_entries;
|
||||
char *m_initialData;
|
||||
size_t m_initialSize;
|
||||
wxZipEntry *m_pending;
|
||||
|
|
|
|||
|
|
@ -133,6 +133,10 @@ const char* wxART_WX_LOGO;
|
|||
wxArtProvider::Push(new MyProvider);
|
||||
@endcode
|
||||
|
||||
Note that, as usual in wxWidgets API, wxArtProvider takes ownership of the
|
||||
pointer and will destroy it on program shutdown. In particular, you should
|
||||
not delete this pointer in your own code.
|
||||
|
||||
If you need bitmap images (of the same artwork) that should be displayed at
|
||||
different sizes you should probably consider overriding wxArtProvider::CreateIconBundle
|
||||
and supplying icon bundles that contain different bitmap sizes.
|
||||
|
|
@ -423,6 +427,8 @@ public:
|
|||
Register new art provider and add it to the top of providers stack
|
||||
(i.e. it will be queried as the first provider).
|
||||
|
||||
@param provider A valid pointer that becomes owned by wxArtProvider.
|
||||
|
||||
@see PushBack()
|
||||
*/
|
||||
static void Push(wxArtProvider* provider);
|
||||
|
|
@ -432,6 +438,8 @@ public:
|
|||
In other words, it will be queried as the last one, after all others,
|
||||
including the default provider.
|
||||
|
||||
@param provider A valid pointer that becomes owned by wxArtProvider.
|
||||
|
||||
@see Push()
|
||||
|
||||
@since 2.9.0
|
||||
|
|
|
|||
|
|
@ -454,6 +454,17 @@ public:
|
|||
bool CanBeToggled() const;
|
||||
};
|
||||
|
||||
/**
|
||||
A vector of AUI toolbar items.
|
||||
|
||||
This class is actually a legacy container (see @ref overview_container for
|
||||
more details), but it can, and should be, handled as just a vector of
|
||||
wxAuiToolBarItem objects in the application code.
|
||||
*/
|
||||
class wxAuiToolBarItemArray : public std::vector<wxAuiToolBarItem>
|
||||
{
|
||||
};
|
||||
|
||||
/**
|
||||
@class wxAuiToolBarArt
|
||||
|
||||
|
|
|
|||
|
|
@ -453,6 +453,17 @@ public:
|
|||
bool active; // true if the page is currently active
|
||||
};
|
||||
|
||||
/**
|
||||
A vector of AUI notebook pages.
|
||||
|
||||
This class is actually a legacy container (see @ref overview_container for
|
||||
more details), but it can, and should be, handled as just a vector of
|
||||
wxAuiNotebookPage objects in the application code.
|
||||
*/
|
||||
class wxAuiNotebookPageArray : public std::vector<wxAuiNotebookPage>
|
||||
{
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@class wxAuiTabContainerButton
|
||||
|
|
@ -480,6 +491,18 @@ public:
|
|||
};
|
||||
|
||||
|
||||
/**
|
||||
A vector of AUI tab buttons.
|
||||
|
||||
This class is actually a legacy container (see @ref overview_container for
|
||||
more details), but it can, and should be, handled as just a vector of
|
||||
wxAuiTabContainerButton objects in the application code.
|
||||
*/
|
||||
class wxAuiTabContainerButtonArray : public std::vector<wxAuiTabContainerButton>
|
||||
{
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@class wxAuiTabContainer
|
||||
|
||||
|
|
|
|||
|
|
@ -56,6 +56,14 @@ public:
|
|||
};
|
||||
|
||||
|
||||
/**
|
||||
A vector of wxDynamicLibraryDetails.
|
||||
|
||||
This class is actually a legacy container (see @ref overview_container for
|
||||
more details), but it can, and should be, handled as just a vector of
|
||||
wxDynamicLibraryDetails objects in the application code.
|
||||
*/
|
||||
using wxDynamicLibraryDetailsArray = std::vector<wxDynamicLibraryDetails>;
|
||||
|
||||
/**
|
||||
Dynamic library category used with wxDynamicLibrary::CanonicalizeName().
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public:
|
|||
Save the animated gif.
|
||||
|
||||
@param images
|
||||
The image array object which is to be affected by this operation.
|
||||
The images making up the animation.
|
||||
@param stream
|
||||
Opened output stream for writing the data.
|
||||
@param verbose
|
||||
|
|
@ -45,11 +45,11 @@ public:
|
|||
@return @true if the operation succeeded, @false otherwise.
|
||||
|
||||
*/
|
||||
bool SaveAnimation(const wxImageArray& images, wxOutputStream *stream,
|
||||
bool SaveAnimation(const std::vector<wxImage>& images, wxOutputStream *stream,
|
||||
bool verbose = true, int delayMilliSecs = 1000);
|
||||
|
||||
protected:
|
||||
// allow parent class documentation to overwrite.
|
||||
virtual int DoGetImageCount(wxInputStream& stream);
|
||||
virtual bool DoCanRead(wxInputStream& stream);
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -111,6 +111,16 @@ public:
|
|||
bool shown;
|
||||
};
|
||||
|
||||
/**
|
||||
A vector of wxRibbonPageTabInfo.
|
||||
|
||||
This class is actually a legacy container (see @ref overview_container for
|
||||
more details), but it can, and should be, handled as just a vector of
|
||||
wxRibbonPageTabInfo objects in the application code.
|
||||
*/
|
||||
class wxRibbonPageTabInfoArray : public std::vector<wxRibbonPageTabInfoArray>
|
||||
{
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -85,3 +85,11 @@ public:
|
|||
*/
|
||||
const wxVideoMode wxDefaultVideoMode;
|
||||
|
||||
/**
|
||||
A vector of video modes.
|
||||
|
||||
This class is actually a legacy container (see @ref overview_container for
|
||||
more details), but it can, and should be, handled as just a vector of
|
||||
wxVideoMode objects in the application code.
|
||||
*/
|
||||
using wxArrayVideoModes = std::vector<wxVideoMode>;
|
||||
|
|
|
|||
|
|
@ -2809,10 +2809,10 @@ void GridFrame::OnGridRender( wxCommandEvent& event )
|
|||
}
|
||||
else if ( grid->IsSelection() && grid->GetSelectionBlockTopLeft().Count() )
|
||||
{
|
||||
wxGridCellCoordsArray cells = grid->GetSelectionBlockTopLeft();
|
||||
wxGridCellCoordsVector cells = grid->GetSelectionBlockTopLeft();
|
||||
if ( grid->GetSelectionBlockBottomRight().Count() )
|
||||
{
|
||||
cells.Add( grid->GetSelectionBlockBottomRight()[ 0 ] );
|
||||
cells.push_back( grid->GetSelectionBlockBottomRight()[ 0 ] );
|
||||
topLeft.Set( cells[ 0 ].GetRow(),
|
||||
cells[ 0 ].GetCol() );
|
||||
bottomRight.Set( cells[ 1 ].GetRow(),
|
||||
|
|
|
|||
|
|
@ -33,10 +33,6 @@
|
|||
|
||||
#include "dxfrenderer.h"
|
||||
|
||||
#include "wx/listimpl.cpp"
|
||||
WX_DEFINE_LIST(DXFEntityList)
|
||||
WX_DEFINE_LIST(DXFLayerList)
|
||||
|
||||
// Conversion table from AutoCAD ACI colours to RGB values
|
||||
static const struct { unsigned char r, g, b; } aci_to_rgb[256] = {
|
||||
/* 0 */ {255, 255, 255},
|
||||
|
|
@ -341,31 +337,16 @@ DXFRenderer::~DXFRenderer()
|
|||
void DXFRenderer::Clear()
|
||||
{
|
||||
m_loaded = false;
|
||||
{
|
||||
for (DXFLayerList::compatibility_iterator node = m_layers.GetFirst(); node; node = node->GetNext())
|
||||
{
|
||||
DXFLayer *current = node->GetData();
|
||||
delete current;
|
||||
}
|
||||
}
|
||||
m_layers.Clear();
|
||||
{
|
||||
for (DXFEntityList::compatibility_iterator node = m_entities.GetFirst(); node; node = node->GetNext())
|
||||
{
|
||||
DXFEntity *current = node->GetData();
|
||||
delete current;
|
||||
}
|
||||
m_entities.Clear();
|
||||
}
|
||||
m_layers.clear();
|
||||
m_entities.clear();
|
||||
}
|
||||
|
||||
int DXFRenderer::GetLayerColour(const wxString& layer) const
|
||||
{
|
||||
for (DXFLayerList::compatibility_iterator node = m_layers.GetFirst(); node; node = node->GetNext())
|
||||
for (const auto& current : m_layers)
|
||||
{
|
||||
DXFLayer *current = node->GetData();
|
||||
if (current->name == layer)
|
||||
return current->colour;
|
||||
if (current.name == layer)
|
||||
return current.colour;
|
||||
}
|
||||
return 7; // white
|
||||
}
|
||||
|
|
@ -406,10 +387,10 @@ bool DXFRenderer::ParseTables(wxInputStream& stream)
|
|||
// flush layer
|
||||
if (!layer.name.IsEmpty() && layer.colour != -1)
|
||||
{
|
||||
DXFLayer *p = new DXFLayer;
|
||||
p->name = layer.name;
|
||||
p->colour = layer.colour;
|
||||
m_layers.Append(p);
|
||||
DXFLayer p;
|
||||
p.name = layer.name;
|
||||
p.colour = layer.colour;
|
||||
m_layers.push_back(p);
|
||||
}
|
||||
layer = DXFLayer();
|
||||
inlayer = false;
|
||||
|
|
@ -466,31 +447,31 @@ bool DXFRenderer::ParseEntities(wxInputStream& stream)
|
|||
// flush entity
|
||||
if (state == 1) // 3DFACE
|
||||
{
|
||||
DXFFace *p = new DXFFace;
|
||||
p->v0 = v[0];
|
||||
p->v1 = v[1];
|
||||
p->v2 = v[2];
|
||||
p->v3 = v[3];
|
||||
p->CalculateNormal();
|
||||
DXFFace p;
|
||||
p.v0 = v[0];
|
||||
p.v1 = v[1];
|
||||
p.v2 = v[2];
|
||||
p.v3 = v[3];
|
||||
p.CalculateNormal();
|
||||
if (colour != -1)
|
||||
p->colour = colour;
|
||||
p.colour = colour;
|
||||
else
|
||||
p->colour = GetLayerColour(layer);
|
||||
m_entities.Append(p);
|
||||
p.colour = GetLayerColour(layer);
|
||||
m_entities.push_back(p);
|
||||
colour = -1; layer.clear();
|
||||
v[0] = v[1] = v[2] = v[3] = DXFVector();
|
||||
state = 0;
|
||||
}
|
||||
else if (state == 2) // LINE
|
||||
{
|
||||
DXFLine *p = new DXFLine;
|
||||
p->v0 = v[0];
|
||||
p->v1 = v[1];
|
||||
DXFLine p;
|
||||
p.v0 = v[0];
|
||||
p.v1 = v[1];
|
||||
if (colour != -1)
|
||||
p->colour = colour;
|
||||
p.colour = colour;
|
||||
else
|
||||
p->colour = GetLayerColour(layer);
|
||||
m_entities.Append(p);
|
||||
p.colour = GetLayerColour(layer);
|
||||
m_entities.push_back(p);
|
||||
colour = -1; layer.clear();
|
||||
v[0] = v[1] = v[2] = v[3] = DXFVector();
|
||||
state = 0;
|
||||
|
|
@ -594,9 +575,9 @@ void DXFRenderer::NormalizeEntities()
|
|||
// calculate current min and max boundings of object
|
||||
DXFVector minv(10e20f, 10e20f, 10e20f);
|
||||
DXFVector maxv(-10e20f, -10e20f, -10e20f);
|
||||
for (DXFEntityList::compatibility_iterator node = m_entities.GetFirst(); node; node = node->GetNext())
|
||||
for (auto& entity : m_entities)
|
||||
{
|
||||
DXFEntity *p = node->GetData();
|
||||
DXFEntity *p = &entity;
|
||||
if (p->type == DXFEntity::Line)
|
||||
{
|
||||
DXFLine *line = (DXFLine *)p;
|
||||
|
|
@ -629,9 +610,9 @@ void DXFRenderer::NormalizeEntities()
|
|||
// rescale object down to [-5,5]
|
||||
DXFVector span(maxv.x - minv.x, maxv.y - minv.y, maxv.z - minv.z);
|
||||
float factor = mymin(mymin(10.0f / span.x, 10.0f / span.y), 10.0f / span.z);
|
||||
for (DXFEntityList::compatibility_iterator node2 = m_entities.GetFirst(); node2; node2 = node2->GetNext())
|
||||
for (auto& entity : m_entities)
|
||||
{
|
||||
DXFEntity *p = node2->GetData();
|
||||
DXFEntity *p = &entity;
|
||||
if (p->type == DXFEntity::Line)
|
||||
{
|
||||
DXFLine *line = (DXFLine *)p;
|
||||
|
|
@ -662,9 +643,9 @@ void DXFRenderer::Render() const
|
|||
if (!m_loaded)
|
||||
return;
|
||||
|
||||
for (DXFEntityList::compatibility_iterator node = m_entities.GetFirst(); node; node = node->GetNext())
|
||||
for (const auto& entity : m_entities)
|
||||
{
|
||||
DXFEntity *p = node->GetData();
|
||||
const DXFEntity *p = &entity;
|
||||
wxColour c = ACIColourToRGB(p->colour);
|
||||
if (p->type == DXFEntity::Line)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@
|
|||
#ifndef _DXFRENDERER_H_
|
||||
#define _DXFRENDERER_H_
|
||||
|
||||
#include <vector>
|
||||
|
||||
struct DXFVector
|
||||
{
|
||||
DXFVector() { x = y = z = 0.0f; }
|
||||
|
|
@ -49,9 +51,6 @@ struct DXFLayer
|
|||
int colour;
|
||||
};
|
||||
|
||||
WX_DECLARE_LIST(DXFEntity, DXFEntityList);
|
||||
WX_DECLARE_LIST(DXFLayer, DXFLayerList);
|
||||
|
||||
class DXFRenderer
|
||||
{
|
||||
public:
|
||||
|
|
@ -71,8 +70,8 @@ private:
|
|||
void NormalizeEntities();
|
||||
|
||||
bool m_loaded;
|
||||
DXFLayerList m_layers;
|
||||
DXFEntityList m_entities;
|
||||
std::vector<DXFLayer> m_layers;
|
||||
std::vector<DXFEntity> m_entities;
|
||||
};
|
||||
|
||||
#endif // !_DXFRENDERER_H_
|
||||
|
|
|
|||
|
|
@ -36,10 +36,6 @@
|
|||
#include "wx/osx/private.h"
|
||||
#endif
|
||||
|
||||
#include "wx/arrimpl.cpp"
|
||||
WX_DEFINE_OBJARRAY(wxAuiToolBarItemArray)
|
||||
|
||||
|
||||
wxDEFINE_EVENT( wxEVT_AUITOOLBAR_TOOL_DROPDOWN, wxAuiToolBarEvent );
|
||||
wxDEFINE_EVENT( wxEVT_AUITOOLBAR_OVERFLOW_CLICK, wxAuiToolBarEvent );
|
||||
wxDEFINE_EVENT( wxEVT_AUITOOLBAR_RIGHT_CLICK, wxAuiToolBarEvent );
|
||||
|
|
@ -1258,7 +1254,7 @@ wxAuiToolBarItem* wxAuiToolBar::FindToolByIndex(int idx) const
|
|||
if (idx >= (int)m_items.size())
|
||||
return nullptr;
|
||||
|
||||
return &(m_items[idx]);
|
||||
return const_cast<wxAuiToolBarItem*>(&(m_items[idx]));
|
||||
}
|
||||
|
||||
void wxAuiToolBar::SetToolClientData (int tool_id, wxObject *client_data)
|
||||
|
|
|
|||
|
|
@ -34,10 +34,6 @@
|
|||
#include "wx/osx/private.h"
|
||||
#endif
|
||||
|
||||
#include "wx/arrimpl.cpp"
|
||||
WX_DEFINE_OBJARRAY(wxAuiNotebookPageArray)
|
||||
WX_DEFINE_OBJARRAY(wxAuiTabContainerButtonArray)
|
||||
|
||||
wxDEFINE_EVENT(wxEVT_AUINOTEBOOK_PAGE_CLOSE, wxAuiNotebookEvent);
|
||||
wxDEFINE_EVENT(wxEVT_AUINOTEBOOK_PAGE_CLOSED, wxAuiNotebookEvent);
|
||||
wxDEFINE_EVENT(wxEVT_AUINOTEBOOK_PAGE_CHANGING, wxAuiNotebookEvent);
|
||||
|
|
@ -866,8 +862,11 @@ bool wxAuiTabContainer::TabHitTest(int x, int y, wxWindow** hit) const
|
|||
wxAuiTabContainerButton* btn = nullptr;
|
||||
if (ButtonHitTest(x, y, &btn) && !(btn->curState & wxAUI_BUTTON_STATE_DISABLED))
|
||||
{
|
||||
if (m_buttons.Index(*btn) != wxNOT_FOUND)
|
||||
return false;
|
||||
for ( const auto& button : m_buttons )
|
||||
{
|
||||
if ( btn == &button )
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
size_t i, page_count = m_pages.GetCount();
|
||||
|
|
|
|||
|
|
@ -42,13 +42,6 @@
|
|||
|
||||
WX_CHECK_BUILD_OPTIONS("wxAUI")
|
||||
|
||||
#include "wx/arrimpl.cpp"
|
||||
WX_DECLARE_OBJARRAY(wxRect, wxAuiRectArray);
|
||||
WX_DEFINE_OBJARRAY(wxAuiRectArray)
|
||||
WX_DEFINE_OBJARRAY(wxAuiDockUIPartArray)
|
||||
WX_DEFINE_OBJARRAY(wxAuiDockInfoArray)
|
||||
WX_DEFINE_OBJARRAY(wxAuiPaneInfoArray)
|
||||
|
||||
wxAuiPaneInfo wxAuiNullPaneInfo;
|
||||
wxAuiDockInfo wxAuiNullDockInfo;
|
||||
wxDEFINE_EVENT( wxEVT_AUI_PANE_BUTTON, wxAuiManagerEvent );
|
||||
|
|
@ -630,6 +623,20 @@ wxAuiManager::~wxAuiManager()
|
|||
delete m_art;
|
||||
}
|
||||
|
||||
int wxAuiManager::GetActionPartIndex() const
|
||||
{
|
||||
int n = 0;
|
||||
for ( const auto& uiPart : m_uiParts )
|
||||
{
|
||||
if ( &uiPart == m_actionPart )
|
||||
return n;
|
||||
|
||||
++n;
|
||||
}
|
||||
|
||||
return wxNOT_FOUND;
|
||||
}
|
||||
|
||||
void wxAuiManager::OnSysColourChanged(wxSysColourChangedEvent& event)
|
||||
{
|
||||
m_art->UpdateColoursFromSystem();
|
||||
|
|
@ -1241,12 +1248,27 @@ bool wxAuiManager::DetachPane(wxWindow* window)
|
|||
// just in case the caller doesn't call Update() immediately after
|
||||
// the DetachPane() call. This prevets obscure crashes which would
|
||||
// happen at window repaint if the caller forgets to call Update()
|
||||
int actionPartIndex = GetActionPartIndex();
|
||||
int pi, part_count;
|
||||
for (pi = 0, part_count = (int)m_uiParts.GetCount(); pi < part_count; ++pi)
|
||||
{
|
||||
wxAuiDockUIPart& part = m_uiParts.Item(pi);
|
||||
if (part.pane == &p)
|
||||
{
|
||||
if (actionPartIndex != wxNOT_FOUND)
|
||||
{
|
||||
if (pi == actionPartIndex)
|
||||
{
|
||||
// We're removing the action part, so invalidate it.
|
||||
actionPartIndex = wxNOT_FOUND;
|
||||
}
|
||||
else if (pi < actionPartIndex)
|
||||
{
|
||||
// Just adjust the action part index.
|
||||
actionPartIndex--;
|
||||
}
|
||||
}
|
||||
|
||||
m_uiParts.RemoveAt(pi);
|
||||
part_count--;
|
||||
pi--;
|
||||
|
|
@ -1254,6 +1276,11 @@ bool wxAuiManager::DetachPane(wxWindow* window)
|
|||
}
|
||||
}
|
||||
|
||||
// Update m_actionPart pointer too to ensure that it remains valid.
|
||||
m_actionPart = actionPartIndex == wxNOT_FOUND
|
||||
? nullptr
|
||||
: &m_uiParts.Item(actionPartIndex);
|
||||
|
||||
m_panes.RemoveAt(i);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -2623,7 +2650,7 @@ void wxAuiManager::Update()
|
|||
|
||||
// keep track of the old window rectangles so we can
|
||||
// refresh those windows whose rect has changed
|
||||
wxAuiRectArray old_pane_rects;
|
||||
std::vector<wxRect> old_pane_rects;
|
||||
for (i = 0; i < pane_count; ++i)
|
||||
{
|
||||
wxRect r;
|
||||
|
|
@ -2632,7 +2659,7 @@ void wxAuiManager::Update()
|
|||
if (p.window && p.IsShown() && p.IsDocked())
|
||||
r = p.rect;
|
||||
|
||||
old_pane_rects.Add(r);
|
||||
old_pane_rects.push_back(r);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -4544,7 +4571,7 @@ void wxAuiManager::OnMotion(wxMouseEvent& event)
|
|||
if (m_currentDragItem != -1)
|
||||
m_actionPart = & (m_uiParts.Item(m_currentDragItem));
|
||||
else
|
||||
m_currentDragItem = m_uiParts.Index(* m_actionPart);
|
||||
m_currentDragItem = GetActionPartIndex();
|
||||
|
||||
if (m_actionPart)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -38,13 +38,6 @@ public:
|
|||
int m_imageIndex;
|
||||
};
|
||||
|
||||
#include "wx/arrimpl.cpp" // this is a magic incantation which must be done!
|
||||
WX_DEFINE_OBJARRAY(wxImageArray)
|
||||
|
||||
#include "wx/arrimpl.cpp" // this is a magic incantation which must be done!
|
||||
WX_DEFINE_OBJARRAY(wxANIFrameInfoArray)
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// wxANIDecoder
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
@ -234,8 +227,8 @@ bool wxANIDecoder::Load( wxInputStream& stream )
|
|||
m_nFrames = 0;
|
||||
m_szAnimation = wxDefaultSize;
|
||||
|
||||
m_images.Clear();
|
||||
m_info.Clear();
|
||||
m_images.clear();
|
||||
m_info.clear();
|
||||
|
||||
// we have a riff file:
|
||||
while ( !stream.Eof() )
|
||||
|
|
@ -278,8 +271,8 @@ bool wxANIDecoder::Load( wxInputStream& stream )
|
|||
|
||||
globaldelay = header.JifRate * 1000 / 60;
|
||||
|
||||
m_images.Alloc(header.cFrames);
|
||||
m_info.Add(wxANIFrameInfo(), m_nFrames);
|
||||
m_images.reserve(header.cFrames);
|
||||
m_info.resize(m_nFrames);
|
||||
}
|
||||
else if ( FCC1 == rate32 )
|
||||
{
|
||||
|
|
@ -287,7 +280,7 @@ bool wxANIDecoder::Load( wxInputStream& stream )
|
|||
if (m_nFrames == 0)
|
||||
return false; // rate chunks should always be placed after anih chunk
|
||||
|
||||
wxASSERT(m_info.GetCount() == m_nFrames);
|
||||
wxASSERT(m_info.size() == m_nFrames);
|
||||
for (unsigned int i=0; i<m_nFrames; i++)
|
||||
{
|
||||
if (!stream.Read(&FCC2, 4))
|
||||
|
|
@ -301,7 +294,7 @@ bool wxANIDecoder::Load( wxInputStream& stream )
|
|||
if (m_nFrames == 0)
|
||||
return false; // seq chunks should always be placed after anih chunk
|
||||
|
||||
wxASSERT(m_info.GetCount() == m_nFrames);
|
||||
wxASSERT(m_info.size() == m_nFrames);
|
||||
for (unsigned int i=0; i<m_nFrames; i++)
|
||||
{
|
||||
if (!stream.Read(&FCC2, 4))
|
||||
|
|
@ -317,7 +310,7 @@ bool wxANIDecoder::Load( wxInputStream& stream )
|
|||
return false;
|
||||
|
||||
image.SetType(wxBITMAP_TYPE_ANI);
|
||||
m_images.Add(image);
|
||||
m_images.push_back(image);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -338,7 +331,7 @@ bool wxANIDecoder::Load( wxInputStream& stream )
|
|||
if (m_nFrames==0)
|
||||
return false;
|
||||
|
||||
if (m_nFrames==m_images.GetCount())
|
||||
if (m_nFrames==m_images.size())
|
||||
{
|
||||
// if no SEQ chunk is available, display the frames in the order
|
||||
// they were loaded
|
||||
|
|
|
|||
|
|
@ -19,31 +19,32 @@
|
|||
#include "wx/artprov.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/list.h"
|
||||
#include "wx/log.h"
|
||||
#include "wx/hashmap.h"
|
||||
#include "wx/image.h"
|
||||
#include "wx/module.h"
|
||||
#include "wx/window.h"
|
||||
#endif
|
||||
|
||||
// ===========================================================================
|
||||
// implementation
|
||||
// ===========================================================================
|
||||
#include <list>
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "wx/listimpl.cpp"
|
||||
WX_DECLARE_LIST(wxArtProvider, wxArtProvidersList);
|
||||
WX_DEFINE_LIST(wxArtProvidersList)
|
||||
using wxArtProviderPtr = std::unique_ptr<wxArtProvider>;
|
||||
class wxArtProvidersList : public std::list<wxArtProviderPtr>
|
||||
{
|
||||
public:
|
||||
using std::list<wxArtProviderPtr>::list;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Cache class - stores already requested bitmaps
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WX_DECLARE_EXPORTED_STRING_HASH_MAP(wxBitmap, wxArtProviderBitmapsHash);
|
||||
WX_DECLARE_EXPORTED_STRING_HASH_MAP(wxBitmapBundle, wxArtProviderBitmapBundlesHash);
|
||||
WX_DECLARE_EXPORTED_STRING_HASH_MAP(wxIconBundle, wxArtProviderIconBundlesHash);
|
||||
using wxArtProviderBitmapsHash = std::unordered_map<wxString, wxBitmap>;
|
||||
using wxArtProviderBitmapBundlesHash = std::unordered_map<wxString, wxBitmapBundle>;
|
||||
using wxArtProviderIconBundlesHash = std::unordered_map<wxString, wxIconBundle>;
|
||||
|
||||
class WXDLLEXPORT wxArtProviderCache
|
||||
class wxArtProviderCache
|
||||
{
|
||||
public:
|
||||
bool GetBitmap(const wxString& full_id, wxBitmap* bmp);
|
||||
|
|
@ -241,10 +242,7 @@ wxArtProviderCache *wxArtProvider::sm_cache = nullptr;
|
|||
// wxArtProvider ctors/dtor
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxArtProvider::~wxArtProvider()
|
||||
{
|
||||
Remove(this);
|
||||
}
|
||||
wxArtProvider::~wxArtProvider() = default;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxArtProvider operations on provider stack
|
||||
|
|
@ -264,13 +262,13 @@ wxArtProvider::~wxArtProvider()
|
|||
/*static*/ void wxArtProvider::Push(wxArtProvider *provider)
|
||||
{
|
||||
CommonAddingProvider();
|
||||
sm_providers->Insert(provider);
|
||||
sm_providers->push_front(wxArtProviderPtr(provider));
|
||||
}
|
||||
|
||||
/*static*/ void wxArtProvider::PushBack(wxArtProvider *provider)
|
||||
{
|
||||
CommonAddingProvider();
|
||||
sm_providers->Append(provider);
|
||||
sm_providers->push_back(wxArtProviderPtr(provider));
|
||||
}
|
||||
|
||||
/*static*/ bool wxArtProvider::Pop()
|
||||
|
|
@ -278,7 +276,7 @@ wxArtProvider::~wxArtProvider()
|
|||
wxCHECK_MSG( sm_providers, false, wxT("no wxArtProvider exists") );
|
||||
wxCHECK_MSG( !sm_providers->empty(), false, wxT("wxArtProviders stack is empty") );
|
||||
|
||||
delete sm_providers->GetFirst()->GetData();
|
||||
sm_providers->pop_front();
|
||||
sm_cache->Clear();
|
||||
return true;
|
||||
}
|
||||
|
|
@ -287,7 +285,16 @@ wxArtProvider::~wxArtProvider()
|
|||
{
|
||||
wxCHECK_MSG( sm_providers, false, wxT("no wxArtProvider exists") );
|
||||
|
||||
if ( sm_providers->DeleteObject(provider) )
|
||||
// Unfortunately remove() doesn't return the number of the removed elements
|
||||
// until C++20, so check whether it did anything manually.
|
||||
const auto oldSize = sm_providers->size();
|
||||
|
||||
sm_providers->remove_if([provider](const wxArtProviderPtr& p)
|
||||
{
|
||||
return p.get() == provider;
|
||||
});
|
||||
|
||||
if ( sm_providers->size() != oldSize )
|
||||
{
|
||||
sm_cache->Clear();
|
||||
return true;
|
||||
|
|
@ -308,9 +315,6 @@ wxArtProvider::~wxArtProvider()
|
|||
{
|
||||
if ( sm_providers )
|
||||
{
|
||||
while ( !sm_providers->empty() )
|
||||
delete *sm_providers->begin();
|
||||
|
||||
wxDELETE(sm_providers);
|
||||
wxDELETE(sm_cache);
|
||||
}
|
||||
|
|
@ -416,10 +420,8 @@ wxArtProvider::RescaleOrResizeIfNeeded(wxBitmap& bmp, const wxSize& sizeNeeded)
|
|||
wxBitmap bmp;
|
||||
if ( !sm_cache->GetBitmap(hashId, &bmp) )
|
||||
{
|
||||
for (wxArtProvidersList::compatibility_iterator node = sm_providers->GetFirst();
|
||||
node; node = node->GetNext())
|
||||
for (const auto& provider : *sm_providers)
|
||||
{
|
||||
wxArtProvider* const provider = node->GetData();
|
||||
bmp = provider->CreateBitmap(id, client, size);
|
||||
if ( bmp.IsOk() )
|
||||
break;
|
||||
|
|
@ -481,10 +483,8 @@ wxBitmapBundle wxArtProvider::GetBitmapBundle(const wxArtID& id,
|
|||
|
||||
if ( !sm_cache->GetBitmapBundle(hashId, &bitmapbundle) )
|
||||
{
|
||||
for (wxArtProvidersList::compatibility_iterator node = sm_providers->GetFirst();
|
||||
node; node = node->GetNext())
|
||||
for (const auto& provider : *sm_providers)
|
||||
{
|
||||
wxArtProvider* const provider = node->GetData();
|
||||
bitmapbundle = provider->CreateBitmapBundle(id, client, size);
|
||||
if ( bitmapbundle.IsOk() )
|
||||
break;
|
||||
|
|
@ -546,10 +546,9 @@ wxIconBundle wxArtProvider::DoGetIconBundle(const wxArtID& id, const wxArtClient
|
|||
wxIconBundle iconbundle;
|
||||
if ( !sm_cache->GetIconBundle(hashId, &iconbundle) )
|
||||
{
|
||||
for (wxArtProvidersList::compatibility_iterator node = sm_providers->GetFirst();
|
||||
node; node = node->GetNext())
|
||||
for (const auto& provider : *sm_providers)
|
||||
{
|
||||
iconbundle = node->GetData()->CreateIconBundle(id, client);
|
||||
iconbundle = provider->CreateIconBundle(id, client);
|
||||
if ( iconbundle.IsOk() )
|
||||
break;
|
||||
}
|
||||
|
|
@ -607,9 +606,8 @@ wxArtID wxArtProvider::GetMessageBoxIconId(int flags)
|
|||
|
||||
/*static*/ wxSize wxArtProvider::GetDIPSizeHint(const wxArtClient& client)
|
||||
{
|
||||
wxArtProvidersList::compatibility_iterator node = sm_providers->GetFirst();
|
||||
if (node)
|
||||
return node->GetData()->DoGetSizeHint(client);
|
||||
if ( !sm_providers->empty() )
|
||||
return sm_providers->front()->DoGetSizeHint(client);
|
||||
|
||||
return GetNativeDIPSizeHint(client);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -182,10 +182,9 @@ bool wxCalendarCtrlBase::SetHolidayAttrs()
|
|||
wxDateTimeArray hol;
|
||||
wxDateTimeHolidayAuthority::GetHolidaysInRange(dtStart, dtEnd, hol);
|
||||
|
||||
const size_t count = hol.GetCount();
|
||||
for ( size_t n = 0; n < count; n++ )
|
||||
for ( const auto dt : hol )
|
||||
{
|
||||
SetHoliday(hol[n].GetDay());
|
||||
SetHoliday(dt.GetDay());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -178,16 +178,6 @@ struct wxCmdLineParam
|
|||
int flags;
|
||||
};
|
||||
|
||||
WX_DECLARE_OBJARRAY(wxCmdLineOption, wxArrayOptions);
|
||||
WX_DECLARE_OBJARRAY(wxCmdLineParam, wxArrayParams);
|
||||
WX_DECLARE_OBJARRAY(wxCmdLineArgImpl, wxArrayArgs);
|
||||
|
||||
#include "wx/arrimpl.cpp"
|
||||
|
||||
WX_DEFINE_OBJARRAY(wxArrayOptions)
|
||||
WX_DEFINE_OBJARRAY(wxArrayParams)
|
||||
WX_DEFINE_OBJARRAY(wxArrayArgs)
|
||||
|
||||
// the parser internal state
|
||||
struct wxCmdLineParserData
|
||||
{
|
||||
|
|
@ -197,11 +187,11 @@ struct wxCmdLineParserData
|
|||
wxString m_logo; // some extra text to show in Usage()
|
||||
|
||||
// cmd line data
|
||||
wxArrayString m_arguments; // == argv, argc == m_arguments.GetCount()
|
||||
wxArrayOptions m_options; // all possible options and switches
|
||||
wxArrayParams m_paramDesc; // description of all possible params
|
||||
wxArrayString m_arguments; // == argv, argc == m_arguments.size()
|
||||
std::vector<wxCmdLineOption> m_options; // all possible options and switches
|
||||
std::vector<wxCmdLineParam> m_paramDesc; // description of all possible params
|
||||
wxArrayString m_parameters; // all params found
|
||||
wxArrayArgs m_parsedArguments; // all options and parameters in parsing order
|
||||
std::vector<wxCmdLineArgImpl> m_parsedArguments; // all options and parameters in parsing order
|
||||
|
||||
// methods
|
||||
wxCmdLineParserData();
|
||||
|
|
@ -339,7 +329,7 @@ wxCmdLineArgImpl& wxCmdLineArgImpl::SetDateVal(const wxDateTime& val)
|
|||
|
||||
size_t wxCmdLineArgs::size() const
|
||||
{
|
||||
return m_parser.m_data->m_parsedArguments.GetCount();
|
||||
return m_parser.m_data->m_parsedArguments.size();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
|
@ -475,7 +465,7 @@ int wxCmdLineParserData::FindOption(const wxString& name)
|
|||
{
|
||||
if ( !name.empty() )
|
||||
{
|
||||
size_t count = m_options.GetCount();
|
||||
size_t count = m_options.size();
|
||||
for ( size_t n = 0; n < count; n++ )
|
||||
{
|
||||
if ( m_options[n].shortName == name )
|
||||
|
|
@ -491,7 +481,7 @@ int wxCmdLineParserData::FindOption(const wxString& name)
|
|||
|
||||
int wxCmdLineParserData::FindOptionByLongName(const wxString& name)
|
||||
{
|
||||
size_t count = m_options.GetCount();
|
||||
size_t count = m_options.size();
|
||||
for ( size_t n = 0; n < count; n++ )
|
||||
{
|
||||
if ( m_options[n].longName == name )
|
||||
|
|
@ -629,11 +619,9 @@ void wxCmdLineParser::AddSwitch(const wxString& shortName,
|
|||
wxASSERT_MSG( m_data->FindOption(shortName) == wxNOT_FOUND,
|
||||
wxT("duplicate switch") );
|
||||
|
||||
wxCmdLineOption *option = new wxCmdLineOption(wxCMD_LINE_SWITCH,
|
||||
shortName, longName, desc,
|
||||
wxCMD_LINE_VAL_NONE, flags);
|
||||
|
||||
m_data->m_options.Add(option);
|
||||
m_data->m_options.emplace_back(wxCMD_LINE_SWITCH,
|
||||
shortName, longName, desc,
|
||||
wxCMD_LINE_VAL_NONE, flags);
|
||||
}
|
||||
|
||||
void wxCmdLineParser::AddOption(const wxString& shortName,
|
||||
|
|
@ -645,11 +633,9 @@ void wxCmdLineParser::AddOption(const wxString& shortName,
|
|||
wxASSERT_MSG( m_data->FindOption(shortName) == wxNOT_FOUND,
|
||||
wxT("duplicate option") );
|
||||
|
||||
wxCmdLineOption *option = new wxCmdLineOption(wxCMD_LINE_OPTION,
|
||||
shortName, longName, desc,
|
||||
type, flags);
|
||||
|
||||
m_data->m_options.Add(option);
|
||||
m_data->m_options.emplace_back(wxCMD_LINE_OPTION,
|
||||
shortName, longName, desc,
|
||||
type, flags);
|
||||
}
|
||||
|
||||
void wxCmdLineParser::AddParam(const wxString& desc,
|
||||
|
|
@ -659,9 +645,9 @@ void wxCmdLineParser::AddParam(const wxString& desc,
|
|||
// do some consistency checks: a required parameter can't follow an
|
||||
// optional one and nothing should follow a parameter with MULTIPLE flag
|
||||
#if wxDEBUG_LEVEL
|
||||
if ( !m_data->m_paramDesc.IsEmpty() )
|
||||
if ( !m_data->m_paramDesc.empty() )
|
||||
{
|
||||
wxCmdLineParam& param = m_data->m_paramDesc.Last();
|
||||
wxCmdLineParam& param = *m_data->m_paramDesc.rbegin();
|
||||
|
||||
wxASSERT_MSG( !(param.flags & wxCMD_LINE_PARAM_MULTIPLE),
|
||||
wxT("all parameters after the one with wxCMD_LINE_PARAM_MULTIPLE style will be ignored") );
|
||||
|
|
@ -674,20 +660,16 @@ void wxCmdLineParser::AddParam(const wxString& desc,
|
|||
}
|
||||
#endif // wxDEBUG_LEVEL
|
||||
|
||||
wxCmdLineParam *param = new wxCmdLineParam(desc, type, flags);
|
||||
|
||||
m_data->m_paramDesc.Add(param);
|
||||
m_data->m_paramDesc.emplace_back(desc, type, flags);
|
||||
}
|
||||
|
||||
void wxCmdLineParser::AddUsageText(const wxString& text)
|
||||
{
|
||||
wxASSERT_MSG( !text.empty(), wxT("text can't be empty") );
|
||||
|
||||
wxCmdLineOption *option = new wxCmdLineOption(wxCMD_LINE_USAGE_TEXT,
|
||||
wxEmptyString, wxEmptyString,
|
||||
text, wxCMD_LINE_VAL_NONE, 0);
|
||||
|
||||
m_data->m_options.Add(option);
|
||||
m_data->m_options.emplace_back(wxCMD_LINE_USAGE_TEXT,
|
||||
wxEmptyString, wxEmptyString,
|
||||
text, wxCMD_LINE_VAL_NONE, 0);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
|
@ -784,12 +766,12 @@ wxString wxCmdLineParser::GetParam(size_t n) const
|
|||
// Resets switches and options
|
||||
void wxCmdLineParser::Reset()
|
||||
{
|
||||
for ( size_t i = 0; i < m_data->m_options.GetCount(); i++ )
|
||||
for ( auto& opt : m_data->m_options )
|
||||
{
|
||||
m_data->m_options[i].Reset();
|
||||
opt.Reset();
|
||||
}
|
||||
|
||||
m_data->m_parsedArguments.Empty();
|
||||
m_data->m_parsedArguments.clear();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -806,7 +788,7 @@ int wxCmdLineParser::Parse(bool showUsage)
|
|||
|
||||
size_t currentParam = 0; // the index in m_paramDesc
|
||||
|
||||
size_t countParam = m_data->m_paramDesc.GetCount();
|
||||
size_t countParam = m_data->m_paramDesc.size();
|
||||
wxString errorMsg;
|
||||
|
||||
Reset();
|
||||
|
|
@ -1188,7 +1170,7 @@ int wxCmdLineParser::Parse(bool showUsage)
|
|||
// verify that all mandatory options were given
|
||||
if ( ok )
|
||||
{
|
||||
size_t countOpt = m_data->m_options.GetCount();
|
||||
size_t countOpt = m_data->m_options.size();
|
||||
for ( size_t n = 0; ok && (n < countOpt); n++ )
|
||||
{
|
||||
wxCmdLineOption& opt = m_data->m_options[n];
|
||||
|
|
@ -1316,7 +1298,7 @@ wxString wxCmdLineParser::GetUsageString() const
|
|||
: m_data->m_switchChars[0u];
|
||||
|
||||
bool areLongOptionsEnabled = AreLongOptionsEnabled();
|
||||
size_t n, count = m_data->m_options.GetCount();
|
||||
size_t n, count = m_data->m_options.size();
|
||||
for ( n = 0; n < count; n++ )
|
||||
{
|
||||
wxCmdLineOption& opt = m_data->m_options[n];
|
||||
|
|
@ -1386,7 +1368,7 @@ wxString wxCmdLineParser::GetUsageString() const
|
|||
descOptions.push_back(opt.description);
|
||||
}
|
||||
|
||||
count = m_data->m_paramDesc.GetCount();
|
||||
count = m_data->m_paramDesc.size();
|
||||
for ( n = 0; n < count; n++ )
|
||||
{
|
||||
wxCmdLineParam& param = m_data->m_paramDesc[n];
|
||||
|
|
|
|||
|
|
@ -2174,16 +2174,9 @@ void wxDateTime::UseEffectiveWeekDayFlags(WeekFlags &flags) const
|
|||
// wxDateTimeHolidayAuthority and related classes
|
||||
// ============================================================================
|
||||
|
||||
#include "wx/arrimpl.cpp"
|
||||
|
||||
WX_DEFINE_OBJARRAY(wxDateTimeArray)
|
||||
|
||||
static int wxCMPFUNC_CONV
|
||||
wxDateTimeCompareFunc(wxDateTime **first, wxDateTime **second)
|
||||
wxDateTimeCompareFunc(wxDateTime dt1, wxDateTime dt2)
|
||||
{
|
||||
wxDateTime dt1 = **first,
|
||||
dt2 = **second;
|
||||
|
||||
return dt1 == dt2 ? 0 : dt1 < dt2 ? -1 : +1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,14 +23,6 @@
|
|||
#include "wx/mstream.h"
|
||||
#include "wx/textbuf.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// lists
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "wx/listimpl.cpp"
|
||||
|
||||
WX_DEFINE_LIST(wxSimpleDataObjectList)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// globals
|
||||
// ----------------------------------------------------------------------------
|
||||
|
|
@ -87,23 +79,15 @@ wxDataObjectComposite::wxDataObjectComposite()
|
|||
m_receivedFormat = wxFormatInvalid;
|
||||
}
|
||||
|
||||
wxDataObjectComposite::~wxDataObjectComposite()
|
||||
{
|
||||
WX_CLEAR_LIST( wxSimpleDataObjectList, m_dataObjects );
|
||||
}
|
||||
wxDataObjectComposite::~wxDataObjectComposite() = default;
|
||||
|
||||
wxDataObjectSimple *
|
||||
wxDataObjectComposite::GetObject(const wxDataFormat& format, wxDataObjectBase::Direction dir) const
|
||||
{
|
||||
wxSimpleDataObjectList::compatibility_iterator node = m_dataObjects.GetFirst();
|
||||
|
||||
while ( node )
|
||||
for ( const auto& dataObj : m_dataObjects )
|
||||
{
|
||||
wxDataObjectSimple *dataObj = node->GetData();
|
||||
|
||||
if (dataObj->IsSupported(format,dir))
|
||||
return dataObj;
|
||||
node = node->GetNext();
|
||||
return dataObj.get();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
|
@ -111,9 +95,9 @@ wxDataObjectComposite::GetObject(const wxDataFormat& format, wxDataObjectBase::D
|
|||
void wxDataObjectComposite::Add(wxDataObjectSimple *dataObject, bool preferred)
|
||||
{
|
||||
if ( preferred )
|
||||
m_preferred = m_dataObjects.GetCount();
|
||||
m_preferred = m_dataObjects.size();
|
||||
|
||||
m_dataObjects.Append( dataObject );
|
||||
m_dataObjects.push_back(std::unique_ptr<wxDataObjectSimple>(dataObject));
|
||||
}
|
||||
|
||||
wxDataFormat wxDataObjectComposite::GetReceivedFormat() const
|
||||
|
|
@ -124,13 +108,10 @@ wxDataFormat wxDataObjectComposite::GetReceivedFormat() const
|
|||
wxDataFormat
|
||||
wxDataObjectComposite::GetPreferredFormat(Direction WXUNUSED(dir)) const
|
||||
{
|
||||
wxSimpleDataObjectList::compatibility_iterator node = m_dataObjects.Item( m_preferred );
|
||||
wxCHECK_MSG( m_preferred < m_dataObjects.size(), wxFormatInvalid,
|
||||
wxT("no preferred format") );
|
||||
|
||||
wxCHECK_MSG( node, wxFormatInvalid, wxT("no preferred format") );
|
||||
|
||||
wxDataObjectSimple* dataObj = node->GetData();
|
||||
|
||||
return dataObj->GetFormat();
|
||||
return m_dataObjects[m_preferred]->GetFormat();
|
||||
}
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
|
|
@ -179,9 +160,8 @@ size_t wxDataObjectComposite::GetFormatCount(Direction dir) const
|
|||
// NOTE: some wxDataObjectSimple objects may return a number greater than 1
|
||||
// from GetFormatCount(): this is the case of e.g. wxTextDataObject
|
||||
// under wxMac and wxGTK
|
||||
wxSimpleDataObjectList::compatibility_iterator node;
|
||||
for ( node = m_dataObjects.GetFirst(); node; node = node->GetNext() )
|
||||
n += node->GetData()->GetFormatCount(dir);
|
||||
for ( const auto& dataObj : m_dataObjects )
|
||||
n += dataObj->GetFormatCount(dir);
|
||||
|
||||
return n;
|
||||
}
|
||||
|
|
@ -190,15 +170,14 @@ void wxDataObjectComposite::GetAllFormats(wxDataFormat *formats,
|
|||
Direction dir) const
|
||||
{
|
||||
size_t index(0);
|
||||
wxSimpleDataObjectList::compatibility_iterator node;
|
||||
|
||||
for ( node = m_dataObjects.GetFirst(); node; node = node->GetNext() )
|
||||
for ( const auto& dataObj : m_dataObjects )
|
||||
{
|
||||
// NOTE: some wxDataObjectSimple objects may return more than 1 format
|
||||
// from GetAllFormats(): this is the case of e.g. wxTextDataObject
|
||||
// under wxMac and wxGTK
|
||||
node->GetData()->GetAllFormats(formats+index, dir);
|
||||
index += node->GetData()->GetFormatCount(dir);
|
||||
dataObj->GetAllFormats(formats+index, dir);
|
||||
index += dataObj->GetFormatCount(dir);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -153,10 +153,9 @@ bool wxDocument::CanClose()
|
|||
// When the parent document closes, its children must be closed as well as
|
||||
// they can't exist without the parent, so ask them too.
|
||||
|
||||
DocsList::const_iterator it = m_childDocuments.begin();
|
||||
for ( DocsList::const_iterator end = m_childDocuments.end(); it != end; ++it )
|
||||
for ( auto& childDoc : m_childDocuments )
|
||||
{
|
||||
if ( !(*it)->OnSaveModified() )
|
||||
if ( !childDoc->OnSaveModified() )
|
||||
{
|
||||
// Leave the parent document opened if a child can't close.
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -32,9 +32,6 @@
|
|||
|
||||
#if wxUSE_DISPLAY
|
||||
|
||||
#include "wx/arrimpl.cpp"
|
||||
WX_DEFINE_OBJARRAY(wxArrayVideoModes)
|
||||
|
||||
const wxVideoMode wxDefaultVideoMode;
|
||||
|
||||
#endif // wxUSE_DISPLAY
|
||||
|
|
|
|||
|
|
@ -38,10 +38,6 @@
|
|||
#include "wx/filename.h" // for SplitPath()
|
||||
#include "wx/platinfo.h"
|
||||
|
||||
#include "wx/arrimpl.cpp"
|
||||
|
||||
WX_DEFINE_USER_EXPORTED_OBJARRAY(wxDynamicLibraryDetailsArray)
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@
|
|||
#ifndef WX_PRECOMP
|
||||
#include "wx/log.h"
|
||||
#include "wx/intl.h"
|
||||
#include "wx/hash.h"
|
||||
#include "wx/utils.h"
|
||||
#include "wx/module.h"
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -33,9 +33,6 @@
|
|||
#include "wx/private/icondir.h"
|
||||
#endif
|
||||
|
||||
#include "wx/arrimpl.cpp"
|
||||
WX_DEFINE_OBJARRAY(wxIconArray)
|
||||
|
||||
wxIMPLEMENT_DYNAMIC_CLASS(wxIconBundle, wxGDIObject);
|
||||
|
||||
#define M_ICONBUNDLEDATA static_cast<wxIconBundleRefData*>(m_refData)
|
||||
|
|
@ -61,7 +58,7 @@ public:
|
|||
|
||||
virtual bool IsOk() const override { return !m_icons.empty(); }
|
||||
|
||||
wxIconArray m_icons;
|
||||
std::vector<wxIcon> m_icons;
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
|
|
@ -298,12 +295,8 @@ wxIcon wxIconBundle::GetIcon(const wxSize& size, int flags) const
|
|||
bool bestIsLarger = false;
|
||||
bool bestIsSystem = false;
|
||||
|
||||
const size_t count = GetIconCount();
|
||||
|
||||
const wxIconArray& iconArray = M_ICONBUNDLEDATA->m_icons;
|
||||
for ( size_t i = 0; i < count; i++ )
|
||||
for ( const wxIcon& icon : M_ICONBUNDLEDATA->m_icons )
|
||||
{
|
||||
const wxIcon& icon = iconArray[i];
|
||||
if ( !icon.IsOk() )
|
||||
continue;
|
||||
wxCoord sx = icon.GetWidth(),
|
||||
|
|
@ -361,13 +354,9 @@ void wxIconBundle::AddIcon(const wxIcon& icon)
|
|||
|
||||
AllocExclusive();
|
||||
|
||||
wxIconArray& iconArray = M_ICONBUNDLEDATA->m_icons;
|
||||
|
||||
// replace existing icon with the same size if we already have it
|
||||
const size_t count = iconArray.size();
|
||||
for ( size_t i = 0; i < count; ++i )
|
||||
for ( wxIcon& tmp : M_ICONBUNDLEDATA->m_icons )
|
||||
{
|
||||
wxIcon& tmp = iconArray[i];
|
||||
if ( tmp.IsOk() &&
|
||||
tmp.GetWidth() == icon.GetWidth() &&
|
||||
tmp.GetHeight() == icon.GetHeight() )
|
||||
|
|
@ -378,7 +367,7 @@ void wxIconBundle::AddIcon(const wxIcon& icon)
|
|||
}
|
||||
|
||||
// if we don't, add an icon with new size
|
||||
iconArray.Add(icon);
|
||||
M_ICONBUNDLEDATA->m_icons.push_back(icon);
|
||||
}
|
||||
|
||||
size_t wxIconBundle::GetIconCount() const
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/log.h"
|
||||
#include "wx/hash.h"
|
||||
#include "wx/utils.h"
|
||||
#include "wx/math.h"
|
||||
#include "wx/module.h"
|
||||
|
|
@ -31,6 +30,8 @@
|
|||
// For memcpy
|
||||
#include <string.h>
|
||||
|
||||
#include <unordered_set>
|
||||
|
||||
// make the code compile with either wxFile*Stream or wxFFile*Stream:
|
||||
#define HAS_FILE_STREAMS (wxUSE_STREAMS && (wxUSE_FILE || wxUSE_FFILE))
|
||||
|
||||
|
|
@ -3509,8 +3510,8 @@ wxImage::FindFirstUnusedColour(unsigned char *r,
|
|||
//
|
||||
unsigned long wxImage::CountColours( unsigned long stopafter ) const
|
||||
{
|
||||
wxHashTable h;
|
||||
wxObject dummy;
|
||||
std::unordered_set<unsigned long> h;
|
||||
|
||||
unsigned char *p;
|
||||
unsigned long size, nentries;
|
||||
|
||||
|
|
@ -3527,9 +3528,8 @@ unsigned long wxImage::CountColours( unsigned long stopafter ) const
|
|||
b = *(p++);
|
||||
key = wxImageHistogram::MakeKey(r, g, b);
|
||||
|
||||
if (h.Get(key) == nullptr)
|
||||
if (h.insert(key).second)
|
||||
{
|
||||
h.Put(key, &dummy);
|
||||
nentries++;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@
|
|||
#include "wx/imaggif.h"
|
||||
#include "wx/gifdecod.h"
|
||||
#include "wx/stream.h"
|
||||
#include "wx/anidecod.h" // wxImageArray
|
||||
#include "wx/scopedarray.h"
|
||||
|
||||
#define GIF89_HDR "GIF89a"
|
||||
|
|
@ -275,7 +274,7 @@ bool wxGIFHandler::DoSaveFile(const wxImage& image, wxOutputStream *stream,
|
|||
return ok;
|
||||
}
|
||||
|
||||
bool wxGIFHandler::SaveAnimation(const wxImageArray& images,
|
||||
bool wxGIFHandler::SaveAnimation(const std::vector<wxImage>& images,
|
||||
wxOutputStream *stream, bool verbose, int delayMilliSecs)
|
||||
{
|
||||
#if wxUSE_PALETTE
|
||||
|
|
@ -283,9 +282,9 @@ bool wxGIFHandler::SaveAnimation(const wxImageArray& images,
|
|||
size_t i;
|
||||
|
||||
wxSize size(0,0);
|
||||
for (i = 0; (i < images.GetCount()) && ok; i++)
|
||||
for (i = 0; (i < images.size()) && ok; i++)
|
||||
{
|
||||
const wxImage& image = images.Item(i);
|
||||
const wxImage& image = images[i];
|
||||
wxSize temp(image.GetWidth(), image.GetHeight());
|
||||
ok = ok && image.HasPalette();
|
||||
if (i)
|
||||
|
|
@ -298,9 +297,9 @@ bool wxGIFHandler::SaveAnimation(const wxImageArray& images,
|
|||
}
|
||||
}
|
||||
|
||||
for (i = 0; (i < images.GetCount()) && ok; i++)
|
||||
for (i = 0; (i < images.size()) && ok; i++)
|
||||
{
|
||||
const wxImage& image = images.Item(i);
|
||||
const wxImage& image = images[i];
|
||||
|
||||
wxRGB pal[256];
|
||||
int palCount;
|
||||
|
|
|
|||
|
|
@ -15,11 +15,9 @@
|
|||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/object.h"
|
||||
#include "wx/list.h"
|
||||
#include "wx/log.h"
|
||||
#include "wx/intl.h"
|
||||
#include "wx/palette.h"
|
||||
#include "wx/hash.h"
|
||||
#include "wx/module.h"
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@
|
|||
#include "wx/log.h"
|
||||
#include "wx/utils.h"
|
||||
#include "wx/app.h"
|
||||
#include "wx/hashmap.h"
|
||||
#include "wx/module.h"
|
||||
#endif // WX_PRECOMP
|
||||
|
||||
|
|
@ -49,7 +48,6 @@
|
|||
#include "wx/scopedptr.h"
|
||||
#include "wx/apptrait.h"
|
||||
#include "wx/stdpaths.h"
|
||||
#include "wx/hashset.h"
|
||||
#include "wx/uilocale.h"
|
||||
|
||||
#include "wx/private/uilocale.h"
|
||||
|
|
|
|||
|
|
@ -28,18 +28,19 @@
|
|||
#include "wx/msw/private.h"
|
||||
#endif
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// default languages table & initialization
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// Hash maps to look up language script aliases from script names and vice versa
|
||||
#include "wx/hashmap.h"
|
||||
static wxStringToStringHashMap gs_scmap_name2alias;
|
||||
static wxStringToStringHashMap gs_scmap_alias2name;
|
||||
static std::unordered_map<wxString, wxString> gs_scmap_name2alias;
|
||||
static std::unordered_map<wxString, wxString> gs_scmap_alias2name;
|
||||
|
||||
/* static */ wxString wxUILocale::GetScriptAliasFromName(const wxString& scriptName)
|
||||
{
|
||||
wxStringToStringHashMap::iterator scIter = gs_scmap_name2alias.find(scriptName);
|
||||
const auto scIter = gs_scmap_name2alias.find(scriptName);
|
||||
if (scIter != gs_scmap_name2alias.end())
|
||||
return scIter->second;
|
||||
else
|
||||
|
|
@ -48,7 +49,7 @@ static wxStringToStringHashMap gs_scmap_alias2name;
|
|||
|
||||
/* static */ wxString wxUILocale::GetScriptNameFromAlias(const wxString& scriptAlias)
|
||||
{
|
||||
wxStringToStringHashMap::iterator scIter = gs_scmap_alias2name.find(scriptAlias);
|
||||
const auto scIter = gs_scmap_alias2name.find(scriptAlias);
|
||||
if (scIter != gs_scmap_alias2name.end())
|
||||
return scIter->second;
|
||||
else
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@
|
|||
#if wxUSE_MEDIACTRL
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/hash.h"
|
||||
#include "wx/log.h"
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -116,9 +116,6 @@ wxFileTypeInfo::wxFileTypeInfo(const wxArrayString& sArray)
|
|||
}
|
||||
}
|
||||
|
||||
#include "wx/arrimpl.cpp"
|
||||
WX_DEFINE_OBJARRAY(wxArrayFileTypeInfo)
|
||||
|
||||
// ============================================================================
|
||||
// implementation of the wrapper classes
|
||||
// ============================================================================
|
||||
|
|
@ -587,10 +584,9 @@ wxMimeTypesManager::GetFileTypeFromExtension(const wxString& ext)
|
|||
//
|
||||
// TODO linear search is potentially slow, perhaps we should use a
|
||||
// sorted array?
|
||||
size_t count = m_fallbacks.GetCount();
|
||||
for ( size_t n = 0; n < count; n++ ) {
|
||||
if ( m_fallbacks[n].GetExtensions().Index(ext) != wxNOT_FOUND ) {
|
||||
ft = new wxFileType(m_fallbacks[n]);
|
||||
for ( const auto& fallback : m_fallbacks ) {
|
||||
if ( fallback.GetExtensions().Index(ext) != wxNOT_FOUND ) {
|
||||
ft = new wxFileType(fallback);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -611,11 +607,10 @@ wxMimeTypesManager::GetFileTypeFromMimeType(const wxString& mimeType)
|
|||
//
|
||||
// TODO linear search is potentially slow, perhaps we should use a
|
||||
// sorted array?
|
||||
size_t count = m_fallbacks.GetCount();
|
||||
for ( size_t n = 0; n < count; n++ ) {
|
||||
for ( const auto& fallback : m_fallbacks ) {
|
||||
if ( wxMimeTypesManager::IsOfType(mimeType,
|
||||
m_fallbacks[n].GetMimeType()) ) {
|
||||
ft = new wxFileType(m_fallbacks[n]);
|
||||
fallback.GetMimeType()) ) {
|
||||
ft = new wxFileType(fallback);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -639,10 +634,9 @@ size_t wxMimeTypesManager::EnumAllFileTypes(wxArrayString& mimetypes)
|
|||
size_t countAll = m_impl->EnumAllFileTypes(mimetypes);
|
||||
|
||||
// add the fallback filetypes
|
||||
size_t count = m_fallbacks.GetCount();
|
||||
for ( size_t n = 0; n < count; n++ ) {
|
||||
if ( mimetypes.Index(m_fallbacks[n].GetMimeType()) == wxNOT_FOUND ) {
|
||||
mimetypes.Add(m_fallbacks[n].GetMimeType());
|
||||
for ( const auto& fallback : m_fallbacks ) {
|
||||
if ( mimetypes.Index(fallback.GetMimeType()) == wxNOT_FOUND ) {
|
||||
mimetypes.Add(fallback.GetMimeType());
|
||||
countAll++;
|
||||
}
|
||||
}
|
||||
|
|
@ -696,7 +690,7 @@ public:
|
|||
if ( gs_mimeTypesManager.m_impl != nullptr )
|
||||
{
|
||||
wxDELETE(gs_mimeTypesManager.m_impl);
|
||||
gs_mimeTypesManager.m_fallbacks.Clear();
|
||||
gs_mimeTypesManager.m_fallbacks.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@
|
|||
#include "wx/module.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/hash.h"
|
||||
#include "wx/intl.h"
|
||||
#include "wx/log.h"
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -16,10 +16,8 @@
|
|||
|
||||
#ifndef WX_PRECOMP
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/wrapcdlg.h"
|
||||
#include "wx/msw/wrapwin.h" // for DMPAPER_XXX constants
|
||||
#endif // MSW
|
||||
#include "wx/utils.h"
|
||||
#include "wx/settings.h"
|
||||
#include "wx/intl.h"
|
||||
#include "wx/module.h"
|
||||
#endif
|
||||
|
|
@ -29,15 +27,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef __WXMSW__
|
||||
#ifndef __WIN32__
|
||||
#include <print.h>
|
||||
#endif
|
||||
#endif
|
||||
// End __WXMSW__
|
||||
|
||||
wxIMPLEMENT_DYNAMIC_CLASS(wxPrintPaperType, wxObject);
|
||||
// wxIMPLEMENT_DYNAMIC_CLASS(wxPrintPaperDatabase, wxList);
|
||||
|
||||
/*
|
||||
* Paper size database for all platforms
|
||||
|
|
@ -70,22 +60,11 @@ wxSize wxPrintPaperType::GetSizeDeviceUnits() const
|
|||
* Print paper database for PostScript
|
||||
*/
|
||||
|
||||
WX_DECLARE_LIST(wxPrintPaperType, wxPrintPaperTypeList);
|
||||
#include "wx/listimpl.cpp"
|
||||
WX_DEFINE_LIST(wxPrintPaperTypeList)
|
||||
|
||||
wxPrintPaperDatabase* wxThePrintPaperDatabase = nullptr;
|
||||
|
||||
wxPrintPaperDatabase::wxPrintPaperDatabase()
|
||||
{
|
||||
m_map = new wxStringToPrintPaperTypeHashMap;
|
||||
m_list = new wxPrintPaperTypeList;
|
||||
}
|
||||
wxPrintPaperDatabase::wxPrintPaperDatabase() = default;
|
||||
|
||||
wxPrintPaperDatabase::~wxPrintPaperDatabase()
|
||||
{
|
||||
ClearDatabase();
|
||||
}
|
||||
wxPrintPaperDatabase::~wxPrintPaperDatabase() = default;
|
||||
|
||||
void wxPrintPaperDatabase::CreateDatabase()
|
||||
{
|
||||
|
|
@ -217,43 +196,36 @@ void wxPrintPaperDatabase::CreateDatabase()
|
|||
|
||||
void wxPrintPaperDatabase::ClearDatabase()
|
||||
{
|
||||
delete m_list;
|
||||
WX_CLEAR_HASH_MAP(wxStringToPrintPaperTypeHashMap, *m_map);
|
||||
delete m_map;
|
||||
m_paperTypes.clear();
|
||||
}
|
||||
|
||||
void wxPrintPaperDatabase::AddPaperType(wxPaperSize paperId, const wxString& name, int w, int h)
|
||||
{
|
||||
wxPrintPaperType* tmp = new wxPrintPaperType(paperId, 0, name, w, h);
|
||||
(*m_map)[name] = tmp;
|
||||
m_list->push_back(tmp);
|
||||
m_paperTypes.emplace_back(paperId, 0, name, w, h);
|
||||
}
|
||||
|
||||
void wxPrintPaperDatabase::AddPaperType(wxPaperSize paperId, int platformId, const wxString& name, int w, int h)
|
||||
{
|
||||
wxPrintPaperType* tmp = new wxPrintPaperType(paperId, platformId, name, w, h);
|
||||
(*m_map)[name] = tmp;
|
||||
m_list->push_back(tmp);
|
||||
m_paperTypes.emplace_back(paperId, platformId, name, w, h);
|
||||
}
|
||||
|
||||
wxPrintPaperType *wxPrintPaperDatabase::FindPaperType(const wxString& name) const
|
||||
{
|
||||
wxStringToPrintPaperTypeHashMap::iterator it = m_map->find(name);
|
||||
if (it != m_map->end())
|
||||
return it->second;
|
||||
else
|
||||
return nullptr;
|
||||
for (const auto& paperType : m_paperTypes)
|
||||
{
|
||||
if (paperType.GetName() == name)
|
||||
return AsNonConstPtr(paperType);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
wxPrintPaperType *wxPrintPaperDatabase::FindPaperType(wxPaperSize id) const
|
||||
{
|
||||
typedef wxStringToPrintPaperTypeHashMap::iterator iterator;
|
||||
|
||||
for (iterator it = m_map->begin(), en = m_map->end(); it != en; ++it)
|
||||
for (const auto& paperType : m_paperTypes)
|
||||
{
|
||||
wxPrintPaperType* paperType = it->second;
|
||||
if (paperType->GetId() == id)
|
||||
return paperType;
|
||||
if (paperType.GetId() == id)
|
||||
return AsNonConstPtr(paperType);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
|
|
@ -261,13 +233,10 @@ wxPrintPaperType *wxPrintPaperDatabase::FindPaperType(wxPaperSize id) const
|
|||
|
||||
wxPrintPaperType *wxPrintPaperDatabase::FindPaperTypeByPlatformId(int id) const
|
||||
{
|
||||
typedef wxStringToPrintPaperTypeHashMap::iterator iterator;
|
||||
|
||||
for (iterator it = m_map->begin(), en = m_map->end(); it != en; ++it)
|
||||
for (const auto& paperType : m_paperTypes)
|
||||
{
|
||||
wxPrintPaperType* paperType = it->second;
|
||||
if (paperType->GetPlatformId() == id)
|
||||
return paperType;
|
||||
if (paperType.GetPlatformId() == id)
|
||||
return AsNonConstPtr(paperType);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
|
|
@ -279,12 +248,11 @@ wxPrintPaperType *wxPrintPaperDatabase::FindPaperType(const wxSize& sz) const
|
|||
// are likely to be taken into account first. This fixes problems with,
|
||||
// for example, Letter reverting to A4 in the page setup dialog because
|
||||
// it was wrongly translated to Note.
|
||||
for ( size_t i = 0; i < GetCount(); i++ )
|
||||
for (const auto& paperType : m_paperTypes)
|
||||
{
|
||||
wxPrintPaperType* const paperType = Item(i);
|
||||
const wxSize paperSize = paperType->GetSize() ;
|
||||
const wxSize paperSize = paperType.GetSize() ;
|
||||
if ( abs(paperSize.x - sz.x) < 10 && abs(paperSize.y - sz.y) < 10 )
|
||||
return paperType;
|
||||
return AsNonConstPtr(paperType);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
|
|
@ -333,12 +301,15 @@ wxPaperSize wxPrintPaperDatabase::GetSize(const wxSize& size) const
|
|||
// QUICK and DIRTY
|
||||
size_t wxPrintPaperDatabase::GetCount() const
|
||||
{
|
||||
return m_list->GetCount();
|
||||
return m_paperTypes.size();
|
||||
}
|
||||
|
||||
wxPrintPaperType* wxPrintPaperDatabase::Item(size_t index) const
|
||||
{
|
||||
return m_list->Item(index)->GetData();
|
||||
if (index >= m_paperTypes.size())
|
||||
return nullptr;
|
||||
|
||||
return AsNonConstPtr(m_paperTypes[index]);
|
||||
}
|
||||
|
||||
// A module to allow initialization/cleanup of print paper
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@
|
|||
#include "wx/unix/private.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/hash.h"
|
||||
#include "wx/log.h"
|
||||
#include "wx/intl.h"
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -105,10 +105,6 @@ bool wxStatusBarPane::PopText()
|
|||
|
||||
wxIMPLEMENT_DYNAMIC_CLASS(wxStatusBar, wxWindow);
|
||||
|
||||
#include "wx/arrimpl.cpp" // This is a magic incantation which must be done!
|
||||
WX_DEFINE_EXPORTED_OBJARRAY(wxStatusBarPaneArray)
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ctor/dtor
|
||||
// ----------------------------------------------------------------------------
|
||||
|
|
@ -131,23 +127,25 @@ wxStatusBarBase::~wxStatusBarBase()
|
|||
// field widths
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void wxStatusBarBase::SetFieldsCount(int number, const int *widths)
|
||||
void wxStatusBarBase::SetFieldsCount(int numberInt, const int *widths)
|
||||
{
|
||||
wxCHECK_RET( number > 0, wxT("invalid field number in SetFieldsCount") );
|
||||
wxCHECK_RET( numberInt > 0, wxT("invalid field number in SetFieldsCount") );
|
||||
|
||||
if ( (size_t)number > m_panes.GetCount() )
|
||||
const auto number = static_cast<size_t>(numberInt); // cast is safe now
|
||||
|
||||
if ( number > m_panes.size() )
|
||||
{
|
||||
wxStatusBarPane newPane;
|
||||
|
||||
// add more entries with the default style and zero width
|
||||
// (this will be set later)
|
||||
for (size_t i = m_panes.GetCount(); i < (size_t)number; ++i)
|
||||
m_panes.Add(newPane);
|
||||
m_panes.insert(m_panes.end(), number - m_panes.size(), newPane);
|
||||
}
|
||||
else if ( (size_t)number < m_panes.GetCount() )
|
||||
else if ( number < m_panes.size() )
|
||||
{
|
||||
// remove entries in excess
|
||||
m_panes.RemoveAt(number, m_panes.GetCount()-number);
|
||||
const auto first = m_panes.begin() + number;
|
||||
m_panes.erase(first, first + (m_panes.size() - number));
|
||||
}
|
||||
|
||||
// SetStatusWidths will automatically refresh
|
||||
|
|
@ -157,7 +155,7 @@ void wxStatusBarBase::SetFieldsCount(int number, const int *widths)
|
|||
void wxStatusBarBase::SetStatusWidths(int WXUNUSED_UNLESS_DEBUG(n),
|
||||
const int widths[])
|
||||
{
|
||||
wxASSERT_MSG( (size_t)n == m_panes.GetCount(), wxT("field number mismatch") );
|
||||
wxASSERT_MSG( (size_t)n == m_panes.size(), wxT("field number mismatch") );
|
||||
|
||||
if (widths == nullptr)
|
||||
{
|
||||
|
|
@ -167,8 +165,8 @@ void wxStatusBarBase::SetStatusWidths(int WXUNUSED_UNLESS_DEBUG(n),
|
|||
}
|
||||
else
|
||||
{
|
||||
for ( size_t i = 0; i < m_panes.GetCount(); i++ )
|
||||
m_panes[i].SetWidth(widths[i]);
|
||||
for ( auto& pane : m_panes )
|
||||
pane.SetWidth(*widths++);
|
||||
|
||||
m_bSameWidthForAllPanes = false;
|
||||
}
|
||||
|
|
@ -182,10 +180,10 @@ void wxStatusBarBase::SetStatusStyles(int WXUNUSED_UNLESS_DEBUG(n),
|
|||
{
|
||||
wxCHECK_RET( styles, wxT("null pointer in SetStatusStyles") );
|
||||
|
||||
wxASSERT_MSG( (size_t)n == m_panes.GetCount(), wxT("field number mismatch") );
|
||||
wxASSERT_MSG( (size_t)n == m_panes.size(), wxT("field number mismatch") );
|
||||
|
||||
for ( size_t i = 0; i < m_panes.GetCount(); i++ )
|
||||
m_panes[i].SetStyle(styles[i]);
|
||||
for ( auto& pane : m_panes )
|
||||
pane.SetStyle(*styles++);
|
||||
|
||||
// update the display after the widths changed
|
||||
Refresh();
|
||||
|
|
@ -199,11 +197,11 @@ wxArrayInt wxStatusBarBase::CalculateAbsWidths(wxCoord widthTotal) const
|
|||
{
|
||||
// Default: all fields have the same width. This is not always
|
||||
// possible to do exactly (if widthTotal is not divisible by
|
||||
// m_panes.GetCount()) - if that happens, we distribute the extra
|
||||
// m_panes.size()) - if that happens, we distribute the extra
|
||||
// pixels among all fields:
|
||||
int widthToUse = widthTotal;
|
||||
|
||||
for ( size_t i = m_panes.GetCount(); i > 0; i-- )
|
||||
for ( size_t i = m_panes.size(); i > 0; i-- )
|
||||
{
|
||||
// divide the unassigned width evently between the
|
||||
// not yet processed fields:
|
||||
|
|
@ -217,29 +215,28 @@ wxArrayInt wxStatusBarBase::CalculateAbsWidths(wxCoord widthTotal) const
|
|||
// calculate the total width of all the fixed width fields and the
|
||||
// total number of var field widths counting with multiplicity
|
||||
size_t nTotalWidth = 0,
|
||||
nVarCount = 0,
|
||||
i;
|
||||
nVarCount = 0;
|
||||
|
||||
for ( i = 0; i < m_panes.GetCount(); i++ )
|
||||
for ( const auto& pane : m_panes )
|
||||
{
|
||||
if ( m_panes[i].GetWidth() >= 0 )
|
||||
nTotalWidth += m_panes[i].GetWidth();
|
||||
if ( pane.GetWidth() >= 0 )
|
||||
nTotalWidth += pane.GetWidth();
|
||||
else
|
||||
nVarCount += -m_panes[i].GetWidth();
|
||||
nVarCount += -pane.GetWidth();
|
||||
}
|
||||
|
||||
// the amount of extra width we have per each var width field
|
||||
int widthExtra = widthTotal - nTotalWidth;
|
||||
|
||||
// do fill the array
|
||||
for ( i = 0; i < m_panes.GetCount(); i++ )
|
||||
for ( const auto& pane : m_panes )
|
||||
{
|
||||
if ( m_panes[i].GetWidth() >= 0 )
|
||||
widths.Add(m_panes[i].GetWidth());
|
||||
if ( pane.GetWidth() >= 0 )
|
||||
widths.Add(pane.GetWidth());
|
||||
else
|
||||
{
|
||||
int nVarWidth = widthExtra > 0 ? (widthExtra * (-m_panes[i].GetWidth())) / nVarCount : 0;
|
||||
nVarCount += m_panes[i].GetWidth();
|
||||
int nVarWidth = widthExtra > 0 ? (widthExtra * (-pane.GetWidth())) / nVarCount : 0;
|
||||
nVarCount += pane.GetWidth();
|
||||
widthExtra -= nVarWidth;
|
||||
widths.Add(nVarWidth);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
#include "wx/intl.h"
|
||||
#include "wx/log.h"
|
||||
#include "wx/utils.h"
|
||||
#include "wx/hashmap.h"
|
||||
#endif
|
||||
|
||||
#include "wx/strconv.h"
|
||||
|
|
@ -49,6 +48,7 @@
|
|||
#include "wx/osx/core/private/strconv_cf.h"
|
||||
#endif //def __DARWIN__
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
#define TRACE_STRCONV wxT("strconv")
|
||||
|
||||
|
|
@ -2918,8 +2918,23 @@ void wxCSConv::SetName(const char *charset)
|
|||
|
||||
#if wxUSE_FONTMAP
|
||||
|
||||
WX_DECLARE_HASH_MAP( wxFontEncoding, wxString, wxIntegerHash, wxIntegerEqual,
|
||||
wxEncodingNameCache );
|
||||
// We need to define the hash for the enum pre-C++14.
|
||||
#if !wxCHECK_CXX_STD(201402L)
|
||||
|
||||
namespace std
|
||||
{
|
||||
template <>
|
||||
struct hash<wxFontEncoding>
|
||||
{
|
||||
size_t operator()(wxFontEncoding enc) const
|
||||
{
|
||||
return std::hash<int>()(enc);
|
||||
}
|
||||
};
|
||||
} // namespace std
|
||||
#endif // C++11
|
||||
|
||||
using wxEncodingNameCache = std::unordered_map<wxFontEncoding, wxString>;
|
||||
|
||||
static wxEncodingNameCache gs_nameCache;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@
|
|||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "wx/hashmap.h"
|
||||
#include "wx/uilocale.h"
|
||||
#include "wx/vector.h"
|
||||
#include "wx/xlocale.h"
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@
|
|||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/app.h"
|
||||
#include "wx/list.h"
|
||||
#include "wx/string.h"
|
||||
#include "wx/arrstr.h"
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@
|
|||
#include "wx/intl.h"
|
||||
#include "wx/log.h"
|
||||
#include "wx/utils.h"
|
||||
#include "wx/hashmap.h"
|
||||
#include "wx/module.h"
|
||||
#endif // WX_PRECOMP
|
||||
|
||||
|
|
@ -869,7 +868,7 @@ public:
|
|||
wxPluralFormsCalculatorPtr& rPluralFormsCalculator);
|
||||
|
||||
// fills the hash with string-translation pairs
|
||||
bool FillHash(wxStringToStringHashMap& hash, const wxString& domain) const;
|
||||
bool FillHash(wxTranslationsHashMap& hash, const wxString& domain) const;
|
||||
|
||||
// return the charset of the strings in this catalog or empty string if
|
||||
// none/unknown
|
||||
|
|
@ -1077,7 +1076,7 @@ bool wxMsgCatalogFile::LoadData(const DataBuffer& data,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool wxMsgCatalogFile::FillHash(wxStringToStringHashMap& hash,
|
||||
bool wxMsgCatalogFile::FillHash(wxTranslationsHashMap& hash,
|
||||
const wxString& domain) const
|
||||
{
|
||||
wxUnusedVar(domain); // silence warning in Unicode build
|
||||
|
|
@ -1195,7 +1194,7 @@ const wxString *wxMsgCatalog::GetString(const wxString& str, unsigned n, const w
|
|||
{
|
||||
index = m_pluralFormsCalculator->evaluate(n);
|
||||
}
|
||||
wxStringToStringHashMap::const_iterator i;
|
||||
wxTranslationsHashMap::const_iterator i;
|
||||
if (index != 0)
|
||||
{
|
||||
if (context.IsEmpty())
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
#include "wx/url.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/list.h"
|
||||
#include "wx/string.h"
|
||||
#include "wx/utils.h"
|
||||
#include "wx/module.h"
|
||||
|
|
|
|||
|
|
@ -27,11 +27,14 @@
|
|||
#include "wx/evtloop.h"
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
#include "wx/hashset.h"
|
||||
#include "wx/msw/wrapwin.h"
|
||||
|
||||
#include <unordered_set>
|
||||
#else
|
||||
#include "wx/evtloopsrc.h"
|
||||
#include "wx/evtloop.h"
|
||||
|
||||
#include <unordered_map>
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -528,7 +531,7 @@ private:
|
|||
WXLPARAM lParam);
|
||||
static const WXUINT SOCKET_MESSAGE;
|
||||
|
||||
WX_DECLARE_HASH_SET(curl_socket_t, wxIntegerHash, wxIntegerEqual, SocketSet);
|
||||
using SocketSet = std::unordered_set<curl_socket_t>;
|
||||
|
||||
SocketSet m_polledSockets;
|
||||
WXHWND m_hwnd;
|
||||
|
|
@ -761,8 +764,7 @@ public:
|
|||
void ResumePolling(curl_socket_t) override;
|
||||
|
||||
private:
|
||||
WX_DECLARE_HASH_MAP(curl_socket_t, wxEventLoopSource*, wxIntegerHash,\
|
||||
wxIntegerEqual, SocketDataMap);
|
||||
using SocketDataMap = std::unordered_map<curl_socket_t, wxEventLoopSource*>;
|
||||
|
||||
void CleanUpSocketSource(wxEventLoopSource*);
|
||||
|
||||
|
|
|
|||
|
|
@ -18,9 +18,12 @@
|
|||
#include "wx/intl.h"
|
||||
#endif //WX_PRECOMP
|
||||
|
||||
#include "wx/hashmap.h"
|
||||
#include "wx/windowid.h"
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
using wxWindowIDHashMap = std::unordered_map<wxWindowID, long>;
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
|
|
@ -46,7 +49,7 @@ wxUint8 gs_autoIdsRefCount[wxID_AUTO_HIGHEST - wxID_AUTO_LOWEST + 1] = { 0 };
|
|||
// freed. The cell storing the count for an ID is freed only when its count
|
||||
// gets to zero (not when it goes below ID_COUNTTOOLARGE, so as to avoid
|
||||
// degenerate cases)
|
||||
wxLongToLongHashMap *gs_autoIdsLargeRefCount = nullptr;
|
||||
wxWindowIDHashMap *gs_autoIdsLargeRefCount = nullptr;
|
||||
|
||||
// this is an optimization used until we wrap around wxID_AUTO_HIGHEST: if this
|
||||
// value is < wxID_AUTO_HIGHEST we know that we haven't wrapped yet and so can
|
||||
|
|
@ -106,7 +109,7 @@ void IncIdRefCount(wxWindowID winid)
|
|||
{
|
||||
// we need to allocate a cell, and maybe the hash map itself
|
||||
if (!gs_autoIdsLargeRefCount)
|
||||
gs_autoIdsLargeRefCount = new wxLongToLongHashMap;
|
||||
gs_autoIdsLargeRefCount = new wxWindowIDHashMap;
|
||||
(*gs_autoIdsLargeRefCount)[winid] = ID_COUNTTOOLARGE-1;
|
||||
|
||||
gs_autoIdsRefCount[winid] = ID_COUNTTOOLARGE;
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@
|
|||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/string.h"
|
||||
#include "wx/hash.h"
|
||||
#include "wx/utils.h" // for wxMin and wxMax
|
||||
#include "wx/log.h"
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/string.h"
|
||||
#include "wx/hash.h"
|
||||
#include "wx/utils.h" // for wxMin and wxMax
|
||||
#include "wx/log.h"
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -101,7 +101,6 @@ license is as follows:
|
|||
#include "wx/intl.h"
|
||||
#include "wx/log.h"
|
||||
#include "wx/utils.h"
|
||||
#include "wx/hashmap.h"
|
||||
#include "wx/stream.h"
|
||||
#include "wx/image.h"
|
||||
#include "wx/palette.h"
|
||||
|
|
@ -110,6 +109,8 @@ license is as follows:
|
|||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
#if wxUSE_STREAMS
|
||||
bool wxXPMDecoder::CanRead(wxInputStream& stream)
|
||||
{
|
||||
|
|
@ -650,7 +651,7 @@ struct wxXPMColourMapData
|
|||
wxXPMColourMapData() { R = G = B = 0; }
|
||||
unsigned char R,G,B;
|
||||
};
|
||||
WX_DECLARE_STRING_HASH_MAP(wxXPMColourMapData, wxXPMColourMap);
|
||||
using wxXPMColourMap = std::unordered_map<wxString, wxXPMColourMapData>;
|
||||
|
||||
wxImage wxXPMDecoder::ReadData(const char* const* xpm_data)
|
||||
{
|
||||
|
|
@ -736,7 +737,7 @@ wxImage wxXPMDecoder::ReadData(const char* const* xpm_data)
|
|||
// colour (which can be any colour not otherwise used in the image)
|
||||
if (!maskKey.empty())
|
||||
{
|
||||
wxLongToLongHashMap rgb_table;
|
||||
std::unordered_map<long, long> rgb_table;
|
||||
long rgb;
|
||||
const size_t n = clr_tbl.size();
|
||||
wxXPMColourMap::const_iterator iter = clr_tbl.begin();
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
#ifndef WX_PRECOMP
|
||||
#include "wx/object.h"
|
||||
#include "wx/list.h"
|
||||
#include "wx/hash.h"
|
||||
#endif
|
||||
|
||||
#include "wx/xti.h"
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/object.h"
|
||||
#include "wx/hash.h"
|
||||
#include "wx/event.h"
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/object.h"
|
||||
#include "wx/hash.h"
|
||||
#include "wx/event.h"
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@
|
|||
#include "wx/zipstrm.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/hashmap.h"
|
||||
#include "wx/intl.h"
|
||||
#include "wx/log.h"
|
||||
#include "wx/utils.h"
|
||||
|
|
@ -28,6 +27,7 @@
|
|||
#include "zlib.h"
|
||||
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
|
||||
// value for the 'version needed to extract' field (20 means 2.0)
|
||||
enum {
|
||||
|
|
@ -670,9 +670,6 @@ static void Unique(wxZipMemory*& zm, size_t size)
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Collection of weak references to entries
|
||||
|
||||
WX_DECLARE_HASH_MAP(long, wxZipEntry*, wxIntegerHash,
|
||||
wxIntegerEqual, wxOffsetZipEntryMap_);
|
||||
|
||||
class wxZipWeakLinks
|
||||
{
|
||||
public:
|
||||
|
|
@ -684,33 +681,29 @@ public:
|
|||
{ RemoveEntry(key); if (--m_ref == 0) delete this; }
|
||||
|
||||
wxZipWeakLinks *AddEntry(wxZipEntry *entry, wxFileOffset key);
|
||||
void RemoveEntry(wxFileOffset key)
|
||||
{ m_entries.erase(wx_truncate_cast(key_type, key)); }
|
||||
void RemoveEntry(wxFileOffset key) { m_entries.erase(key); }
|
||||
wxZipEntry *GetEntry(wxFileOffset key) const;
|
||||
bool IsEmpty() const { return m_entries.empty(); }
|
||||
|
||||
private:
|
||||
~wxZipWeakLinks() { wxASSERT(IsEmpty()); }
|
||||
|
||||
typedef wxOffsetZipEntryMap_::key_type key_type;
|
||||
|
||||
int m_ref;
|
||||
wxOffsetZipEntryMap_ m_entries;
|
||||
std::unordered_map<wxFileOffset, wxZipEntry*> m_entries;
|
||||
|
||||
wxSUPPRESS_GCC_PRIVATE_DTOR_WARNING(wxZipWeakLinks)
|
||||
};
|
||||
|
||||
wxZipWeakLinks *wxZipWeakLinks::AddEntry(wxZipEntry *entry, wxFileOffset key)
|
||||
{
|
||||
m_entries[wx_truncate_cast(key_type, key)] = entry;
|
||||
m_entries[key] = entry;
|
||||
m_ref++;
|
||||
return this;
|
||||
}
|
||||
|
||||
wxZipEntry *wxZipWeakLinks::GetEntry(wxFileOffset key) const
|
||||
{
|
||||
wxOffsetZipEntryMap_::const_iterator it =
|
||||
m_entries.find(wx_truncate_cast(key_type, key));
|
||||
auto it = m_entries.find(key);
|
||||
return it != m_entries.end() ? it->second : nullptr;
|
||||
}
|
||||
|
||||
|
|
@ -2151,9 +2144,6 @@ size_t wxZipInputStream::OnSysRead(void *buffer, size_t size)
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Output stream
|
||||
|
||||
#include "wx/listimpl.cpp"
|
||||
WX_DEFINE_LIST(wxZipEntryList_)
|
||||
|
||||
wxZipOutputStream::wxZipOutputStream(wxOutputStream& stream,
|
||||
int level /*=-1*/,
|
||||
wxMBConv& conv /*=wxConvUTF8*/)
|
||||
|
|
@ -2192,7 +2182,6 @@ void wxZipOutputStream::Init(int level)
|
|||
wxZipOutputStream::~wxZipOutputStream()
|
||||
{
|
||||
Close();
|
||||
WX_CLEAR_LIST(wxZipEntryList_, m_entries);
|
||||
delete m_store;
|
||||
delete m_deflate;
|
||||
delete m_pending;
|
||||
|
|
@ -2419,7 +2408,7 @@ void wxZipOutputStream::CreatePendingEntry(const void *buffer, size_t size)
|
|||
m_lasterror = m_parent_o_stream->GetLastError();
|
||||
|
||||
if (IsOk()) {
|
||||
m_entries.push_back(spPending.release());
|
||||
m_entries.push_back(std::move(spPending));
|
||||
OnSysWrite(m_initialData, m_initialSize);
|
||||
}
|
||||
|
||||
|
|
@ -2471,7 +2460,7 @@ void wxZipOutputStream::CreatePendingEntry()
|
|||
m_headerSize = spPending->WriteLocal(*m_parent_o_stream, GetConv(), m_format);
|
||||
|
||||
if (m_parent_o_stream->IsOk()) {
|
||||
m_entries.push_back(spPending.release());
|
||||
m_entries.push_back(std::move(spPending));
|
||||
m_comp = m_store;
|
||||
m_store->Write(m_initialData, m_initialSize);
|
||||
}
|
||||
|
|
@ -2500,12 +2489,10 @@ bool wxZipOutputStream::Close()
|
|||
endrec.SetOffset(m_headerOffset);
|
||||
endrec.SetComment(m_Comment);
|
||||
|
||||
wxZipEntryList_::iterator it;
|
||||
wxFileOffset size = 0;
|
||||
|
||||
for (it = m_entries.begin(); it != m_entries.end(); ++it) {
|
||||
size += (*it)->WriteCentral(*m_parent_o_stream, GetConv());
|
||||
delete *it;
|
||||
for (const auto& it : m_entries) {
|
||||
size += it->WriteCentral(*m_parent_o_stream, GetConv());
|
||||
}
|
||||
m_entries.clear();
|
||||
|
||||
|
|
|
|||
|
|
@ -16,10 +16,11 @@
|
|||
#include "wx/app.h"
|
||||
#endif // WX_PRECOMP
|
||||
|
||||
#include "wx/hashmap.h"
|
||||
#include "wx/evtloop.h"
|
||||
#include "wx/dfb/private.h"
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
#define TRACE_EVENTS "events"
|
||||
#define TRACE_PAINT "paint"
|
||||
|
||||
|
|
@ -28,9 +29,7 @@
|
|||
// ============================================================================
|
||||
|
||||
// mapping of DirectFB windows to wxTLWs:
|
||||
WX_DECLARE_HASH_MAP(DFBWindowID, wxNonOwnedWindow*,
|
||||
wxIntegerHash, wxIntegerEqual,
|
||||
wxDfbWindowsMap);
|
||||
using wxDfbWindowsMap = std::unordered_map<DFBWindowID, wxNonOwnedWindow*>;
|
||||
static wxDfbWindowsMap gs_dfbWindowsMap;
|
||||
|
||||
// ============================================================================
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@
|
|||
#if wxUSE_ACCEL
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/list.h"
|
||||
#include "wx/event.h"
|
||||
#endif // WX_PRECOMP
|
||||
|
||||
|
|
@ -30,14 +29,6 @@
|
|||
|
||||
#include <ctype.h>
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxAccelList: a list of wxAcceleratorEntries
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WX_DECLARE_LIST(wxAcceleratorEntry, wxAccelList);
|
||||
#include "wx/listimpl.cpp"
|
||||
WX_DEFINE_LIST(wxAccelList)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxAccelRefData: the data used by wxAcceleratorTable
|
||||
// ----------------------------------------------------------------------------
|
||||
|
|
@ -55,12 +46,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual ~wxAccelRefData()
|
||||
{
|
||||
WX_CLEAR_LIST(wxAccelList, m_accels);
|
||||
}
|
||||
|
||||
wxAccelList m_accels;
|
||||
std::vector<wxAcceleratorEntry> m_accels;
|
||||
};
|
||||
|
||||
// macro which can be used to access wxAccelRefData from wxAcceleratorTable
|
||||
|
|
@ -93,9 +79,9 @@ wxAcceleratorTable::wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]
|
|||
if ( wxIsascii(keycode) )
|
||||
keycode = wxToupper(keycode);
|
||||
|
||||
M_ACCELDATA->m_accels.Append(new wxAcceleratorEntry(entry.GetFlags(),
|
||||
keycode,
|
||||
entry.GetCommand()));
|
||||
M_ACCELDATA->m_accels.emplace_back(entry.GetFlags(),
|
||||
keycode,
|
||||
entry.GetCommand());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -121,31 +107,28 @@ void wxAcceleratorTable::Add(const wxAcceleratorEntry& entry)
|
|||
m_refData = new wxAccelRefData;
|
||||
}
|
||||
|
||||
M_ACCELDATA->m_accels.Append(new wxAcceleratorEntry(entry));
|
||||
M_ACCELDATA->m_accels.emplace_back(entry);
|
||||
}
|
||||
|
||||
void wxAcceleratorTable::Remove(const wxAcceleratorEntry& entry)
|
||||
{
|
||||
AllocExclusive();
|
||||
|
||||
wxAccelList::compatibility_iterator node = M_ACCELDATA->m_accels.GetFirst();
|
||||
while ( node )
|
||||
int n = 0;
|
||||
for ( const auto& entryCur : M_ACCELDATA->m_accels )
|
||||
{
|
||||
const wxAcceleratorEntry *entryCur = node->GetData();
|
||||
|
||||
// given entry contains only the information of the accelerator key
|
||||
// because it was set that way during creation so do not use the
|
||||
// comparison operator which also checks the command field
|
||||
if ((entryCur->GetKeyCode() == entry.GetKeyCode()) &&
|
||||
(entryCur->GetFlags() == entry.GetFlags()))
|
||||
if ((entryCur.GetKeyCode() == entry.GetKeyCode()) &&
|
||||
(entryCur.GetFlags() == entry.GetFlags()))
|
||||
{
|
||||
delete node->GetData();
|
||||
M_ACCELDATA->m_accels.Erase(node);
|
||||
M_ACCELDATA->m_accels.erase(M_ACCELDATA->m_accels.begin() + n);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
node = node->GetNext();
|
||||
++n;
|
||||
}
|
||||
|
||||
wxFAIL_MSG(wxT("deleting inexistent accel from wxAcceleratorTable"));
|
||||
|
|
@ -164,26 +147,21 @@ wxAcceleratorTable::GetEntry(const wxKeyEvent& event) const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
wxAccelList::compatibility_iterator node = M_ACCELDATA->m_accels.GetFirst();
|
||||
while ( node )
|
||||
for ( const auto& entry : M_ACCELDATA->m_accels )
|
||||
{
|
||||
const wxAcceleratorEntry *entry = node->GetData();
|
||||
|
||||
// is the key the same?
|
||||
if ( event.m_keyCode == entry->GetKeyCode() )
|
||||
if ( event.m_keyCode == entry.GetKeyCode() )
|
||||
{
|
||||
int flags = entry->GetFlags();
|
||||
int flags = entry.GetFlags();
|
||||
|
||||
// now check flags
|
||||
if ( (((flags & wxACCEL_CTRL) != 0) == event.ControlDown()) &&
|
||||
(((flags & wxACCEL_SHIFT) != 0) == event.ShiftDown()) &&
|
||||
(((flags & wxACCEL_ALT) != 0) == event.AltDown()) )
|
||||
{
|
||||
return entry;
|
||||
return &entry;
|
||||
}
|
||||
}
|
||||
|
||||
node = node->GetNext();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
|
|
|
|||
|
|
@ -41,8 +41,6 @@
|
|||
#include "wx/dcbuffer.h"
|
||||
#include "wx/icon.h"
|
||||
#include "wx/itemattr.h"
|
||||
#include "wx/list.h"
|
||||
#include "wx/listimpl.cpp"
|
||||
#include "wx/imaglist.h"
|
||||
#include "wx/headerctrl.h"
|
||||
#include "wx/dnd.h"
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@
|
|||
#ifdef __WXMSW__
|
||||
#include "wx/msw/wrapwin.h"
|
||||
#endif
|
||||
#include "wx/hash.h"
|
||||
#include "wx/intl.h"
|
||||
#include "wx/settings.h"
|
||||
#include "wx/log.h"
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@
|
|||
#include "wx/tokenzr.h"
|
||||
#include "wx/renderer.h"
|
||||
#include "wx/headerctrl.h"
|
||||
#include "wx/hashset.h"
|
||||
|
||||
#if wxUSE_CLIPBOARD
|
||||
#include "wx/clipbrd.h"
|
||||
|
|
@ -59,10 +58,6 @@ const char wxGridNameStr[] = "grid";
|
|||
// Required for wxIs... functions
|
||||
#include <ctype.h>
|
||||
|
||||
WX_DECLARE_HASH_SET_WITH_DECL_PTR(int, wxIntegerHash, wxIntegerEqual,
|
||||
wxGridFixedIndicesSet, class WXDLLIMPEXP_ADV);
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// globals
|
||||
// ----------------------------------------------------------------------------
|
||||
|
|
@ -104,10 +99,6 @@ namespace
|
|||
const size_t GRID_SCROLL_LINE_X = 15;
|
||||
const size_t GRID_SCROLL_LINE_Y = GRID_SCROLL_LINE_X;
|
||||
|
||||
// the size of hash tables used a bit everywhere (the max number of elements
|
||||
// in these hash tables is the number of rows/columns)
|
||||
const int GRID_HASH_SIZE = 100;
|
||||
|
||||
// the minimal distance in pixels the mouse needs to move to start a drag
|
||||
// operation
|
||||
const int DRAG_SENSITIVITY = 3;
|
||||
|
|
@ -120,10 +111,6 @@ const int GRID_TEXT_MARGIN = 1;
|
|||
|
||||
} // anonymous namespace
|
||||
|
||||
#include "wx/arrimpl.cpp"
|
||||
|
||||
WX_DEFINE_OBJARRAY(wxGridCellCoordsArray)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// events
|
||||
// ----------------------------------------------------------------------------
|
||||
|
|
@ -1798,8 +1785,6 @@ wxGridTableMessage::wxGridTableMessage( wxGridTableBase *table, int id,
|
|||
// created by wxGrid if you don't specify an alternative table class.
|
||||
//
|
||||
|
||||
WX_DEFINE_OBJARRAY(wxGridStringArray)
|
||||
|
||||
wxIMPLEMENT_DYNAMIC_CLASS(wxGridStringTable, wxGridTableBase);
|
||||
|
||||
wxGridStringTable::wxGridStringTable()
|
||||
|
|
@ -1809,17 +1794,10 @@ wxGridStringTable::wxGridStringTable()
|
|||
}
|
||||
|
||||
wxGridStringTable::wxGridStringTable( int numRows, int numCols )
|
||||
: wxGridTableBase()
|
||||
: wxGridTableBase(),
|
||||
m_data(numRows, ColData(numCols))
|
||||
{
|
||||
m_numCols = numCols;
|
||||
|
||||
m_data.Alloc( numRows );
|
||||
|
||||
wxArrayString sa;
|
||||
sa.Alloc( numCols );
|
||||
sa.Add( wxEmptyString, numCols );
|
||||
|
||||
m_data.Add( sa, numRows );
|
||||
}
|
||||
|
||||
wxString wxGridStringTable::GetValue( int row, int col )
|
||||
|
|
@ -1843,22 +1821,10 @@ void wxGridStringTable::SetValue( int row, int col, const wxString& value )
|
|||
|
||||
void wxGridStringTable::Clear()
|
||||
{
|
||||
int numRows;
|
||||
numRows = m_data.GetCount();
|
||||
if ( numRows > 0 )
|
||||
for ( auto& colData : m_data )
|
||||
{
|
||||
int numCols;
|
||||
numCols = m_data[0].GetCount();
|
||||
|
||||
int row;
|
||||
for ( row = 0; row < numRows; row++ )
|
||||
{
|
||||
int col;
|
||||
for ( col = 0; col < numCols; col++ )
|
||||
{
|
||||
m_data[row][col].clear();
|
||||
}
|
||||
}
|
||||
for ( auto& cell : colData )
|
||||
cell.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1869,10 +1835,7 @@ bool wxGridStringTable::InsertRows( size_t pos, size_t numRows )
|
|||
return AppendRows( numRows );
|
||||
}
|
||||
|
||||
wxArrayString sa;
|
||||
sa.Alloc( m_numCols );
|
||||
sa.Add( wxEmptyString, m_numCols );
|
||||
m_data.Insert( sa, pos, numRows );
|
||||
m_data.insert( m_data.begin() + pos, numRows, ColData(m_numCols) );
|
||||
|
||||
if ( GetView() )
|
||||
{
|
||||
|
|
@ -1887,14 +1850,7 @@ bool wxGridStringTable::InsertRows( size_t pos, size_t numRows )
|
|||
|
||||
bool wxGridStringTable::AppendRows( size_t numRows )
|
||||
{
|
||||
wxArrayString sa;
|
||||
if ( m_numCols > 0 )
|
||||
{
|
||||
sa.Alloc( m_numCols );
|
||||
sa.Add( wxEmptyString, m_numCols );
|
||||
}
|
||||
|
||||
m_data.Add( sa, numRows );
|
||||
m_data.insert( m_data.end(), numRows, ColData(m_numCols) );
|
||||
|
||||
if ( GetView() )
|
||||
{
|
||||
|
|
@ -1908,7 +1864,7 @@ bool wxGridStringTable::AppendRows( size_t numRows )
|
|||
|
||||
bool wxGridStringTable::DeleteRows( size_t pos, size_t numRows )
|
||||
{
|
||||
size_t curNumRows = m_data.GetCount();
|
||||
size_t curNumRows = m_data.size();
|
||||
|
||||
if ( pos >= curNumRows )
|
||||
{
|
||||
|
|
@ -1930,11 +1886,12 @@ bool wxGridStringTable::DeleteRows( size_t pos, size_t numRows )
|
|||
|
||||
if ( numRows >= curNumRows )
|
||||
{
|
||||
m_data.Clear();
|
||||
m_data.clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_data.RemoveAt( pos, numRows );
|
||||
const auto first = m_data.begin() + pos;
|
||||
m_data.erase( first, first + numRows );
|
||||
}
|
||||
|
||||
if ( GetView() )
|
||||
|
|
@ -1963,12 +1920,9 @@ bool wxGridStringTable::InsertCols( size_t pos, size_t numCols )
|
|||
m_colLabels[i] = wxGridTableBase::GetColLabelValue( i );
|
||||
}
|
||||
|
||||
for ( size_t row = 0; row < m_data.size(); row++ )
|
||||
for ( auto& colData: m_data )
|
||||
{
|
||||
for ( size_t col = pos; col < pos + numCols; col++ )
|
||||
{
|
||||
m_data[row].Insert( wxEmptyString, col );
|
||||
}
|
||||
colData.insert( colData.begin() + pos, numCols, {} );
|
||||
}
|
||||
|
||||
m_numCols += numCols;
|
||||
|
|
@ -1986,9 +1940,9 @@ bool wxGridStringTable::InsertCols( size_t pos, size_t numCols )
|
|||
|
||||
bool wxGridStringTable::AppendCols( size_t numCols )
|
||||
{
|
||||
for ( size_t row = 0; row < m_data.size(); row++ )
|
||||
for ( auto& colData: m_data )
|
||||
{
|
||||
m_data[row].Add( wxEmptyString, numCols );
|
||||
colData.insert( colData.end(), numCols, {} );
|
||||
}
|
||||
|
||||
m_numCols += numCols;
|
||||
|
|
@ -2005,9 +1959,6 @@ bool wxGridStringTable::AppendCols( size_t numCols )
|
|||
|
||||
bool wxGridStringTable::DeleteCols( size_t pos, size_t numCols )
|
||||
{
|
||||
size_t row;
|
||||
|
||||
size_t curNumRows = m_data.GetCount();
|
||||
size_t curNumCols = m_numCols;
|
||||
|
||||
if ( pos >= curNumCols )
|
||||
|
|
@ -2045,18 +1996,19 @@ bool wxGridStringTable::DeleteCols( size_t pos, size_t numCols )
|
|||
|
||||
if ( numCols >= curNumCols )
|
||||
{
|
||||
for ( row = 0; row < curNumRows; row++ )
|
||||
for ( auto& colData: m_data )
|
||||
{
|
||||
m_data[row].Clear();
|
||||
colData.clear();
|
||||
}
|
||||
|
||||
m_numCols = 0;
|
||||
}
|
||||
else // something will be left
|
||||
{
|
||||
for ( row = 0; row < curNumRows; row++ )
|
||||
for ( auto& colData: m_data )
|
||||
{
|
||||
m_data[row].RemoveAt( colID, numCols );
|
||||
const auto first = colData.begin() + colID;
|
||||
colData.erase( first, first + numCols );
|
||||
}
|
||||
|
||||
m_numCols -= numCols;
|
||||
|
|
@ -2291,7 +2243,7 @@ void wxGridWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||
m_owner->PrepareDCFor( dc, this );
|
||||
wxRegion reg = GetUpdateRegion();
|
||||
|
||||
wxGridCellCoordsArray dirtyCells = m_owner->CalcCellsExposed( reg , this );
|
||||
wxGridCellCoordsVector dirtyCells = m_owner->CalcCellsExposed( reg , this );
|
||||
m_owner->DrawGridCellArea( dc, dirtyCells );
|
||||
|
||||
m_owner->DrawGridSpace( dc, this );
|
||||
|
|
@ -2487,7 +2439,7 @@ wxGrid::SetRenderScale(wxDC& dc,
|
|||
void wxGrid::GetRenderSizes( const wxGridCellCoords& topLeft,
|
||||
const wxGridCellCoords& bottomRight,
|
||||
wxPoint& pointOffSet, wxSize& sizeGrid,
|
||||
wxGridCellCoordsArray& renderCells,
|
||||
wxGridCellCoordsVector& renderCells,
|
||||
wxArrayInt& arrayCols, wxArrayInt& arrayRows ) const
|
||||
{
|
||||
pointOffSet.x = 0;
|
||||
|
|
@ -2508,7 +2460,7 @@ void wxGrid::GetRenderSizes( const wxGridCellCoords& topLeft,
|
|||
{
|
||||
for ( row = topLeft.GetRow(); row <= bottomRight.GetRow(); row++ )
|
||||
{
|
||||
renderCells.Add( wxGridCellCoords( row, col ));
|
||||
renderCells.emplace_back( row, col );
|
||||
arrayRows.Add( row ); // column labels rendered in DrawColLabels
|
||||
}
|
||||
arrayCols.Add( col ); // row labels rendered in DrawRowLabels
|
||||
|
|
@ -2702,9 +2654,6 @@ bool wxGrid::Create(wxWindow *parent, wxWindowID id,
|
|||
style | wxWANTS_CHARS, name))
|
||||
return false;
|
||||
|
||||
m_colMinWidths = wxLongToLongHashMap(GRID_HASH_SIZE);
|
||||
m_rowMinHeights = wxLongToLongHashMap(GRID_HASH_SIZE);
|
||||
|
||||
Create();
|
||||
SetInitialSize(size);
|
||||
CalcDimensions();
|
||||
|
|
@ -6350,13 +6299,13 @@ bool wxGrid::SetCurrentCell( const wxGridCellCoords& coords )
|
|||
// exposed cells (usually set from the update region by
|
||||
// CalcExposedCells)
|
||||
//
|
||||
void wxGrid::DrawGridCellArea( wxDC& dc, const wxGridCellCoordsArray& cells )
|
||||
void wxGrid::DrawGridCellArea( wxDC& dc, const wxGridCellCoordsVector& cells )
|
||||
{
|
||||
if ( !m_numRows || !m_numCols )
|
||||
return;
|
||||
|
||||
int i, numCells = cells.GetCount();
|
||||
wxGridCellCoordsArray redrawCells;
|
||||
int i, numCells = cells.size();
|
||||
wxGridCellCoordsVector redrawCells;
|
||||
|
||||
for ( i = numCells - 1; i >= 0; i-- )
|
||||
{
|
||||
|
|
@ -6380,7 +6329,7 @@ void wxGrid::DrawGridCellArea( wxDC& dc, const wxGridCellCoordsArray& cells )
|
|||
|
||||
if (!marked)
|
||||
{
|
||||
int count = redrawCells.GetCount();
|
||||
int count = redrawCells.size();
|
||||
for (int j = 0; j < count; j++)
|
||||
{
|
||||
if ( cell == redrawCells[j] )
|
||||
|
|
@ -6391,7 +6340,7 @@ void wxGrid::DrawGridCellArea( wxDC& dc, const wxGridCellCoordsArray& cells )
|
|||
}
|
||||
|
||||
if (!marked)
|
||||
redrawCells.Add( cell );
|
||||
redrawCells.push_back( cell );
|
||||
}
|
||||
|
||||
// don't bother drawing this cell
|
||||
|
|
@ -6405,12 +6354,13 @@ void wxGrid::DrawGridCellArea( wxDC& dc, const wxGridCellCoordsArray& cells )
|
|||
{
|
||||
// find a cell in this row to leave already marked for repaint
|
||||
int left = col;
|
||||
for (int k = 0; k < int(redrawCells.GetCount()); k++)
|
||||
if ((redrawCells[k].GetCol() < left) &&
|
||||
(redrawCells[k].GetRow() == row))
|
||||
for ( const auto& cell: redrawCells )
|
||||
{
|
||||
if ((cell.GetCol() < left) && (cell.GetRow() == row))
|
||||
{
|
||||
left = redrawCells[k].GetCol();
|
||||
left = cell.GetCol();
|
||||
}
|
||||
}
|
||||
|
||||
if (left == col)
|
||||
left = 0; // oh well
|
||||
|
|
@ -6429,12 +6379,12 @@ void wxGrid::DrawGridCellArea( wxDC& dc, const wxGridCellCoordsArray& cells )
|
|||
|
||||
if ( attr->CanOverflow() )
|
||||
{
|
||||
wxGridCellCoords cell(row + l, j);
|
||||
wxGridCellCoords cellOver(row + l, j);
|
||||
bool marked = false;
|
||||
|
||||
for (int k = 0; k < numCells; k++)
|
||||
for ( const auto& cell: cells )
|
||||
{
|
||||
if ( cell == cells[k] )
|
||||
if ( cellOver == cell )
|
||||
{
|
||||
marked = true;
|
||||
break;
|
||||
|
|
@ -6443,17 +6393,16 @@ void wxGrid::DrawGridCellArea( wxDC& dc, const wxGridCellCoordsArray& cells )
|
|||
|
||||
if (!marked)
|
||||
{
|
||||
int count = redrawCells.GetCount();
|
||||
for (int k = 0; k < count; k++)
|
||||
for ( const auto& cell: redrawCells )
|
||||
{
|
||||
if ( cell == redrawCells[k] )
|
||||
if ( cellOver == cell )
|
||||
{
|
||||
marked = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!marked)
|
||||
redrawCells.Add( cell );
|
||||
redrawCells.push_back( cellOver );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -6465,7 +6414,7 @@ void wxGrid::DrawGridCellArea( wxDC& dc, const wxGridCellCoordsArray& cells )
|
|||
DrawCell( dc, cells[i] );
|
||||
}
|
||||
|
||||
numCells = redrawCells.GetCount();
|
||||
numCells = redrawCells.size();
|
||||
|
||||
for ( i = numCells - 1; i >= 0; i-- )
|
||||
{
|
||||
|
|
@ -6614,7 +6563,7 @@ void wxGrid::DrawCellBorder( wxDC& dc, const wxGridCellCoords& coords )
|
|||
rect.x + rect.width, rect.y + rect.height);
|
||||
}
|
||||
|
||||
void wxGrid::DrawHighlight(wxDC& dc, const wxGridCellCoordsArray& cells)
|
||||
void wxGrid::DrawHighlight(wxDC& dc, const wxGridCellCoordsVector& cells)
|
||||
{
|
||||
// This if block was previously in wxGrid::OnPaint but that doesn't
|
||||
// seem to get called under wxGTK - MB
|
||||
|
|
@ -6633,11 +6582,8 @@ void wxGrid::DrawHighlight(wxDC& dc, const wxGridCellCoordsArray& cells)
|
|||
|
||||
// if the active cell was repainted, repaint its highlight too because it
|
||||
// might have been damaged by the grid lines
|
||||
size_t count = cells.GetCount();
|
||||
for ( size_t n = 0; n < count; n++ )
|
||||
for ( auto cell: cells )
|
||||
{
|
||||
wxGridCellCoords cell = cells[n];
|
||||
|
||||
// If we are using attributes, then we may have just exposed another
|
||||
// cell in a partially-visible merged cluster of cells. If the "anchor"
|
||||
// (upper left) cell of this merged cluster is the cell indicated by
|
||||
|
|
@ -10098,8 +10044,7 @@ void wxGrid::SetColMinimalWidth( int col, int width )
|
|||
{
|
||||
if (width > GetColMinimalAcceptableWidth())
|
||||
{
|
||||
wxLongToLongHashMap::key_type key = (wxLongToLongHashMap::key_type)col;
|
||||
m_colMinWidths[key] = width;
|
||||
m_colMinWidths[col] = width;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -10107,25 +10052,22 @@ void wxGrid::SetRowMinimalHeight( int row, int width )
|
|||
{
|
||||
if (width > GetRowMinimalAcceptableHeight())
|
||||
{
|
||||
wxLongToLongHashMap::key_type key = (wxLongToLongHashMap::key_type)row;
|
||||
m_rowMinHeights[key] = width;
|
||||
m_rowMinHeights[row] = width;
|
||||
}
|
||||
}
|
||||
|
||||
int wxGrid::GetColMinimalWidth(int col) const
|
||||
{
|
||||
wxLongToLongHashMap::key_type key = (wxLongToLongHashMap::key_type)col;
|
||||
wxLongToLongHashMap::const_iterator it = m_colMinWidths.find(key);
|
||||
const auto it = m_colMinWidths.find(col);
|
||||
|
||||
return it != m_colMinWidths.end() ? (int)it->second : m_minAcceptableColWidth;
|
||||
return it != m_colMinWidths.end() ? it->second : m_minAcceptableColWidth;
|
||||
}
|
||||
|
||||
int wxGrid::GetRowMinimalHeight(int row) const
|
||||
{
|
||||
wxLongToLongHashMap::key_type key = (wxLongToLongHashMap::key_type)row;
|
||||
wxLongToLongHashMap::const_iterator it = m_rowMinHeights.find(key);
|
||||
const auto it = m_rowMinHeights.find(row);
|
||||
|
||||
return it != m_rowMinHeights.end() ? (int)it->second : m_minAcceptableRowHeight;
|
||||
return it != m_rowMinHeights.end() ? it->second : m_minAcceptableRowHeight;
|
||||
}
|
||||
|
||||
void wxGrid::SetColMinimalAcceptableWidth( int width )
|
||||
|
|
@ -10844,10 +10786,7 @@ wxGridBlockCoordsVector wxGrid::GetSelectedColBlocks() const
|
|||
wxGridCellCoordsArray wxGrid::GetSelectedCells() const
|
||||
{
|
||||
if (!m_selection)
|
||||
{
|
||||
wxGridCellCoordsArray a;
|
||||
return a;
|
||||
}
|
||||
return {};
|
||||
|
||||
return m_selection->GetCellSelection();
|
||||
}
|
||||
|
|
@ -10855,10 +10794,7 @@ wxGridCellCoordsArray wxGrid::GetSelectedCells() const
|
|||
wxGridCellCoordsArray wxGrid::GetSelectionBlockTopLeft() const
|
||||
{
|
||||
if (!m_selection)
|
||||
{
|
||||
wxGridCellCoordsArray a;
|
||||
return a;
|
||||
}
|
||||
return {};
|
||||
|
||||
return m_selection->GetBlockSelectionTopLeft();
|
||||
}
|
||||
|
|
@ -10866,10 +10802,7 @@ wxGridCellCoordsArray wxGrid::GetSelectionBlockTopLeft() const
|
|||
wxGridCellCoordsArray wxGrid::GetSelectionBlockBottomRight() const
|
||||
{
|
||||
if (!m_selection)
|
||||
{
|
||||
wxGridCellCoordsArray a;
|
||||
return a;
|
||||
}
|
||||
return {};
|
||||
|
||||
return m_selection->GetBlockSelectionBottomRight();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@
|
|||
|
||||
#include "wx/stockitem.h"
|
||||
#include "wx/popupwin.h"
|
||||
#include "wx/listimpl.cpp"
|
||||
|
||||
#include "wx/gtk/dc.h"
|
||||
#ifndef __WXGTK3__
|
||||
|
|
@ -40,6 +39,9 @@
|
|||
#include "wx/gtk/private/list.h"
|
||||
#include "wx/gtk/private/treeview.h"
|
||||
#include "wx/gtk/private/value.h"
|
||||
|
||||
#include <list>
|
||||
|
||||
using namespace wxGTKImpl;
|
||||
|
||||
class wxGtkDataViewModelNotifier;
|
||||
|
|
@ -189,9 +191,6 @@ wxGtkTreeSelectionLock *wxGtkTreeSelectionLock::ms_instance = nullptr;
|
|||
// wxDataViewCtrlInternal
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
WX_DECLARE_LIST(wxDataViewItem, ItemList);
|
||||
WX_DEFINE_LIST(ItemList)
|
||||
|
||||
class wxDataViewCtrlInternal
|
||||
{
|
||||
public:
|
||||
|
|
@ -3219,9 +3218,6 @@ static void wxGtkTreeCellDataFunc( GtkTreeViewColumn *WXUNUSED(column),
|
|||
|
||||
} // extern "C"
|
||||
|
||||
#include <wx/listimpl.cpp>
|
||||
WX_DEFINE_LIST(wxDataViewColumnList)
|
||||
|
||||
wxDataViewColumn::wxDataViewColumn( const wxString &title, wxDataViewRenderer *cell,
|
||||
unsigned int model_column, int width,
|
||||
wxAlignment align, int flags )
|
||||
|
|
@ -4372,19 +4368,17 @@ wxGtkTreeModelNode *wxDataViewCtrlInternal::FindNode( const wxDataViewItem &item
|
|||
if( m_wx_model == nullptr )
|
||||
return nullptr;
|
||||
|
||||
ItemList list;
|
||||
list.DeleteContents( true );
|
||||
std::list<wxDataViewItem> list;
|
||||
wxDataViewItem it( item );
|
||||
|
||||
while( it.IsOk() )
|
||||
{
|
||||
wxDataViewItem * pItem = new wxDataViewItem( it );
|
||||
list.Insert( pItem );
|
||||
list.push_front( it );
|
||||
it = m_wx_model->GetParent( it );
|
||||
}
|
||||
|
||||
wxGtkTreeModelNode * node = m_root;
|
||||
for( ItemList::compatibility_iterator n = list.GetFirst(); n; n = n->GetNext() )
|
||||
for( const auto& item : list )
|
||||
{
|
||||
if( node && node->GetNodes().GetCount() != 0 )
|
||||
{
|
||||
|
|
@ -4404,7 +4398,7 @@ wxGtkTreeModelNode *wxDataViewCtrlInternal::FindNode( const wxDataViewItem &item
|
|||
int j = 0;
|
||||
for( ; j < len; j ++)
|
||||
{
|
||||
if( nodes[j]->GetItem() == *(n->GetData()))
|
||||
if( nodes[j]->GetItem() == item )
|
||||
{
|
||||
node = nodes[j];
|
||||
break;
|
||||
|
|
@ -4452,21 +4446,19 @@ wxDataViewCtrlInternal_FindParentNode( wxDataViewModel * model, wxGtkTreeModelNo
|
|||
if( model == nullptr )
|
||||
return nullptr;
|
||||
|
||||
ItemList list;
|
||||
list.DeleteContents( true );
|
||||
std::list<wxDataViewItem> list;
|
||||
if( !item.IsOk() )
|
||||
return nullptr;
|
||||
|
||||
wxDataViewItem it( model->GetParent( item ) );
|
||||
while( it.IsOk() )
|
||||
{
|
||||
wxDataViewItem * pItem = new wxDataViewItem( it );
|
||||
list.Insert( pItem );
|
||||
list.push_front( it );
|
||||
it = model->GetParent( it );
|
||||
}
|
||||
|
||||
wxGtkTreeModelNode * node = treeNode;
|
||||
for( ItemList::compatibility_iterator n = list.GetFirst(); n; n = n->GetNext() )
|
||||
for( const auto& item : list )
|
||||
{
|
||||
if( node && node->GetNodes().GetCount() != 0 )
|
||||
{
|
||||
|
|
@ -4475,7 +4467,7 @@ wxDataViewCtrlInternal_FindParentNode( wxDataViewModel * model, wxGtkTreeModelNo
|
|||
int j = 0;
|
||||
for( ; j < len; j ++)
|
||||
{
|
||||
if( nodes[j]->GetItem() == *(n->GetData()))
|
||||
if( nodes[j]->GetItem() == item )
|
||||
{
|
||||
node = nodes[j];
|
||||
break;
|
||||
|
|
@ -4728,8 +4720,6 @@ wxDataViewCtrl::~wxDataViewCtrl()
|
|||
GTKDisconnect(selection);
|
||||
}
|
||||
|
||||
m_cols.Clear();
|
||||
|
||||
delete m_internal;
|
||||
}
|
||||
|
||||
|
|
@ -4738,8 +4728,6 @@ void wxDataViewCtrl::Init()
|
|||
m_treeview = nullptr;
|
||||
m_internal = nullptr;
|
||||
|
||||
m_cols.DeleteContents( true );
|
||||
|
||||
m_uniformRowHeight = -1;
|
||||
}
|
||||
|
||||
|
|
@ -4908,7 +4896,7 @@ bool wxDataViewCtrl::AppendColumn( wxDataViewColumn *col )
|
|||
if (!wxDataViewCtrlBase::AppendColumn(col))
|
||||
return false;
|
||||
|
||||
m_cols.Append( col );
|
||||
m_cols.push_back( wxDataViewColumnPtr(col) );
|
||||
|
||||
if (gtk_tree_view_column_get_sizing( GTK_TREE_VIEW_COLUMN(col->GetGtkHandle()) ) !=
|
||||
GTK_TREE_VIEW_COLUMN_FIXED)
|
||||
|
|
@ -4927,7 +4915,7 @@ bool wxDataViewCtrl::PrependColumn( wxDataViewColumn *col )
|
|||
if (!wxDataViewCtrlBase::PrependColumn(col))
|
||||
return false;
|
||||
|
||||
m_cols.Insert( col );
|
||||
m_cols.insert( m_cols.begin(), wxDataViewColumnPtr(col) );
|
||||
|
||||
if (gtk_tree_view_column_get_sizing( GTK_TREE_VIEW_COLUMN(col->GetGtkHandle()) ) !=
|
||||
GTK_TREE_VIEW_COLUMN_FIXED)
|
||||
|
|
@ -4946,7 +4934,7 @@ bool wxDataViewCtrl::InsertColumn( unsigned int pos, wxDataViewColumn *col )
|
|||
if (!wxDataViewCtrlBase::InsertColumn(pos,col))
|
||||
return false;
|
||||
|
||||
m_cols.Insert( pos, col );
|
||||
m_cols.insert( m_cols.begin() + pos, wxDataViewColumnPtr(col) );
|
||||
|
||||
if (gtk_tree_view_column_get_sizing( GTK_TREE_VIEW_COLUMN(col->GetGtkHandle()) ) !=
|
||||
GTK_TREE_VIEW_COLUMN_FIXED)
|
||||
|
|
@ -4962,7 +4950,7 @@ bool wxDataViewCtrl::InsertColumn( unsigned int pos, wxDataViewColumn *col )
|
|||
|
||||
unsigned int wxDataViewCtrl::GetColumnCount() const
|
||||
{
|
||||
return m_cols.GetCount();
|
||||
return m_cols.size();
|
||||
}
|
||||
|
||||
wxDataViewColumn* wxDataViewCtrl::GTKColumnToWX(GtkTreeViewColumn *gtk_col) const
|
||||
|
|
@ -4970,13 +4958,11 @@ wxDataViewColumn* wxDataViewCtrl::GTKColumnToWX(GtkTreeViewColumn *gtk_col) cons
|
|||
if ( !gtk_col )
|
||||
return nullptr;
|
||||
|
||||
wxDataViewColumnList::const_iterator iter;
|
||||
for (iter = m_cols.begin(); iter != m_cols.end(); ++iter)
|
||||
for (const auto& col : m_cols)
|
||||
{
|
||||
wxDataViewColumn *col = *iter;
|
||||
if (GTK_TREE_VIEW_COLUMN(col->GetGtkHandle()) == gtk_col)
|
||||
{
|
||||
return col;
|
||||
return col.get();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -4997,22 +4983,30 @@ bool wxDataViewCtrl::DeleteColumn( wxDataViewColumn *column )
|
|||
gtk_tree_view_remove_column( GTK_TREE_VIEW(m_treeview),
|
||||
GTK_TREE_VIEW_COLUMN(column->GetGtkHandle()) );
|
||||
|
||||
m_cols.DeleteObject( column );
|
||||
int n = 0;
|
||||
for (const auto& col : m_cols)
|
||||
{
|
||||
if (col.get() == column)
|
||||
{
|
||||
m_cols.erase(m_cols.begin() + n);
|
||||
break;
|
||||
}
|
||||
|
||||
++n;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool wxDataViewCtrl::ClearColumns()
|
||||
{
|
||||
wxDataViewColumnList::iterator iter;
|
||||
for (iter = m_cols.begin(); iter != m_cols.end(); ++iter)
|
||||
for (const auto& col : m_cols)
|
||||
{
|
||||
wxDataViewColumn *col = *iter;
|
||||
gtk_tree_view_remove_column( GTK_TREE_VIEW(m_treeview),
|
||||
GTK_TREE_VIEW_COLUMN(col->GetGtkHandle()) );
|
||||
}
|
||||
|
||||
m_cols.Clear();
|
||||
m_cols.clear();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@
|
|||
// class which explains it but it still would be nice to do something
|
||||
// about this one day
|
||||
|
||||
class wxGtkNotebookPage: public wxObject
|
||||
class wxGtkNotebookPage
|
||||
{
|
||||
public:
|
||||
GtkWidget* m_box;
|
||||
|
|
@ -50,9 +50,6 @@ public:
|
|||
};
|
||||
|
||||
|
||||
#include "wx/listimpl.cpp"
|
||||
WX_DEFINE_LIST(wxGtkNotebookPagesList)
|
||||
|
||||
extern "C" {
|
||||
static void event_after(GtkNotebook*, GdkEvent*, wxNotebook*);
|
||||
}
|
||||
|
|
@ -231,7 +228,7 @@ int wxNotebook::GetPageImage( size_t page ) const
|
|||
|
||||
wxGtkNotebookPage* wxNotebook::GetNotebookPage( int page ) const
|
||||
{
|
||||
return m_pagesData.Item(page)->GetData();
|
||||
return const_cast<wxGtkNotebookPage*>(&m_pagesData.at(page));
|
||||
}
|
||||
|
||||
int wxNotebook::DoSetSelection( size_t page, int flags )
|
||||
|
|
@ -445,9 +442,7 @@ wxNotebookPage *wxNotebook::DoRemovePage( size_t page )
|
|||
wxASSERT_MSG(GetPage(page) == client, wxT("pages changed during delete"));
|
||||
wxNotebookBase::DoRemovePage(page);
|
||||
|
||||
wxGtkNotebookPage* p = GetNotebookPage(page);
|
||||
m_pagesData.DeleteObject(p);
|
||||
delete p;
|
||||
m_pagesData.erase(m_pagesData.begin() + page);
|
||||
|
||||
return client;
|
||||
}
|
||||
|
|
@ -475,10 +470,10 @@ bool wxNotebook::InsertPage( size_t position,
|
|||
|
||||
GtkNotebook *notebook = GTK_NOTEBOOK(m_widget);
|
||||
|
||||
wxGtkNotebookPage* pageData = new wxGtkNotebookPage;
|
||||
|
||||
m_pages.insert(m_pages.begin() + position, win);
|
||||
m_pagesData.Insert(position, pageData);
|
||||
m_pagesData.insert(m_pagesData.begin() + position, wxGtkNotebookPage());
|
||||
|
||||
wxGtkNotebookPage* const pageData = &m_pagesData[position];
|
||||
|
||||
// set the label image and text
|
||||
// this must be done before adding the page, as GetPageText
|
||||
|
|
|
|||
|
|
@ -24,11 +24,11 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// structure internally used by wxRadioBox to store its child buttons
|
||||
|
||||
class wxGTKRadioButtonInfo : public wxObject
|
||||
class wxGTKRadioButtonInfo
|
||||
{
|
||||
public:
|
||||
wxGTKRadioButtonInfo( GtkRadioButton * abutton, const wxRect & arect )
|
||||
: button( abutton ), rect( arect ) {}
|
||||
explicit wxGTKRadioButtonInfo( GtkRadioButton * abutton )
|
||||
: button( abutton ) {}
|
||||
|
||||
GtkRadioButton * button;
|
||||
wxRect rect;
|
||||
|
|
@ -38,9 +38,6 @@ public:
|
|||
// data
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "wx/listimpl.cpp"
|
||||
WX_DEFINE_LIST( wxRadioBoxButtonsInfoList )
|
||||
|
||||
extern bool g_blockEventsOnDrag;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -93,12 +90,15 @@ static gint gtk_radiobox_keypress_callback( GtkWidget *widget, GdkEventKey *gdk_
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
wxRadioBoxButtonsInfoList::compatibility_iterator node = rb->m_buttonsInfo.GetFirst();
|
||||
while( node && GTK_WIDGET( node->GetData()->button ) != widget )
|
||||
const auto begin = rb->m_buttonsInfo.begin();
|
||||
const auto end = rb->m_buttonsInfo.end();
|
||||
|
||||
auto it = begin;
|
||||
while( it != end && GTK_WIDGET( it->button ) != widget )
|
||||
{
|
||||
node = node->GetNext();
|
||||
++it;
|
||||
}
|
||||
if (!node)
|
||||
if (it == end)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
|
@ -106,20 +106,20 @@ static gint gtk_radiobox_keypress_callback( GtkWidget *widget, GdkEventKey *gdk_
|
|||
if ((gdk_event->keyval == GDK_KEY_Up) ||
|
||||
(gdk_event->keyval == GDK_KEY_Left))
|
||||
{
|
||||
if (node == rb->m_buttonsInfo.GetFirst())
|
||||
node = rb->m_buttonsInfo.GetLast();
|
||||
else
|
||||
node = node->GetPrevious();
|
||||
if (it == begin)
|
||||
it = end;
|
||||
|
||||
--it;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (node == rb->m_buttonsInfo.GetLast())
|
||||
node = rb->m_buttonsInfo.GetFirst();
|
||||
else
|
||||
node = node->GetNext();
|
||||
++it;
|
||||
|
||||
if (it == end)
|
||||
it = begin;
|
||||
}
|
||||
|
||||
GtkWidget *button = (GtkWidget*) node->GetData()->button;
|
||||
GtkWidget *button = GTK_WIDGET( it->button );
|
||||
|
||||
gtk_widget_grab_focus( button );
|
||||
|
||||
|
|
@ -164,16 +164,14 @@ static void gtk_radiobutton_size_allocate( GtkWidget *widget,
|
|||
GtkAllocation * alloc,
|
||||
wxRadioBox *win )
|
||||
{
|
||||
for ( wxRadioBoxButtonsInfoList::compatibility_iterator node = win->m_buttonsInfo.GetFirst();
|
||||
node;
|
||||
node = node->GetNext())
|
||||
for ( auto& info : win->m_buttonsInfo )
|
||||
{
|
||||
if (widget == GTK_WIDGET(node->GetData()->button))
|
||||
if (widget == GTK_WIDGET(info.button))
|
||||
{
|
||||
const wxPoint origin = win->GetPosition();
|
||||
wxRect rect = wxRect( alloc->x - origin.x, alloc->y - origin.y,
|
||||
alloc->width, alloc->height );
|
||||
node->GetData()->rect = rect;
|
||||
info.rect = rect;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -198,6 +196,37 @@ static gboolean expose_event(GtkWidget* widget, GdkEventExpose*, wxWindow*)
|
|||
|
||||
wxIMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl);
|
||||
|
||||
wxRadioBox::wxRadioBox() = default;
|
||||
|
||||
wxRadioBox::wxRadioBox(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
int n,
|
||||
const wxString choices[],
|
||||
int majorDim,
|
||||
long style,
|
||||
const wxValidator& val,
|
||||
const wxString& name)
|
||||
{
|
||||
Create( parent, id, title, pos, size, n, choices, majorDim, style, val, name );
|
||||
}
|
||||
|
||||
wxRadioBox::wxRadioBox(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
const wxArrayString& choices,
|
||||
int majorDim,
|
||||
long style,
|
||||
const wxValidator& val,
|
||||
const wxString& name)
|
||||
{
|
||||
Create( parent, id, title, pos, size, choices, majorDim, style, val, name );
|
||||
}
|
||||
|
||||
bool wxRadioBox::Create( wxWindow *parent, wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint &pos, const wxSize &size,
|
||||
|
|
@ -313,7 +342,7 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
|
|||
g_signal_connect (rbtn, "key_press_event",
|
||||
G_CALLBACK (gtk_radiobox_keypress_callback), this);
|
||||
|
||||
m_buttonsInfo.Append( new wxGTKRadioButtonInfo( rbtn, wxRect() ) );
|
||||
m_buttonsInfo.emplace_back(rbtn);
|
||||
|
||||
#ifdef __WXGTK3__
|
||||
int left, top;
|
||||
|
|
@ -373,15 +402,12 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
|
|||
|
||||
wxRadioBox::~wxRadioBox()
|
||||
{
|
||||
wxRadioBoxButtonsInfoList::compatibility_iterator node = m_buttonsInfo.GetFirst();
|
||||
while (node)
|
||||
for ( const auto& info : m_buttonsInfo )
|
||||
{
|
||||
GtkWidget *button = GTK_WIDGET( node->GetData()->button );
|
||||
GtkWidget *button = GTK_WIDGET( info.button );
|
||||
GTKDisconnect(button);
|
||||
gtk_widget_destroy( button );
|
||||
node = node->GetNext();
|
||||
}
|
||||
WX_CLEAR_LIST( wxRadioBoxButtonsInfoList, m_buttonsInfo );
|
||||
}
|
||||
|
||||
bool wxRadioBox::Show( bool show )
|
||||
|
|
@ -397,17 +423,14 @@ bool wxRadioBox::Show( bool show )
|
|||
if ( HasFlag(wxNO_BORDER) )
|
||||
gtk_widget_hide( m_widget );
|
||||
|
||||
wxRadioBoxButtonsInfoList::compatibility_iterator node = m_buttonsInfo.GetFirst();
|
||||
while (node)
|
||||
for ( const auto& info : m_buttonsInfo )
|
||||
{
|
||||
GtkWidget *button = GTK_WIDGET( node->GetData()->button );
|
||||
GtkWidget *button = GTK_WIDGET( info.button );
|
||||
|
||||
if (show)
|
||||
gtk_widget_show( button );
|
||||
else
|
||||
gtk_widget_hide( button );
|
||||
|
||||
node = node->GetNext();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -417,11 +440,9 @@ void wxRadioBox::SetSelection( int n )
|
|||
{
|
||||
wxCHECK_RET( m_widget != nullptr, wxT("invalid radiobox") );
|
||||
|
||||
wxRadioBoxButtonsInfoList::compatibility_iterator node = m_buttonsInfo.Item( n );
|
||||
wxCHECK_RET( n >= 0 && n < (int)m_buttonsInfo.size(), wxT("radiobox wrong index") );
|
||||
|
||||
wxCHECK_RET( node, wxT("radiobox wrong index") );
|
||||
|
||||
GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->GetData()->button );
|
||||
GtkToggleButton *button = GTK_TOGGLE_BUTTON( m_buttonsInfo[n].button );
|
||||
|
||||
GtkDisableEvents();
|
||||
|
||||
|
|
@ -436,13 +457,11 @@ int wxRadioBox::GetSelection(void) const
|
|||
|
||||
int count = 0;
|
||||
|
||||
wxRadioBoxButtonsInfoList::compatibility_iterator node = m_buttonsInfo.GetFirst();
|
||||
while (node)
|
||||
for ( const auto& info : m_buttonsInfo )
|
||||
{
|
||||
GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->GetData()->button );
|
||||
GtkToggleButton *button = GTK_TOGGLE_BUTTON( info.button );
|
||||
if (gtk_toggle_button_get_active(button)) return count;
|
||||
count++;
|
||||
node = node->GetNext();
|
||||
}
|
||||
|
||||
wxFAIL_MSG( wxT("wxRadioBox none selected") );
|
||||
|
|
@ -454,11 +473,9 @@ wxString wxRadioBox::GetString(unsigned int n) const
|
|||
{
|
||||
wxCHECK_MSG( m_widget != nullptr, wxEmptyString, wxT("invalid radiobox") );
|
||||
|
||||
wxRadioBoxButtonsInfoList::compatibility_iterator node = m_buttonsInfo.Item( n );
|
||||
wxCHECK_MSG( n < m_buttonsInfo.size(), wxEmptyString, wxT("radiobox wrong index") );
|
||||
|
||||
wxCHECK_MSG( node, wxEmptyString, wxT("radiobox wrong index") );
|
||||
|
||||
GtkLabel* label = GTK_LABEL(gtk_bin_get_child(GTK_BIN(node->GetData()->button)));
|
||||
GtkLabel* label = GTK_LABEL(gtk_bin_get_child(GTK_BIN(m_buttonsInfo[n].button)));
|
||||
|
||||
return wxString::FromUTF8Unchecked( gtk_label_get_text(label) );
|
||||
}
|
||||
|
|
@ -470,15 +487,13 @@ void wxRadioBox::SetLabel( const wxString& label )
|
|||
GTKSetLabelForFrame(GTK_FRAME(m_widget), label);
|
||||
}
|
||||
|
||||
void wxRadioBox::SetString(unsigned int item, const wxString& label)
|
||||
void wxRadioBox::SetString(unsigned int n, const wxString& label)
|
||||
{
|
||||
wxCHECK_RET( m_widget != nullptr, wxT("invalid radiobox") );
|
||||
|
||||
wxRadioBoxButtonsInfoList::compatibility_iterator node = m_buttonsInfo.Item( item );
|
||||
wxCHECK_RET( n < m_buttonsInfo.size(), wxT("radiobox wrong index") );
|
||||
|
||||
wxCHECK_RET( node, wxT("radiobox wrong index") );
|
||||
|
||||
GtkLabel* g_label = GTK_LABEL(gtk_bin_get_child(GTK_BIN(node->GetData()->button)));
|
||||
GtkLabel* g_label = GTK_LABEL(gtk_bin_get_child(GTK_BIN(m_buttonsInfo[n].button)));
|
||||
|
||||
gtk_label_set_text( g_label, label.utf8_str() );
|
||||
}
|
||||
|
|
@ -498,30 +513,26 @@ void wxRadioBox::DoEnable(bool enable)
|
|||
|
||||
wxControl::DoEnable(enable);
|
||||
|
||||
wxRadioBoxButtonsInfoList::compatibility_iterator node = m_buttonsInfo.GetFirst();
|
||||
while (node)
|
||||
for ( const auto& info : m_buttonsInfo )
|
||||
{
|
||||
GtkButton *button = GTK_BUTTON( node->GetData()->button );
|
||||
GtkButton *button = GTK_BUTTON( info.button );
|
||||
GtkLabel *label = GTK_LABEL(gtk_bin_get_child(GTK_BIN(button)));
|
||||
|
||||
gtk_widget_set_sensitive( GTK_WIDGET(button), enable );
|
||||
gtk_widget_set_sensitive( GTK_WIDGET(label), enable );
|
||||
node = node->GetNext();
|
||||
}
|
||||
|
||||
if (enable)
|
||||
GTKFixSensitivity();
|
||||
}
|
||||
|
||||
bool wxRadioBox::Enable(unsigned int item, bool enable)
|
||||
bool wxRadioBox::Enable(unsigned int n, bool enable)
|
||||
{
|
||||
wxCHECK_MSG( m_widget != nullptr, false, wxT("invalid radiobox") );
|
||||
|
||||
wxRadioBoxButtonsInfoList::compatibility_iterator node = m_buttonsInfo.Item( item );
|
||||
wxCHECK_MSG( n < m_buttonsInfo.size(), false, wxT("radiobox wrong index") );
|
||||
|
||||
wxCHECK_MSG( node, false, wxT("radiobox wrong index") );
|
||||
|
||||
GtkButton *button = GTK_BUTTON( node->GetData()->button );
|
||||
GtkButton *button = GTK_BUTTON( m_buttonsInfo[n].button );
|
||||
GtkLabel *label = GTK_LABEL(gtk_bin_get_child(GTK_BIN(button)));
|
||||
|
||||
gtk_widget_set_sensitive( GTK_WIDGET(button), enable );
|
||||
|
|
@ -530,30 +541,26 @@ bool wxRadioBox::Enable(unsigned int item, bool enable)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool wxRadioBox::IsItemEnabled(unsigned int item) const
|
||||
bool wxRadioBox::IsItemEnabled(unsigned int n) const
|
||||
{
|
||||
wxCHECK_MSG( m_widget != nullptr, false, wxT("invalid radiobox") );
|
||||
|
||||
wxRadioBoxButtonsInfoList::compatibility_iterator node = m_buttonsInfo.Item( item );
|
||||
wxCHECK_MSG( n < m_buttonsInfo.size(), false, wxT("radiobox wrong index") );
|
||||
|
||||
wxCHECK_MSG( node, false, wxT("radiobox wrong index") );
|
||||
|
||||
GtkButton *button = GTK_BUTTON( node->GetData()->button );
|
||||
GtkButton *button = GTK_BUTTON( m_buttonsInfo[n].button );
|
||||
|
||||
// don't use GTK_WIDGET_IS_SENSITIVE() here, we want to return true even if
|
||||
// the parent radiobox is disabled
|
||||
return gtk_widget_get_sensitive(GTK_WIDGET(button)) != 0;
|
||||
}
|
||||
|
||||
bool wxRadioBox::Show(unsigned int item, bool show)
|
||||
bool wxRadioBox::Show(unsigned int n, bool show)
|
||||
{
|
||||
wxCHECK_MSG( m_widget != nullptr, false, wxT("invalid radiobox") );
|
||||
|
||||
wxRadioBoxButtonsInfoList::compatibility_iterator node = m_buttonsInfo.Item( item );
|
||||
wxCHECK_MSG( n < m_buttonsInfo.size(), false, wxT("radiobox wrong index") );
|
||||
|
||||
wxCHECK_MSG( node, false, wxT("radiobox wrong index") );
|
||||
|
||||
GtkWidget *button = GTK_WIDGET( node->GetData()->button );
|
||||
GtkWidget *button = GTK_WIDGET( m_buttonsInfo[n].button );
|
||||
|
||||
if (show)
|
||||
gtk_widget_show( button );
|
||||
|
|
@ -563,45 +570,37 @@ bool wxRadioBox::Show(unsigned int item, bool show)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool wxRadioBox::IsItemShown(unsigned int item) const
|
||||
bool wxRadioBox::IsItemShown(unsigned int n) const
|
||||
{
|
||||
wxCHECK_MSG( m_widget != nullptr, false, wxT("invalid radiobox") );
|
||||
|
||||
wxRadioBoxButtonsInfoList::compatibility_iterator node = m_buttonsInfo.Item( item );
|
||||
wxCHECK_MSG( n < m_buttonsInfo.size(), false, wxT("radiobox wrong index") );
|
||||
|
||||
wxCHECK_MSG( node, false, wxT("radiobox wrong index") );
|
||||
|
||||
GtkButton *button = GTK_BUTTON( node->GetData()->button );
|
||||
GtkButton *button = GTK_BUTTON( m_buttonsInfo[n].button );
|
||||
|
||||
return gtk_widget_get_visible(GTK_WIDGET(button)) != 0;
|
||||
}
|
||||
|
||||
unsigned int wxRadioBox::GetCount() const
|
||||
{
|
||||
return m_buttonsInfo.GetCount();
|
||||
return m_buttonsInfo.size();
|
||||
}
|
||||
|
||||
void wxRadioBox::GtkDisableEvents()
|
||||
{
|
||||
wxRadioBoxButtonsInfoList::compatibility_iterator node = m_buttonsInfo.GetFirst();
|
||||
while (node)
|
||||
for ( const auto& info : m_buttonsInfo )
|
||||
{
|
||||
g_signal_handlers_block_by_func(node->GetData()->button,
|
||||
g_signal_handlers_block_by_func(info.button,
|
||||
(gpointer)gtk_radiobutton_clicked_callback, this);
|
||||
|
||||
node = node->GetNext();
|
||||
}
|
||||
}
|
||||
|
||||
void wxRadioBox::GtkEnableEvents()
|
||||
{
|
||||
wxRadioBoxButtonsInfoList::compatibility_iterator node = m_buttonsInfo.GetFirst();
|
||||
while (node)
|
||||
for ( const auto& info : m_buttonsInfo )
|
||||
{
|
||||
g_signal_handlers_unblock_by_func(node->GetData()->button,
|
||||
g_signal_handlers_unblock_by_func(info.button,
|
||||
(gpointer)gtk_radiobutton_clicked_callback, this);
|
||||
|
||||
node = node->GetNext();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -609,15 +608,12 @@ void wxRadioBox::DoApplyWidgetStyle(GtkRcStyle *style)
|
|||
{
|
||||
GTKFrameApplyWidgetStyle(GTK_FRAME(m_widget), style);
|
||||
|
||||
wxRadioBoxButtonsInfoList::compatibility_iterator node = m_buttonsInfo.GetFirst();
|
||||
while (node)
|
||||
for ( const auto& info : m_buttonsInfo )
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET( node->GetData()->button );
|
||||
GtkWidget *widget = GTK_WIDGET( info.button );
|
||||
|
||||
GTKApplyStyle(widget, style);
|
||||
GTKApplyStyle(gtk_bin_get_child(GTK_BIN(widget)), style);
|
||||
|
||||
node = node->GetNext();
|
||||
}
|
||||
|
||||
#ifndef __WXGTK3__
|
||||
|
|
@ -642,13 +638,11 @@ void wxRadioBox::GTKApplyToolTip(const char* tip)
|
|||
{
|
||||
// set this tooltip for all radiobuttons which don't have their own tips
|
||||
unsigned n = 0;
|
||||
for ( wxRadioBoxButtonsInfoList::compatibility_iterator node = m_buttonsInfo.GetFirst();
|
||||
node;
|
||||
node = node->GetNext(), n++ )
|
||||
for ( const auto& info : m_buttonsInfo )
|
||||
{
|
||||
if ( !GetItemToolTip(n) )
|
||||
if ( !GetItemToolTip(n++) )
|
||||
{
|
||||
wxToolTip::GTKApply(GTK_WIDGET(node->GetData()->button), tip);
|
||||
wxToolTip::GTKApply(GTK_WIDGET(info.button), tip);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -661,7 +655,7 @@ void wxRadioBox::DoSetItemToolTip(unsigned int n, wxToolTip *tooltip)
|
|||
if ( tooltip )
|
||||
buf = tooltip->GetTip().utf8_str();
|
||||
|
||||
wxToolTip::GTKApply(GTK_WIDGET(m_buttonsInfo[n]->button), buf);
|
||||
wxToolTip::GTKApply(GTK_WIDGET(m_buttonsInfo[n].button), buf);
|
||||
}
|
||||
|
||||
#endif // wxUSE_TOOLTIPS
|
||||
|
|
@ -670,16 +664,13 @@ GdkWindow *wxRadioBox::GTKGetWindow(wxArrayGdkWindows& windows) const
|
|||
{
|
||||
windows.push_back(gtk_widget_get_window(m_widget));
|
||||
|
||||
wxRadioBoxButtonsInfoList::compatibility_iterator node = m_buttonsInfo.GetFirst();
|
||||
while (node)
|
||||
for ( const auto& info : m_buttonsInfo )
|
||||
{
|
||||
GtkWidget *button = GTK_WIDGET( node->GetData()->button );
|
||||
GtkWidget *button = GTK_WIDGET( info.button );
|
||||
|
||||
// don't put null pointers in the 'windows' array!
|
||||
if (gtk_widget_get_window(button))
|
||||
windows.push_back(gtk_widget_get_window(button));
|
||||
|
||||
node = node->GetNext();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
|
|
@ -696,11 +687,12 @@ int wxRadioBox::GetItemFromPoint(const wxPoint& point) const
|
|||
{
|
||||
const wxPoint pt = ScreenToClient(point);
|
||||
unsigned n = 0;
|
||||
for ( wxRadioBoxButtonsInfoList::compatibility_iterator
|
||||
node = m_buttonsInfo.GetFirst(); node; node = node->GetNext(), n++ )
|
||||
for ( const auto& info : m_buttonsInfo )
|
||||
{
|
||||
if ( m_buttonsInfo[n]->rect.Contains(pt) )
|
||||
if ( info.rect.Contains(pt) )
|
||||
return n;
|
||||
|
||||
++n;
|
||||
}
|
||||
|
||||
return wxNOT_FOUND;
|
||||
|
|
|
|||
|
|
@ -318,9 +318,10 @@ wxRecursionGuardFlag g_inSizeAllocate = 0;
|
|||
|
||||
#ifdef wxGTK_HAS_GESTURES_SUPPORT
|
||||
|
||||
#include "wx/hashmap.h"
|
||||
#include "wx/private/extfield.h"
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
|
|
@ -359,9 +360,7 @@ public:
|
|||
GtkGesture* m_long_press_gesture;
|
||||
};
|
||||
|
||||
WX_DECLARE_HASH_MAP(wxWindow*, wxWindowGesturesData*,
|
||||
wxPointerHash, wxPointerEqual,
|
||||
wxWindowGesturesMap);
|
||||
using wxWindowGesturesMap = std::unordered_map<wxWindow*, wxWindowGesturesData*>;
|
||||
|
||||
typedef wxExternalField<wxWindow,
|
||||
wxWindowGesturesData,
|
||||
|
|
|
|||
|
|
@ -29,8 +29,7 @@
|
|||
#include "wx/clipbrd.h"
|
||||
#include "wx/recguard.h"
|
||||
|
||||
#include "wx/arrimpl.cpp"
|
||||
#include "wx/listimpl.cpp"
|
||||
#include <list>
|
||||
|
||||
// uncomment this line to visually show the extent of the selection
|
||||
//#define DEBUG_HTML_SELECTION
|
||||
|
|
@ -139,14 +138,20 @@ private:
|
|||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// our private arrays:
|
||||
// our private containers: they have to be classes as they're forward-declared
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
WX_DECLARE_OBJARRAY(wxHtmlHistoryItem, wxHtmlHistoryArray);
|
||||
WX_DEFINE_OBJARRAY(wxHtmlHistoryArray)
|
||||
class wxHtmlHistoryArray : public std::vector<wxHtmlHistoryItem>
|
||||
{
|
||||
public:
|
||||
wxHtmlHistoryArray() = default;
|
||||
};
|
||||
|
||||
WX_DECLARE_LIST(wxHtmlProcessor, wxHtmlProcessorList);
|
||||
WX_DEFINE_LIST(wxHtmlProcessorList)
|
||||
class wxHtmlProcessorList : public std::list<std::unique_ptr<wxHtmlProcessor>>
|
||||
{
|
||||
public:
|
||||
wxHtmlProcessorList() = default;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxHtmlWindowMouseHelper
|
||||
|
|
@ -289,8 +294,6 @@ void wxHtmlWindow::CleanUpStatics()
|
|||
{
|
||||
wxDELETE(m_DefaultFilter);
|
||||
WX_CLEAR_LIST(wxList, m_Filters);
|
||||
if (m_GlobalProcessors)
|
||||
WX_CLEAR_LIST(wxHtmlProcessorList, *m_GlobalProcessors);
|
||||
wxDELETE(m_GlobalProcessors);
|
||||
wxDELETE(ms_cursorLink);
|
||||
wxDELETE(ms_cursorText);
|
||||
|
|
@ -367,11 +370,6 @@ wxHtmlWindow::~wxHtmlWindow()
|
|||
|
||||
delete m_Cell;
|
||||
|
||||
if ( m_Processors )
|
||||
{
|
||||
WX_CLEAR_LIST(wxHtmlProcessorList, *m_Processors);
|
||||
}
|
||||
|
||||
delete m_Parser;
|
||||
delete m_FS;
|
||||
delete m_History;
|
||||
|
|
@ -450,34 +448,35 @@ bool wxHtmlWindow::DoSetPage(const wxString& source)
|
|||
// pass HTML through registered processors:
|
||||
if (m_Processors || m_GlobalProcessors)
|
||||
{
|
||||
wxHtmlProcessorList::compatibility_iterator nodeL, nodeG;
|
||||
const wxHtmlProcessorList::iterator end;
|
||||
wxHtmlProcessorList::iterator nodeL, nodeG;
|
||||
|
||||
if ( m_Processors )
|
||||
nodeL = m_Processors->GetFirst();
|
||||
nodeL = m_Processors->begin();
|
||||
if ( m_GlobalProcessors )
|
||||
nodeG = m_GlobalProcessors->GetFirst();
|
||||
nodeG = m_GlobalProcessors->begin();
|
||||
|
||||
// VS: there are two lists, global and local, both of them sorted by
|
||||
// priority. Since we have to go through _both_ lists with
|
||||
// decreasing priority, we "merge-sort" the lists on-line by
|
||||
// processing that one of the two heads that has higher priority
|
||||
// in every iteration
|
||||
while (nodeL || nodeG)
|
||||
while (nodeL != end || nodeG != end)
|
||||
{
|
||||
int prL, prG;
|
||||
prL = (nodeL) ? nodeL->GetData()->GetPriority() : -1;
|
||||
prG = (nodeG) ? nodeG->GetData()->GetPriority() : -1;
|
||||
prL = nodeL != end ? (*nodeL)->GetPriority() : -1;
|
||||
prG = nodeG != end ? (*nodeG)->GetPriority() : -1;
|
||||
if (prL > prG)
|
||||
{
|
||||
if (nodeL->GetData()->IsEnabled())
|
||||
newsrc = nodeL->GetData()->Process(newsrc);
|
||||
nodeL = nodeL->GetNext();
|
||||
if ((*nodeL)->IsEnabled())
|
||||
newsrc = (*nodeL)->Process(newsrc);
|
||||
++nodeL;
|
||||
}
|
||||
else // prL <= prG
|
||||
{
|
||||
if (nodeG->GetData()->IsEnabled())
|
||||
newsrc = nodeG->GetData()->Process(newsrc);
|
||||
nodeG = nodeG->GetNext();
|
||||
if ((*nodeG)->IsEnabled())
|
||||
newsrc = (*nodeG)->Process(newsrc);
|
||||
++nodeG;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -648,16 +647,18 @@ bool wxHtmlWindow::LoadPage(const wxString& location)
|
|||
|
||||
if (m_HistoryOn) // add this page to history there:
|
||||
{
|
||||
int c = m_History->GetCount() - (m_HistoryPos + 1);
|
||||
int c = m_History->size() - (m_HistoryPos + 1);
|
||||
|
||||
if (m_HistoryPos < 0 ||
|
||||
(*m_History)[m_HistoryPos].GetPage() != m_OpenedPage ||
|
||||
(*m_History)[m_HistoryPos].GetAnchor() != m_OpenedAnchor)
|
||||
{
|
||||
m_HistoryPos++;
|
||||
for (int i = 0; i < c; i++)
|
||||
m_History->RemoveAt(m_HistoryPos);
|
||||
m_History->Add(new wxHtmlHistoryItem(m_OpenedPage, m_OpenedAnchor));
|
||||
|
||||
const auto first = m_History->begin() + m_HistoryPos;
|
||||
m_History->erase(first, first + c);
|
||||
|
||||
m_History->emplace_back(m_OpenedPage, m_OpenedAnchor);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -859,7 +860,7 @@ bool wxHtmlWindow::HistoryForward()
|
|||
wxString a, l;
|
||||
|
||||
if (m_HistoryPos == -1) return false;
|
||||
if (m_HistoryPos >= (int)m_History->GetCount() - 1)return false;
|
||||
if (m_HistoryPos >= (int)m_History->size() - 1)return false;
|
||||
|
||||
m_OpenedPage.clear(); // this will disable adding new entry into history in LoadPage()
|
||||
|
||||
|
|
@ -880,14 +881,14 @@ bool wxHtmlWindow::HistoryForward()
|
|||
bool wxHtmlWindow::HistoryCanForward()
|
||||
{
|
||||
if (m_HistoryPos == -1) return false;
|
||||
if (m_HistoryPos >= (int)m_History->GetCount() - 1)return false;
|
||||
if (m_HistoryPos >= (int)m_History->size() - 1)return false;
|
||||
return true ;
|
||||
}
|
||||
|
||||
|
||||
void wxHtmlWindow::HistoryClear()
|
||||
{
|
||||
m_History->Empty();
|
||||
m_History->clear();
|
||||
m_HistoryPos = -1;
|
||||
}
|
||||
|
||||
|
|
@ -897,17 +898,20 @@ void wxHtmlWindow::AddProcessor(wxHtmlProcessor *processor)
|
|||
{
|
||||
m_Processors = new wxHtmlProcessorList;
|
||||
}
|
||||
wxHtmlProcessorList::compatibility_iterator node;
|
||||
|
||||
for (node = m_Processors->GetFirst(); node; node = node->GetNext())
|
||||
std::unique_ptr<wxHtmlProcessor> processorPtr{processor};
|
||||
|
||||
wxHtmlProcessorList::iterator node;
|
||||
|
||||
for (node = m_Processors->begin(); node != m_Processors->end(); ++node)
|
||||
{
|
||||
if (processor->GetPriority() > node->GetData()->GetPriority())
|
||||
if (processor->GetPriority() > (*node)->GetPriority())
|
||||
{
|
||||
m_Processors->Insert(node, processor);
|
||||
m_Processors->insert(node, std::move(processorPtr));
|
||||
return;
|
||||
}
|
||||
}
|
||||
m_Processors->Append(processor);
|
||||
m_Processors->push_back(std::move(processorPtr));
|
||||
}
|
||||
|
||||
/*static */ void wxHtmlWindow::AddGlobalProcessor(wxHtmlProcessor *processor)
|
||||
|
|
@ -916,17 +920,20 @@ void wxHtmlWindow::AddProcessor(wxHtmlProcessor *processor)
|
|||
{
|
||||
m_GlobalProcessors = new wxHtmlProcessorList;
|
||||
}
|
||||
wxHtmlProcessorList::compatibility_iterator node;
|
||||
|
||||
for (node = m_GlobalProcessors->GetFirst(); node; node = node->GetNext())
|
||||
std::unique_ptr<wxHtmlProcessor> processorPtr{processor};
|
||||
|
||||
wxHtmlProcessorList::iterator node;
|
||||
|
||||
for (node = m_GlobalProcessors->begin(); node != m_GlobalProcessors->end(); ++node)
|
||||
{
|
||||
if (processor->GetPriority() > node->GetData()->GetPriority())
|
||||
if (processor->GetPriority() > (*node)->GetPriority())
|
||||
{
|
||||
m_GlobalProcessors->Insert(node, processor);
|
||||
m_GlobalProcessors->insert(node, std::move(processorPtr));
|
||||
return;
|
||||
}
|
||||
}
|
||||
m_GlobalProcessors->Append(processor);
|
||||
m_GlobalProcessors->push_back(std::move(processorPtr));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -39,11 +39,6 @@ FORCE_LINK_ME(m_image)
|
|||
|
||||
|
||||
|
||||
WX_DECLARE_OBJARRAY(int, CoordArray);
|
||||
#include "wx/arrimpl.cpp" // this is a magic incantation which must be done!
|
||||
WX_DEFINE_OBJARRAY(CoordArray)
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// wxHtmlImageMapAreaCell
|
||||
// 0-width, 0-height cell that represents single area in
|
||||
|
|
@ -55,7 +50,7 @@ class wxHtmlImageMapAreaCell : public wxHtmlCell
|
|||
public:
|
||||
enum celltype { CIRCLE, RECT, POLY };
|
||||
protected:
|
||||
CoordArray coords;
|
||||
std::vector<int> coords;
|
||||
celltype type;
|
||||
int radius;
|
||||
public:
|
||||
|
|
@ -82,10 +77,10 @@ wxHtmlImageMapAreaCell::wxHtmlImageMapAreaCell( wxHtmlImageMapAreaCell::celltype
|
|||
type = t;
|
||||
while ((i = x.Find( ',' )) != wxNOT_FOUND)
|
||||
{
|
||||
coords.Add( (int)(pixel_scale * (double)wxAtoi( x.Left( i ).c_str())) );
|
||||
coords.push_back( (int)(pixel_scale * (double)wxAtoi( x.Left( i ).c_str())) );
|
||||
x = x.Mid( i + 1 );
|
||||
}
|
||||
coords.Add( (int)(pixel_scale * (double)wxAtoi( x.c_str())) );
|
||||
coords.push_back( (int)(pixel_scale * (double)wxAtoi( x.c_str())) );
|
||||
}
|
||||
|
||||
wxHtmlLinkInfo *wxHtmlImageMapAreaCell::GetLink( int x, int y ) const
|
||||
|
|
@ -93,7 +88,7 @@ wxHtmlLinkInfo *wxHtmlImageMapAreaCell::GetLink( int x, int y ) const
|
|||
switch (type)
|
||||
{
|
||||
case RECT:
|
||||
if ( coords.GetCount() == 4 )
|
||||
if ( coords.size() == 4 )
|
||||
{
|
||||
int l, t, r, b;
|
||||
|
||||
|
|
@ -108,7 +103,7 @@ wxHtmlLinkInfo *wxHtmlImageMapAreaCell::GetLink( int x, int y ) const
|
|||
}
|
||||
break;
|
||||
case CIRCLE:
|
||||
if ( coords.GetCount() == 3 )
|
||||
if ( coords.size() == 3 )
|
||||
{
|
||||
int l, t, r;
|
||||
double d;
|
||||
|
|
@ -124,12 +119,12 @@ wxHtmlLinkInfo *wxHtmlImageMapAreaCell::GetLink( int x, int y ) const
|
|||
}
|
||||
break;
|
||||
case POLY:
|
||||
if (coords.GetCount() >= 6)
|
||||
if (coords.size() >= 6)
|
||||
{
|
||||
int intersects = 0;
|
||||
int wherex = x;
|
||||
int wherey = y;
|
||||
int totalv = coords.GetCount() / 2;
|
||||
int totalv = coords.size() / 2;
|
||||
int totalc = totalv * 2;
|
||||
int xval = coords[totalc - 2];
|
||||
int yval = coords[totalc - 1];
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@
|
|||
#ifndef WX_PRECOMP
|
||||
#include <stdio.h>
|
||||
|
||||
#include "wx/list.h"
|
||||
#include "wx/utils.h"
|
||||
#include "wx/app.h"
|
||||
#include "wx/palette.h"
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@
|
|||
#include "wx/brush.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/list.h"
|
||||
#include "wx/utils.h"
|
||||
#include "wx/app.h"
|
||||
#include "wx/bitmap.h"
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@
|
|||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/string.h"
|
||||
#include "wx/hashmap.h"
|
||||
#include "wx/log.h"
|
||||
#include "wx/window.h"
|
||||
#endif
|
||||
|
|
@ -35,6 +34,8 @@
|
|||
#include "wx/msw/private.h"
|
||||
#include "wx/msw/private/paint.h"
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// local data structures
|
||||
// ----------------------------------------------------------------------------
|
||||
|
|
@ -128,9 +129,7 @@ private:
|
|||
// all of them because we can't call BeginPaint() more than once. So we cache
|
||||
// the first HDC created for the window in this map and then reuse it later if
|
||||
// needed. And, of course, remove it from the map when the painting is done.
|
||||
WX_DECLARE_HASH_MAP(wxWindow *, wxPaintDCInfo *,
|
||||
wxPointerHash, wxPointerEqual,
|
||||
PaintDCInfos);
|
||||
using PaintDCInfos = std::unordered_map<wxWindow*, wxPaintDCInfo*>;
|
||||
|
||||
PaintDCInfos gs_PaintDCInfos;
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@
|
|||
#ifndef WX_PRECOMP
|
||||
#include "wx/utils.h"
|
||||
#include "wx/app.h"
|
||||
#include "wx/hashmap.h"
|
||||
#include "wx/module.h"
|
||||
#endif
|
||||
|
||||
|
|
@ -39,6 +38,8 @@
|
|||
#include <string.h>
|
||||
#include <ddeml.h>
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// macros and constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
|
@ -85,7 +86,7 @@ static void DDELogError(const wxString& s, UINT error = DMLERR_NO_ERROR);
|
|||
// global variables
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WX_DECLARE_STRING_HASH_MAP( HSZ, wxAtomMap );
|
||||
using wxAtomMap = std::unordered_map<wxString, HSZ>;
|
||||
|
||||
static DWORD DDEIdInst = 0L;
|
||||
static wxDDEConnection *DDECurrentlyConnecting = nullptr;
|
||||
|
|
|
|||
|
|
@ -97,26 +97,26 @@ wxDynamicLibraryDetailsCreator::EnumModulesProc(const wxChar* name,
|
|||
{
|
||||
EnumModulesProcParams *params = (EnumModulesProcParams *)data;
|
||||
|
||||
wxDynamicLibraryDetails *details = new wxDynamicLibraryDetails;
|
||||
wxDynamicLibraryDetails details;
|
||||
|
||||
// fill in simple properties
|
||||
details->m_name = name;
|
||||
details->m_address = wxUIntToPtr(base);
|
||||
details->m_length = size;
|
||||
details.m_name = name;
|
||||
details.m_address = wxUIntToPtr(base);
|
||||
details.m_length = size;
|
||||
|
||||
// to get the version, we first need the full path
|
||||
const HMODULE hmod = wxDynamicLibrary::MSWGetModuleHandle
|
||||
(
|
||||
details->m_name,
|
||||
details->m_address
|
||||
details.m_name,
|
||||
details.m_address
|
||||
);
|
||||
if ( hmod )
|
||||
{
|
||||
wxString fullname = wxGetFullModuleName(hmod);
|
||||
if ( !fullname.empty() )
|
||||
{
|
||||
details->m_path = fullname;
|
||||
details->m_version = GetFileVersion(fullname);
|
||||
details.m_path = fullname;
|
||||
details.m_version = GetFileVersion(fullname);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,12 +34,8 @@
|
|||
|
||||
#include "wx/tooltip.h"
|
||||
#if wxUSE_THREADS
|
||||
// define the list of MSG strutures
|
||||
WX_DECLARE_LIST(MSG, wxMsgList);
|
||||
|
||||
#include "wx/listimpl.cpp"
|
||||
|
||||
WX_DEFINE_LIST(wxMsgList)
|
||||
#include <list>
|
||||
using wxMsgList = std::list<MSG>;
|
||||
#endif // wxUSE_THREADS
|
||||
|
||||
// ============================================================================
|
||||
|
|
@ -189,8 +185,7 @@ bool wxGUIEventLoop::Dispatch()
|
|||
// the message will be processed twice
|
||||
if ( !wxIsWaitingForThread() || msg.message != WM_COMMAND )
|
||||
{
|
||||
MSG* pMsg = new MSG(msg);
|
||||
s_aSavedMessages.Append(pMsg);
|
||||
s_aSavedMessages.push_back(msg);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -206,16 +201,9 @@ bool wxGUIEventLoop::Dispatch()
|
|||
{
|
||||
s_hadGuiLock = true;
|
||||
|
||||
wxMsgList::compatibility_iterator node = s_aSavedMessages.GetFirst();
|
||||
while (node)
|
||||
for ( ; !s_aSavedMessages.empty(); s_aSavedMessages.pop_front() )
|
||||
{
|
||||
MSG* pMsg = node->GetData();
|
||||
s_aSavedMessages.Erase(node);
|
||||
|
||||
ProcessMessage(pMsg);
|
||||
delete pMsg;
|
||||
|
||||
node = s_aSavedMessages.GetFirst();
|
||||
ProcessMessage(&s_aSavedMessages.front());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -250,11 +238,10 @@ void wxGUIEventLoop::OnNextIteration()
|
|||
// Yield to incoming messages
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include <wx/arrimpl.cpp>
|
||||
WX_DEFINE_OBJARRAY(wxMSGArray);
|
||||
|
||||
void wxGUIEventLoop::DoYieldFor(long eventsToProcess)
|
||||
{
|
||||
std::vector<MSG> msgsToProcess;
|
||||
|
||||
// we don't want to process WM_QUIT from here - it should be processed in
|
||||
// the main event loop in order to stop it
|
||||
MSG msg;
|
||||
|
|
@ -396,7 +383,7 @@ void wxGUIEventLoop::DoYieldFor(long eventsToProcess)
|
|||
{
|
||||
// remove the message and store it
|
||||
::GetMessage(&msg, nullptr, 0, 0);
|
||||
m_arrMSG.Add(msg);
|
||||
msgsToProcess.push_back(msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -404,11 +391,8 @@ void wxGUIEventLoop::DoYieldFor(long eventsToProcess)
|
|||
|
||||
// put back unprocessed events in the queue
|
||||
DWORD id = GetCurrentThreadId();
|
||||
for (size_t i=0; i<m_arrMSG.GetCount(); i++)
|
||||
for ( const auto& m : msgsToProcess )
|
||||
{
|
||||
PostThreadMessage(id, m_arrMSG[i].message,
|
||||
m_arrMSG[i].wParam, m_arrMSG[i].lParam);
|
||||
PostThreadMessage(id, m.message, m.wParam, m.lParam);
|
||||
}
|
||||
|
||||
m_arrMSG.Clear();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@
|
|||
#include "wx/font.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/list.h"
|
||||
#include "wx/utils.h"
|
||||
#include "wx/app.h"
|
||||
#include "wx/log.h"
|
||||
|
|
|
|||
|
|
@ -74,6 +74,8 @@
|
|||
#include "wx/stack.h"
|
||||
#include "wx/sharedptr.h"
|
||||
|
||||
#include <list>
|
||||
|
||||
// This must be the last header included to only affect the DEFINE_GUID()
|
||||
// occurrences below but not any GUIDs declared in the standard files included
|
||||
// above.
|
||||
|
|
@ -670,12 +672,6 @@ public:
|
|||
// A Direct2D resource manager handles the device-dependent
|
||||
// resource holders attached to it by requesting them to
|
||||
// release their resources when the API invalidates.
|
||||
// NOTE: We're using a list because we expect to have multiple
|
||||
// insertions but very rarely a traversal (if ever).
|
||||
WX_DECLARE_LIST(wxManagedResourceHolder, wxManagedResourceListType);
|
||||
#include <wx/listimpl.cpp>
|
||||
WX_DEFINE_LIST(wxManagedResourceListType);
|
||||
|
||||
class wxD2DResourceManager: public wxD2DContextSupplier
|
||||
{
|
||||
public:
|
||||
|
|
@ -691,16 +687,15 @@ public:
|
|||
|
||||
void ReleaseResources()
|
||||
{
|
||||
wxManagedResourceListType::iterator it;
|
||||
for (it = m_resources.begin(); it != m_resources.end(); ++it)
|
||||
for (const auto& resource : m_resources )
|
||||
{
|
||||
(*it)->ReleaseResource();
|
||||
resource->ReleaseResource();
|
||||
}
|
||||
|
||||
// Check that all resources were released
|
||||
for (it = m_resources.begin(); it != m_resources.end(); ++it)
|
||||
for (const auto& resource : m_resources )
|
||||
{
|
||||
wxCHECK_RET(!(*it)->IsResourceAcquired(), "One or more device-dependent resources failed to release");
|
||||
wxCHECK_RET(!resource->IsResourceAcquired(), "One or more device-dependent resources failed to release");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -714,7 +709,9 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
wxManagedResourceListType m_resources;
|
||||
// NOTE: We're using a list because we expect to have multiple
|
||||
// insertions but very rarely a traversal (if ever).
|
||||
std::list<wxManagedResourceHolder*> m_resources;
|
||||
};
|
||||
|
||||
// A Direct2D resource holder manages device dependent resources
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/list.h"
|
||||
#include "wx/utils.h"
|
||||
#include "wx/app.h"
|
||||
#include "wx/icon.h"
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue