Skip to content

Commit

Permalink
universal switch to ofColor
Browse files Browse the repository at this point in the history
  • Loading branch information
Momo the Monster committed Jul 23, 2014
1 parent e999568 commit e8ed278
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 30 deletions.
28 changes: 14 additions & 14 deletions src/ofxSoftKey.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ ofxSoftKey::ofxSoftKey(int _key, ofBaseApp* _testapp) {



textColor = 0x000000;;
textBGColor = 0xCCCCCC;
borderColor = 0x000000;
hoverColor = 0x999999;
clickColor = 0xFF0000;
textColor = ofColor(0);
textBGColor = ofColor(204);
borderColor = ofColor(0);
hoverColor = ofColor(153);
clickColor = ofColor(255, 0, 0);
isLastInRow = false;

disableAppEvents();
Expand Down Expand Up @@ -95,17 +95,17 @@ void ofxSoftKey::draw() {

// Draw the background
ofFill();
if(isMouseOver()) ofSetHexColor(hoverColor);
else ofSetHexColor(textBGColor);
if(isMouseOver()) ofSetColor(hoverColor);
else ofSetColor(textBGColor);
ofRect(x, y, width, height);

// Draw the outline.
ofNoFill();
ofSetHexColor(borderColor);
ofSetColor(borderColor);
ofRect( x, y, width, height );

// Draw the actual letter
ofSetHexColor(textColor);
ofSetColor(textColor);
ofDrawBitmapString(label, x+10, y+height-10);

}
Expand All @@ -122,31 +122,31 @@ ofxSoftKey& ofxSoftKey::setKey(char key) {
}

//--------------------------------------------------------------
ofxSoftKey& ofxSoftKey::setTextColor(int c) {
ofxSoftKey& ofxSoftKey::setTextColor(ofColor c) {
this->textColor = c;
return *this;
}

//--------------------------------------------------------------
ofxSoftKey& ofxSoftKey::setTextBGColor(int c) {
ofxSoftKey& ofxSoftKey::setTextBGColor(ofColor c) {
this->textBGColor = c;
return *this;
}

//--------------------------------------------------------------
ofxSoftKey& ofxSoftKey::setBorderColor(int c) {
ofxSoftKey& ofxSoftKey::setBorderColor(ofColor c) {
this->borderColor = c;
return *this;
}

//--------------------------------------------------------------
ofxSoftKey& ofxSoftKey::setHoverColor(int c) {
ofxSoftKey& ofxSoftKey::setHoverColor(ofColor c) {
this->hoverColor = c;
return *this;
}

//--------------------------------------------------------------
ofxSoftKey& ofxSoftKey::setClickColor(int c) {
ofxSoftKey& ofxSoftKey::setClickColor(ofColor c) {
this->clickColor = c;
return *this;
}
Expand Down
12 changes: 6 additions & 6 deletions src/ofxSoftKey.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ class ofxSoftKey : public ofxMSAInteractiveObject {
ofxSoftKey& padRight(int right);

ofxSoftKey& setKey(const char key);
ofxSoftKey& setTextColor(int c);
ofxSoftKey& setTextBGColor(int c);
ofxSoftKey& setBorderColor(int c);
ofxSoftKey& setHoverColor(int c);
ofxSoftKey& setClickColor(int c);
ofxSoftKey& setTextColor(ofColor c);
ofxSoftKey& setTextBGColor(ofColor c);
ofxSoftKey& setBorderColor(ofColor c);
ofxSoftKey& setHoverColor(ofColor c);
ofxSoftKey& setClickColor(ofColor c);

//void setup();
//void update();
Expand All @@ -66,7 +66,7 @@ class ofxSoftKey : public ofxMSAInteractiveObject {
ofBaseApp* testapp;
int key;
string label;
int textColor, textBGColor, borderColor, hoverColor, clickColor;
ofColor textColor, textBGColor, borderColor, hoverColor, clickColor;


};
Expand Down
10 changes: 5 additions & 5 deletions src/ofxSoftKeyboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,35 +105,35 @@ void ofxSoftKeyboard::setPadding(int top, int right, int bottom, int left) {

//--------------------------------------------------------------

void ofxSoftKeyboard::setTextColor(int c){
void ofxSoftKeyboard::setTextColor(ofColor c){
for(auto &key: keys){
key->setTextColor( c );
}
}

//--------------------------------------------------------------
void ofxSoftKeyboard::setTextBGColor(int c){
void ofxSoftKeyboard::setTextBGColor(ofColor c){
for(auto &key: keys){
key->setTextBGColor( c );
}
}

//--------------------------------------------------------------
void ofxSoftKeyboard::setBorderColor(int c){
void ofxSoftKeyboard::setBorderColor(ofColor c){
for(auto &key: keys){
key->setBorderColor( c );
}
}

//--------------------------------------------------------------
void ofxSoftKeyboard::setHoverColor(int c){
void ofxSoftKeyboard::setHoverColor(ofColor c){
for(auto &key: keys){
key->setHoverColor( c );
}
}

//--------------------------------------------------------------
void ofxSoftKeyboard::setClickColor(int c){
void ofxSoftKeyboard::setClickColor(ofColor c){
for(auto &key: keys){
key->setClickColor( c );
}
Expand Down
10 changes: 5 additions & 5 deletions src/ofxSoftKeyboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ class ofxSoftKeyboard {
void newRow();

void setPadding(int top, int right, int bottom, int left);
void setTextColor(int c);
void setTextBGColor(int c);
void setBorderColor(int c);
void setHoverColor(int c);
void setClickColor(int c);
void setTextColor(ofColor c);
void setTextBGColor(ofColor c);
void setBorderColor(ofColor c);
void setHoverColor(ofColor c);
void setClickColor(ofColor c);


protected:
Expand Down

0 comments on commit e8ed278

Please sign in to comment.