Add opacity control feature to wxColourData.
Added internal flag (with corresponding accessors) which purpose is to enable/disable modifying the opacity of the colours in colour dialogs.
This commit is contained in:
@@ -26,6 +26,8 @@ public:
|
|||||||
|
|
||||||
void SetChooseFull(bool flag) { m_chooseFull = flag; }
|
void SetChooseFull(bool flag) { m_chooseFull = flag; }
|
||||||
bool GetChooseFull() const { return m_chooseFull; }
|
bool GetChooseFull() const { return m_chooseFull; }
|
||||||
|
void SetChooseAlpha(bool flag) { m_chooseAlpha = flag; }
|
||||||
|
bool GetChooseAlpha() const { return m_chooseAlpha; }
|
||||||
void SetColour(const wxColour& colour) { m_dataColour = colour; }
|
void SetColour(const wxColour& colour) { m_dataColour = colour; }
|
||||||
const wxColour& GetColour() const { return m_dataColour; }
|
const wxColour& GetColour() const { return m_dataColour; }
|
||||||
wxColour& GetColour() { return m_dataColour; }
|
wxColour& GetColour() { return m_dataColour; }
|
||||||
@@ -45,6 +47,9 @@ public:
|
|||||||
wxColour m_custColours[NUM_CUSTOM];
|
wxColour m_custColours[NUM_CUSTOM];
|
||||||
bool m_chooseFull;
|
bool m_chooseFull;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool m_chooseAlpha;
|
||||||
|
|
||||||
wxDECLARE_DYNAMIC_CLASS(wxColourData);
|
wxDECLARE_DYNAMIC_CLASS(wxColourData);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -25,6 +25,7 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxColourData, wxObject);
|
|||||||
wxColourData::wxColourData()
|
wxColourData::wxColourData()
|
||||||
{
|
{
|
||||||
m_chooseFull = false;
|
m_chooseFull = false;
|
||||||
|
m_chooseAlpha = false;
|
||||||
m_dataColour.Set(0,0,0);
|
m_dataColour.Set(0,0,0);
|
||||||
// m_custColours are wxNullColours initially
|
// m_custColours are wxNullColours initially
|
||||||
}
|
}
|
||||||
@@ -61,6 +62,7 @@ wxColourData& wxColourData::operator=(const wxColourData& data)
|
|||||||
|
|
||||||
m_dataColour = data.m_dataColour;
|
m_dataColour = data.m_dataColour;
|
||||||
m_chooseFull = data.m_chooseFull;
|
m_chooseFull = data.m_chooseFull;
|
||||||
|
m_chooseAlpha = data.m_chooseAlpha;
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@@ -85,6 +87,9 @@ wxString wxColourData::ToString() const
|
|||||||
str += clr.GetAsString(wxC2S_HTML_SYNTAX);
|
str += clr.GetAsString(wxC2S_HTML_SYNTAX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
str.Append(wxCOL_DATA_SEP);
|
||||||
|
str.Append(m_chooseAlpha ? '1' : '0');
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,6 +107,14 @@ bool wxColourData::FromString(const wxString& str)
|
|||||||
else
|
else
|
||||||
success = m_custColours[i].Set(token);
|
success = m_custColours[i].Set(token);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( success )
|
||||||
|
{
|
||||||
|
token = tokenizer.GetNextToken();
|
||||||
|
m_chooseAlpha = token == wxS("1");
|
||||||
|
success = m_chooseAlpha || token == wxS("0");
|
||||||
|
}
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user