make defaultTextSize() static

This commit is contained in:
2024-11-26 08:58:47 -06:00
committed by Celtic Minstrel
parent 992fae0ed8
commit 121f54fbe2
2 changed files with 8 additions and 11 deletions

View File

@@ -21,18 +21,18 @@ cButton::cButton(sf::RenderWindow& parent) :
cControl(CTRL_BTN,parent),
wrapLabel(false),
type(BTN_REG),
textSize(defaultTextSize(type)),
textClr(sf::Color::Black),
fromList("none") {
defaultTextSize();
}
cButton::cButton(cDialog& parent) :
cControl(CTRL_BTN,parent),
wrapLabel(false),
type(BTN_REG),
textSize(defaultTextSize(type)),
textClr(parent.getDefTextClr()),
fromList("none") {
defaultTextSize();
}
/* This constructor is only called for LEDs. */
@@ -40,15 +40,12 @@ cButton::cButton(cDialog& parent,eControlType t) :
cControl(t,parent),
fromList("none"),
wrapLabel(false) {
defaultTextSize();
}
void cButton::defaultTextSize() {
if(textSize != 0) return;
if(type == BTN_TINY) textSize = 9;
else if(type == BTN_PUSH) textSize = 10;
else textSize = 12;
short cButton::defaultTextSize(eBtnType type) {
if(type == BTN_TINY) return 9;
else if(type == BTN_PUSH) return 10;
else return 12;
}
bool cButton::isClickable() const {

View File

@@ -74,12 +74,12 @@ protected:
cButton(cDialog& parent,eControlType t);
private:
bool manageFormat(eFormat prop, bool set, boost::any* val) override;
void defaultTextSize();
static short defaultTextSize(eBtnType type);
std::string fromList;
static rectangle btnRects[13][2];
protected:
/// Size of the button's descriptive text
short textSize = 0;
short textSize;
/// Determines whether the button's label should be word wrapped.
bool wrapLabel;
/// The button's text colour; only used by LED and tiny buttons