Commit 6c737bc1 authored by dickelbeck's avatar dickelbeck

fix for wxwidgets 2.9

parent d4bd033a
...@@ -129,14 +129,17 @@ struct LAYER_SPEC ...@@ -129,14 +129,17 @@ struct LAYER_SPEC
*/ */
class LAYER_WIDGET : public LAYER_PANEL_BASE class LAYER_WIDGET : public LAYER_PANEL_BASE
{ {
#define MAX_LAYER_ROWS 64
#define LAYER_COLUMN_COUNT 4
protected: protected:
wxBitmap* m_BlankBitmap; wxBitmap* m_BlankBitmap;
wxBitmap* m_RightArrowBitmap; wxBitmap* m_RightArrowBitmap;
wxSize m_BitmapSize; wxSize m_BitmapSize;
wxStaticBitmap* m_Bitmaps[64]; wxStaticBitmap* m_Bitmaps[MAX_LAYER_ROWS];
int m_CurrentRow; ///< visual row of layer list int m_CurrentRow; ///< selected row of layer list
#define LAYER_COLUMN_COUNT 4
/** /**
* Function makeColorButton * Function makeColorButton
...@@ -221,7 +224,6 @@ protected: ...@@ -221,7 +224,6 @@ protected:
printf("OnRightDownLayers\n"); printf("OnRightDownLayers\n");
} }
/** /**
* Function getLayerComp * Function getLayerComp
* returns the component within the m_LayersFlexGridSizer at aSizerNdx. * returns the component within the m_LayersFlexGridSizer at aSizerNdx.
...@@ -253,14 +255,13 @@ protected: ...@@ -253,14 +255,13 @@ protected:
return -1; return -1;
} }
/** /**
* Function insertLayerRow * Function insertLayerRow
* appends or inserts a new row in the layer portion of the widget. * appends or inserts a new row in the layer portion of the widget.
*/ */
void insertLayerRow( int aRow, const LAYER_SPEC& aSpec ) void insertLayerRow( int aRow, const LAYER_SPEC& aSpec )
{ {
wxASSERT( aRow >= 0 ); wxASSERT( aRow >= 0 && aRow < MAX_LAYER_ROWS );
size_t index = aRow * LAYER_COLUMN_COUNT; size_t index = aRow * LAYER_COLUMN_COUNT;
...@@ -272,24 +273,26 @@ protected: ...@@ -272,24 +273,26 @@ protected:
m_Bitmaps[aRow] = new wxStaticBitmap( m_LayerScrolledWindow, aSpec.layer, *m_BlankBitmap, m_Bitmaps[aRow] = new wxStaticBitmap( m_LayerScrolledWindow, aSpec.layer, *m_BlankBitmap,
wxDefaultPosition, m_BitmapSize ); wxDefaultPosition, m_BitmapSize );
m_Bitmaps[aRow]->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( LAYER_WIDGET::OnLeftDownLayers ), NULL, this ); m_Bitmaps[aRow]->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( LAYER_WIDGET::OnLeftDownLayers ), NULL, this );
m_LayersFlexGridSizer->Insert( index+0, m_Bitmaps[aRow], wxSizerFlags().Align( wxALIGN_CENTER_VERTICAL ) ); m_LayersFlexGridSizer->Insert( index+0,
new wxSizerItem( m_Bitmaps[aRow], wxSizerFlags().Align( wxALIGN_CENTER_VERTICAL ) ) );
// column 1 // column 1
wxBitmapButton* bmb = makeColorButton( aSpec.colorIndex, aSpec.layer ); wxBitmapButton* bmb = makeColorButton( aSpec.colorIndex, aSpec.layer );
bmb->SetToolTip( _("Right click to change layer color, left click to select layer" ) ); bmb->SetToolTip( _("Right click to change layer color, left click to select layer" ) );
m_LayersFlexGridSizer->Insert( index+1, bmb, flags ); m_LayersFlexGridSizer->Insert( index+1,
new wxSizerItem( bmb, flags ) );
// column 2 // column 2
wxStaticText* st = new wxStaticText( m_LayerScrolledWindow, aSpec.layer, aSpec.layerName ); wxStaticText* st = new wxStaticText( m_LayerScrolledWindow, aSpec.layer, aSpec.layerName );
st->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( LAYER_WIDGET::OnLeftDownLayers ), NULL, this ); st->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( LAYER_WIDGET::OnLeftDownLayers ), NULL, this );
st->SetToolTip( _( "Click here to select this layer" ) ); st->SetToolTip( _( "Click here to select this layer" ) );
m_LayersFlexGridSizer->Insert( index+2, st, m_LayersFlexGridSizer->Insert( index+2,
wxSizerFlags().Align( wxALIGN_CENTER_VERTICAL ) ); new wxSizerItem( st, wxSizerFlags().Align( wxALIGN_CENTER_VERTICAL )) );
// column 3 // column 3
wxCheckBox* cb = new wxCheckBox( m_LayerScrolledWindow, aSpec.layer, wxEmptyString ); wxCheckBox* cb = new wxCheckBox( m_LayerScrolledWindow, aSpec.layer, wxEmptyString );
cb->SetToolTip( _( "Enable this for visibility" ) ); cb->SetToolTip( _( "Enable this for visibility" ) );
m_LayersFlexGridSizer->Insert( index+3, cb, flags ); m_LayersFlexGridSizer->Insert( index+3, new wxSizerItem( cb, flags ) );
} }
public: public:
...@@ -313,6 +316,10 @@ public: ...@@ -313,6 +316,10 @@ public:
AppendLayerRow( LAYER_SPEC( wxT("layer_4_you"), 3, BLUE ) ); AppendLayerRow( LAYER_SPEC( wxT("layer_4_you"), 3, BLUE ) );
SelectLayerRow( 1 ); SelectLayerRow( 1 );
Fit();
SetMinSize( GetSize() );
} }
...@@ -362,7 +369,6 @@ public: ...@@ -362,7 +369,6 @@ public:
return false; return false;
} }
/** /**
* Function SelectLayer * Function SelectLayer
* changes the row selection in the layer list to the given layer. * changes the row selection in the layer list to the given layer.
...@@ -373,6 +379,7 @@ public: ...@@ -373,6 +379,7 @@ public:
return SelectLayerRow( row ); return SelectLayerRow( row );
} }
//-----<abstract functions>-------------------------------------------
/** /**
* Function ColorChange * Function ColorChange
...@@ -387,15 +394,10 @@ public: ...@@ -387,15 +394,10 @@ public:
* will handle this accordingly, and can deny the change by returning false. * will handle this accordingly, and can deny the change by returning false.
*/ */
virtual bool LayerChange( int aLayer ) = 0; virtual bool LayerChange( int aLayer ) = 0;
};
//-----</abstract functions>------------------------------------------
};
/**
* class LAYER_WIDGET : public wxPanel
* {
* };
*/
#if defined(STAND_ALONE) #if defined(STAND_ALONE)
...@@ -408,6 +410,9 @@ public: ...@@ -408,6 +410,9 @@ public:
*/ */
class MYFRAME : public wxFrame class MYFRAME : public wxFrame
{ {
// example of how to derive from LAYER_WIDGET in order to provide the
// abstract methods.
class MYLAYERS : public LAYER_WIDGET class MYLAYERS : public LAYER_WIDGET
{ {
MYFRAME* frame; MYFRAME* frame;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment