Button changed to a FbWindow
This commit is contained in:
parent
225e89d775
commit
662be09609
2 changed files with 81 additions and 80 deletions
|
@ -19,7 +19,7 @@
|
|||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// $Id: TextButton.cc,v 1.3 2003/08/11 14:34:46 fluxgen Exp $
|
||||
// $Id: TextButton.cc,v 1.4 2003/08/13 10:12:36 fluxgen Exp $
|
||||
|
||||
#include "TextButton.hh"
|
||||
#include "Font.hh"
|
||||
|
@ -80,10 +80,12 @@ void TextButton::drawText(int x_offset, int y_offset) {
|
|||
text().c_str(), text().size(),
|
||||
textlen // return new text len
|
||||
);
|
||||
|
||||
// center text by default
|
||||
int center_pos = height()/2 + font().ascent()/2;
|
||||
font().drawText(window().window(), // drawable
|
||||
window().screenNumber(),
|
||||
|
||||
font().drawText(window(), // drawable
|
||||
screenNumber(),
|
||||
gc(), // graphic context
|
||||
text().c_str(), textlen, // string and string size
|
||||
align_x + x_offset, center_pos + y_offset); // position
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
/// $Id: WinButton.cc,v 1.7 2003/08/04 12:52:39 fluxgen Exp $
|
||||
/// $Id: WinButton.cc,v 1.8 2003/08/13 10:14:54 fluxgen Exp $
|
||||
|
||||
#include "WinButton.hh"
|
||||
#include "App.hh"
|
||||
|
@ -82,7 +82,7 @@ WinButton::WinButton(const FluxboxWindow &listen_to,
|
|||
void WinButton::exposeEvent(XExposeEvent &event) {
|
||||
FbTk::Button::exposeEvent(event);
|
||||
drawType();
|
||||
window().updateTransparent();
|
||||
updateTransparent();
|
||||
}
|
||||
|
||||
void WinButton::buttonReleaseEvent(XButtonEvent &event) {
|
||||
|
@ -92,12 +92,11 @@ void WinButton::buttonReleaseEvent(XButtonEvent &event) {
|
|||
|
||||
void WinButton::drawType() {
|
||||
|
||||
|
||||
switch (m_type) {
|
||||
case MAXIMIZE:
|
||||
if (m_theme.maximizePixmap().pixmap_scaled.drawable() != 0) {
|
||||
if (pressed()) {
|
||||
window().setBackgroundPixmap(m_theme.
|
||||
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
||||
maximizePressedPixmap().
|
||||
pixmap_scaled.drawable());
|
||||
} else if (m_theme.maximizePixmap().pixmap_scaled.drawable()) {
|
||||
|
@ -105,31 +104,31 @@ void WinButton::drawType() {
|
|||
if (!m_listen_to.isFocused() &&
|
||||
m_theme.maximizeUnfocusPixmap().pixmap_scaled.drawable() != 0) {
|
||||
// not focused
|
||||
window().setBackgroundPixmap(m_theme.
|
||||
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
||||
maximizeUnfocusPixmap().
|
||||
pixmap_scaled.drawable());
|
||||
} else { // focused
|
||||
window().setBackgroundPixmap(m_theme.
|
||||
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
||||
maximizePixmap().
|
||||
pixmap_scaled.drawable());
|
||||
}
|
||||
}
|
||||
|
||||
window().clear();
|
||||
FbTk::FbWindow::clear();
|
||||
|
||||
} else {
|
||||
if (gc() == 0) // must have valid graphic context
|
||||
return;
|
||||
window().drawRectangle(gc(),
|
||||
drawRectangle(gc(),
|
||||
2, 2, width() - 5, height() - 5);
|
||||
window().drawLine(gc(),
|
||||
drawLine(gc(),
|
||||
2, 3, width() - 3, 3);
|
||||
}
|
||||
break;
|
||||
case MINIMIZE:
|
||||
if (m_theme.iconifyPixmap().pixmap_scaled.drawable() != 0) {
|
||||
if (pressed()) {
|
||||
window().setBackgroundPixmap(m_theme.
|
||||
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
||||
iconifyPressedPixmap().
|
||||
pixmap_scaled.drawable());
|
||||
} else if (m_theme.iconifyPixmap().pixmap_scaled.drawable()){
|
||||
|
@ -137,22 +136,22 @@ void WinButton::drawType() {
|
|||
if (!m_listen_to.isFocused() &&
|
||||
m_theme.iconifyUnfocusPixmap().pixmap_scaled.drawable() != 0) {
|
||||
// not focused
|
||||
window().setBackgroundPixmap(m_theme.
|
||||
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
||||
iconifyUnfocusPixmap().
|
||||
pixmap_scaled.drawable());
|
||||
} else { // focused
|
||||
window().setBackgroundPixmap(m_theme.
|
||||
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
||||
iconifyPixmap().
|
||||
pixmap_scaled.drawable());
|
||||
}
|
||||
}
|
||||
|
||||
window().clear();
|
||||
FbTk::FbWindow::clear();
|
||||
|
||||
} else {
|
||||
if (gc() == 0) // must have valid graphic context
|
||||
return;
|
||||
window().drawRectangle(gc(),
|
||||
FbTk::FbWindow::drawRectangle(gc(),
|
||||
2, height() - 5, width() - 5, 2);
|
||||
}
|
||||
break;
|
||||
|
@ -165,18 +164,18 @@ void WinButton::drawType() {
|
|||
if (!m_listen_to.isFocused() &&
|
||||
m_theme.stuckUnfocusPixmap().pixmap_scaled.drawable() != 0) {
|
||||
// not focused
|
||||
window().setBackgroundPixmap(m_theme.
|
||||
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
||||
stuckUnfocusPixmap().
|
||||
pixmap_scaled.drawable());
|
||||
} else { // focused
|
||||
window().setBackgroundPixmap(m_theme.
|
||||
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
||||
stuckPixmap().
|
||||
pixmap_scaled.drawable());
|
||||
}
|
||||
} else { // not stuck
|
||||
|
||||
if (pressed()) {
|
||||
window().setBackgroundPixmap(m_theme.
|
||||
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
||||
stickPressedPixmap().
|
||||
pixmap_scaled.drawable());
|
||||
|
||||
|
@ -185,11 +184,11 @@ void WinButton::drawType() {
|
|||
if (!m_listen_to.isFocused() &&
|
||||
m_theme.stickUnfocusPixmap().pixmap_scaled.drawable() != 0) {
|
||||
// not focused
|
||||
window().setBackgroundPixmap(m_theme.
|
||||
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
||||
stickUnfocusPixmap().
|
||||
pixmap_scaled.drawable());
|
||||
} else { // focused
|
||||
window().setBackgroundPixmap(m_theme.
|
||||
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
||||
stickPixmap().
|
||||
pixmap_scaled.drawable());
|
||||
}
|
||||
|
@ -197,17 +196,17 @@ void WinButton::drawType() {
|
|||
}
|
||||
} // end if stuck
|
||||
|
||||
window().clear();
|
||||
FbTk::FbWindow::clear();
|
||||
|
||||
} else {
|
||||
if (m_listen_to.isStuck()) {
|
||||
window().fillRectangle(gc(),
|
||||
fillRectangle(gc(),
|
||||
width()/2 - width()/4, height()/2 - height()/4,
|
||||
width()/2, height()/2);
|
||||
} else {
|
||||
if (gc() == 0) // must have valid graphic context
|
||||
return;
|
||||
window().fillRectangle(gc(),
|
||||
fillRectangle(gc(),
|
||||
width()/2 - width()/10, height()/2 - height()/10,
|
||||
width()/5, height()/5);
|
||||
}
|
||||
|
@ -217,7 +216,7 @@ void WinButton::drawType() {
|
|||
|
||||
if (m_theme.closePixmap().pixmap_scaled.drawable() != 0) {
|
||||
if (pressed()) {
|
||||
window().setBackgroundPixmap(m_theme.
|
||||
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
||||
closePressedPixmap().
|
||||
pixmap_scaled.drawable());
|
||||
|
||||
|
@ -226,25 +225,25 @@ void WinButton::drawType() {
|
|||
if (!m_listen_to.isFocused() &&
|
||||
m_theme.closeUnfocusPixmap().pixmap_scaled.drawable() != 0) {
|
||||
// not focused
|
||||
window().setBackgroundPixmap(m_theme.
|
||||
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
||||
closeUnfocusPixmap().
|
||||
pixmap_scaled.drawable());
|
||||
} else { // focused
|
||||
window().setBackgroundPixmap(m_theme.
|
||||
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
||||
closePixmap().
|
||||
pixmap_scaled.drawable());
|
||||
}
|
||||
}
|
||||
|
||||
window().clear();
|
||||
FbTk::FbWindow::clear();
|
||||
|
||||
} else {
|
||||
if (gc() == 0) // must have valid graphic context
|
||||
return;
|
||||
window().drawLine(gc(),
|
||||
drawLine(gc(),
|
||||
2, 2,
|
||||
width() - 3, height() - 3);
|
||||
window().drawLine(gc(),
|
||||
drawLine(gc(),
|
||||
2, width() - 3,
|
||||
height() - 3, 2);
|
||||
}
|
||||
|
@ -252,7 +251,7 @@ void WinButton::drawType() {
|
|||
case SHADE:
|
||||
if (m_theme.shadePixmap().pixmap_scaled.drawable() != 0) {
|
||||
if (pressed()) {
|
||||
window().setBackgroundPixmap(m_theme.
|
||||
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
||||
shadePressedPixmap().
|
||||
pixmap_scaled.drawable());
|
||||
} else if (m_theme.shadePixmap().pixmap_scaled.drawable()) {
|
||||
|
@ -260,17 +259,17 @@ void WinButton::drawType() {
|
|||
if (!m_listen_to.isFocused() &&
|
||||
m_theme.shadeUnfocusPixmap().pixmap_scaled.drawable() != 0) {
|
||||
// not focused
|
||||
window().setBackgroundPixmap(m_theme.
|
||||
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
||||
shadeUnfocusPixmap().
|
||||
pixmap_scaled.drawable());
|
||||
} else { // focused
|
||||
window().setBackgroundPixmap(m_theme.
|
||||
FbTk::FbWindow::setBackgroundPixmap(m_theme.
|
||||
shadePixmap().
|
||||
pixmap_scaled.drawable());
|
||||
}
|
||||
}
|
||||
|
||||
window().clear();
|
||||
FbTk::FbWindow::clear();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue