fixed correct fallback
This commit is contained in:
parent
a6b3e25679
commit
5eaa343471
1 changed files with 122 additions and 88 deletions
210
src/WinButton.cc
210
src/WinButton.cc
|
@ -19,7 +19,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
/// $Id: WinButton.cc,v 1.10 2003/08/22 21:33:13 fluxgen Exp $
|
/// $Id: WinButton.cc,v 1.11 2003/09/12 22:52:22 fluxgen Exp $
|
||||||
|
|
||||||
#include "WinButton.hh"
|
#include "WinButton.hh"
|
||||||
#include "App.hh"
|
#include "App.hh"
|
||||||
|
@ -49,32 +49,38 @@ void WinButton::buttonReleaseEvent(XButtonEvent &event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void WinButton::drawType() {
|
void WinButton::drawType() {
|
||||||
|
bool used = false;
|
||||||
|
|
||||||
switch (m_type) {
|
switch (m_type) {
|
||||||
case MAXIMIZE:
|
case MAXIMIZE:
|
||||||
if (m_theme.maximizePixmap().pixmap().drawable() != 0) {
|
|
||||||
if (pressed()) {
|
if (pressed() && m_theme.maximizePressedPixmap().pixmap().drawable() != 0) {
|
||||||
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
||||||
maximizePressedPixmap().
|
maximizePressedPixmap().
|
||||||
pixmap().drawable());
|
pixmap().drawable());
|
||||||
} else if (m_theme.maximizePixmap().pixmap().drawable()) {
|
} else {
|
||||||
// check focus
|
// check focus
|
||||||
if (!m_listen_to.isFocused() &&
|
if (!m_listen_to.isFocused()) {
|
||||||
m_theme.maximizeUnfocusPixmap().pixmap().drawable() != 0) {
|
if (m_theme.maximizeUnfocusPixmap().pixmap().drawable() != 0) {
|
||||||
// not focused
|
// not focused
|
||||||
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
||||||
maximizeUnfocusPixmap().
|
maximizeUnfocusPixmap().
|
||||||
pixmap().drawable());
|
pixmap().drawable());
|
||||||
} else { // focused
|
used = true;
|
||||||
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
|
||||||
maximizePixmap().
|
|
||||||
pixmap().drawable());
|
|
||||||
}
|
}
|
||||||
|
} else if (m_theme.maximizePixmap().pixmap().drawable() != 0) {
|
||||||
|
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
||||||
|
maximizePixmap().
|
||||||
|
pixmap().drawable());
|
||||||
|
used = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (used)
|
||||||
FbTk::FbWindow::clear();
|
FbTk::FbWindow::clear();
|
||||||
|
|
||||||
} else {
|
|
||||||
|
// if no pixmap was used, use old style
|
||||||
|
if (!used) {
|
||||||
if (gc() == 0) // must have valid graphic context
|
if (gc() == 0) // must have valid graphic context
|
||||||
return;
|
return;
|
||||||
drawRectangle(gc(),
|
drawRectangle(gc(),
|
||||||
|
@ -84,29 +90,37 @@ void WinButton::drawType() {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MINIMIZE:
|
case MINIMIZE:
|
||||||
if (m_theme.iconifyPixmap().pixmap().drawable() != 0) {
|
|
||||||
if (pressed()) {
|
if (pressed() && m_theme.iconifyPressedPixmap().pixmap().drawable() != 0) {
|
||||||
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
||||||
iconifyPressedPixmap().
|
iconifyPressedPixmap().
|
||||||
pixmap().drawable());
|
pixmap().drawable());
|
||||||
} else if (m_theme.iconifyPixmap().pixmap().drawable()){
|
used = true;
|
||||||
|
} else {
|
||||||
|
if (m_theme.iconifyPixmap().pixmap().drawable()){
|
||||||
// check focus
|
// check focus
|
||||||
if (!m_listen_to.isFocused() &&
|
if (!m_listen_to.isFocused()) {
|
||||||
m_theme.iconifyUnfocusPixmap().pixmap().drawable() != 0) {
|
if (m_theme.iconifyUnfocusPixmap().pixmap().drawable() != 0) {
|
||||||
// not focused
|
// not focused
|
||||||
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
||||||
iconifyUnfocusPixmap().
|
iconifyUnfocusPixmap().
|
||||||
pixmap().drawable());
|
pixmap().drawable());
|
||||||
} else { // focused
|
used = true;
|
||||||
|
}
|
||||||
|
} else if (m_theme.iconifyPixmap().pixmap().drawable() != 0) {
|
||||||
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
||||||
iconifyPixmap().
|
iconifyPixmap().
|
||||||
pixmap().drawable());
|
pixmap().drawable());
|
||||||
|
used = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (used)
|
||||||
|
FbTk::FbWindow::clear();
|
||||||
|
|
||||||
FbTk::FbWindow::clear();
|
}
|
||||||
|
|
||||||
} else {
|
if (!used) {
|
||||||
if (gc() == 0) // must have valid graphic context
|
if (gc() == 0) // must have valid graphic context
|
||||||
return;
|
return;
|
||||||
FbTk::FbWindow::drawRectangle(gc(),
|
FbTk::FbWindow::drawRectangle(gc(),
|
||||||
|
@ -114,56 +128,65 @@ void WinButton::drawType() {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case STICK:
|
case STICK:
|
||||||
if (m_theme.stickPixmap().pixmap().drawable() != 0) {
|
|
||||||
if (m_listen_to.isStuck() &&
|
if (m_listen_to.isStuck() && !pressed()) {
|
||||||
m_theme.stuckPixmap().pixmap().drawable() &&
|
if ( m_theme.stuckPixmap().pixmap().drawable() &&
|
||||||
! pressed()) { // we're using the same pixmap for pressed as in not stuck
|
! pressed()) { // we're using the same pixmap for pressed as in not stuck
|
||||||
// check focus
|
// check focus
|
||||||
if (!m_listen_to.isFocused() &&
|
if (!m_listen_to.isFocused()) {
|
||||||
m_theme.stuckUnfocusPixmap().pixmap().drawable() != 0) {
|
if ( m_theme.stuckUnfocusPixmap().pixmap().drawable() != 0) {
|
||||||
// not focused
|
// not focused
|
||||||
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
||||||
stuckUnfocusPixmap().
|
stuckUnfocusPixmap().
|
||||||
pixmap().drawable());
|
pixmap().drawable());
|
||||||
} else { // focused
|
used = true;
|
||||||
|
}
|
||||||
|
} else if (m_theme.stuckPixmap().pixmap().drawable() != 0) {
|
||||||
|
// focused
|
||||||
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
||||||
stuckPixmap().
|
stuckPixmap().
|
||||||
pixmap().drawable());
|
pixmap().drawable());
|
||||||
|
used = true;
|
||||||
}
|
}
|
||||||
} else { // not stuck
|
}
|
||||||
|
} else { // not stuck and pressed
|
||||||
|
|
||||||
if (pressed()) {
|
if (pressed()) {
|
||||||
|
if (m_theme.stickPressedPixmap().pixmap().drawable() == 0) {
|
||||||
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
||||||
stickPressedPixmap().
|
stickPressedPixmap().
|
||||||
pixmap().drawable());
|
pixmap().drawable());
|
||||||
|
used = true;
|
||||||
} else if (m_theme.stickPixmap().pixmap().drawable()) {
|
}
|
||||||
// check focus
|
} else { // not pressed
|
||||||
if (!m_listen_to.isFocused() &&
|
// check focus
|
||||||
m_theme.stickUnfocusPixmap().pixmap().drawable() != 0) {
|
if (!m_listen_to.isFocused()) {
|
||||||
|
if (m_theme.stickUnfocusPixmap().pixmap().drawable() != 0) {
|
||||||
// not focused
|
// not focused
|
||||||
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
||||||
stickUnfocusPixmap().
|
stickUnfocusPixmap().
|
||||||
pixmap().drawable());
|
pixmap().drawable());
|
||||||
} else { // focused
|
used = true;
|
||||||
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
|
||||||
stickPixmap().
|
|
||||||
pixmap().drawable());
|
|
||||||
}
|
}
|
||||||
|
} else if (m_theme.stickPixmap().pixmap().drawable()) { // focused
|
||||||
|
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
||||||
|
stickPixmap().
|
||||||
|
pixmap().drawable());
|
||||||
|
used = true;
|
||||||
}
|
}
|
||||||
} // end if stuck
|
|
||||||
|
|
||||||
FbTk::FbWindow::clear();
|
}
|
||||||
|
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
if (used)
|
||||||
|
FbTk::FbWindow::clear();
|
||||||
|
else if (gc() != 0) {
|
||||||
if (m_listen_to.isStuck()) {
|
if (m_listen_to.isStuck()) {
|
||||||
fillRectangle(gc(),
|
fillRectangle(gc(),
|
||||||
width()/2 - width()/4, height()/2 - height()/4,
|
width()/2 - width()/4, height()/2 - height()/4,
|
||||||
width()/2, height()/2);
|
width()/2, height()/2);
|
||||||
} else {
|
} else {
|
||||||
if (gc() == 0) // must have valid graphic context
|
|
||||||
return;
|
|
||||||
fillRectangle(gc(),
|
fillRectangle(gc(),
|
||||||
width()/2 - width()/10, height()/2 - height()/10,
|
width()/2 - width()/10, height()/2 - height()/10,
|
||||||
width()/5, height()/5);
|
width()/5, height()/5);
|
||||||
|
@ -172,32 +195,36 @@ void WinButton::drawType() {
|
||||||
break;
|
break;
|
||||||
case CLOSE:
|
case CLOSE:
|
||||||
|
|
||||||
if (m_theme.closePixmap().pixmap().drawable() != 0) {
|
if (pressed()) {
|
||||||
if (pressed()) {
|
if (m_theme.closePressedPixmap().pixmap().drawable()) {
|
||||||
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
||||||
closePressedPixmap().
|
closePressedPixmap().
|
||||||
pixmap().drawable());
|
pixmap().drawable());
|
||||||
|
used = true;
|
||||||
} else if (m_theme.closePixmap().pixmap().drawable()) {
|
}
|
||||||
// check focus
|
} else { // not pressed
|
||||||
if (!m_listen_to.isFocused() &&
|
// check focus
|
||||||
m_theme.closeUnfocusPixmap().pixmap().drawable() != 0) {
|
if (!m_listen_to.isFocused()) {
|
||||||
|
if (m_theme.closeUnfocusPixmap().pixmap().drawable() != 0) {
|
||||||
// not focused
|
// not focused
|
||||||
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
||||||
closeUnfocusPixmap().
|
closeUnfocusPixmap().
|
||||||
pixmap().drawable());
|
pixmap().drawable());
|
||||||
} else { // focused
|
used = true;
|
||||||
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
|
||||||
closePixmap().
|
|
||||||
pixmap().drawable());
|
|
||||||
}
|
}
|
||||||
|
} else if (m_theme.closePixmap().pixmap().drawable() != 0) { // focused
|
||||||
|
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
||||||
|
closePixmap().
|
||||||
|
pixmap().drawable());
|
||||||
|
used = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
FbTk::FbWindow::clear();
|
if (used)
|
||||||
|
FbTk::FbWindow::clear();
|
||||||
} else {
|
else if (gc() != 0) { // must have valid graphic context
|
||||||
if (gc() == 0) // must have valid graphic context
|
|
||||||
return;
|
|
||||||
drawLine(gc(),
|
drawLine(gc(),
|
||||||
2, 2,
|
2, 2,
|
||||||
width() - 3, height() - 3);
|
width() - 3, height() - 3);
|
||||||
|
@ -207,28 +234,35 @@ void WinButton::drawType() {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SHADE:
|
case SHADE:
|
||||||
if (m_theme.shadePixmap().pixmap().drawable() != 0) {
|
|
||||||
if (pressed()) {
|
if (pressed()) {
|
||||||
|
if (m_theme.shadePressedPixmap().pixmap().drawable()) {
|
||||||
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
||||||
shadePressedPixmap().
|
shadePressedPixmap().
|
||||||
pixmap().drawable());
|
pixmap().drawable());
|
||||||
} else if (m_theme.shadePixmap().pixmap().drawable()) {
|
used = true;
|
||||||
// check focus
|
}
|
||||||
if (!m_listen_to.isFocused() &&
|
} else { // not pressed
|
||||||
m_theme.shadeUnfocusPixmap().pixmap().drawable() != 0) {
|
// check focus
|
||||||
|
if (!m_listen_to.isFocused()) {
|
||||||
|
if ( m_theme.shadeUnfocusPixmap().pixmap().drawable() != 0) {
|
||||||
// not focused
|
// not focused
|
||||||
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
||||||
shadeUnfocusPixmap().
|
shadeUnfocusPixmap().
|
||||||
pixmap().drawable());
|
pixmap().drawable());
|
||||||
} else { // focused
|
used = true;
|
||||||
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
|
||||||
shadePixmap().
|
|
||||||
pixmap().drawable());
|
|
||||||
}
|
}
|
||||||
|
} else if (m_theme.shadePixmap().pixmap().drawable() != 0) { // focused
|
||||||
|
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
||||||
|
shadePixmap().
|
||||||
|
pixmap().drawable());
|
||||||
|
used = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
FbTk::FbWindow::clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FbTk::FbWindow::clear();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue