fixed so it gets win state sticky to update sticky button

This commit is contained in:
fluxgen 2003-04-25 17:35:28 +00:00
parent 7815e2b30e
commit 9751d05db3

View file

@ -19,16 +19,18 @@
// 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.2 2003/02/23 01:06:23 fluxgen Exp $ /// $Id: WinButton.cc,v 1.3 2003/04/25 17:35:28 fluxgen Exp $
#include "WinButton.hh" #include "WinButton.hh"
#include "App.hh" #include "App.hh"
#include "Window.hh"
WinButton::WinButton(Type buttontype, const FbTk::FbWindow &parent, WinButton::WinButton(const FluxboxWindow &listen_to,
Type buttontype, const FbTk::FbWindow &parent,
int x, int y, int x, int y,
unsigned int width, unsigned int height): unsigned int width, unsigned int height):
FbTk::Button(parent, x, y, width, height), FbTk::Button(parent, x, y, width, height),
m_type(buttontype) { m_type(buttontype), m_listen_to(listen_to) {
} }
@ -37,48 +39,45 @@ void WinButton::exposeEvent(XExposeEvent &event) {
drawType(); drawType();
} }
void WinButton::buttonReleaseEvent(XButtonEvent &event) {
FbTk::Button::buttonReleaseEvent(event);
clear();
}
void WinButton::drawType() { void WinButton::drawType() {
if (gc() == 0) // must have valid graphic context if (gc() == 0) // must have valid graphic context
return; return;
Display *disp = FbTk::App::instance()->display();
switch (m_type) { switch (m_type) {
case MAXIMIZE: case MAXIMIZE:
XDrawRectangle(disp, window().window(), window().drawRectangle(gc(),
gc(), 2, 2, width() - 5, height() - 5);
2, 2, width() - 5, height() - 5); window().drawLine(gc(),
XDrawLine(disp, window().window(), 2, 3, width() - 3, 3);
gc(),
2, 3, width() - 3, 3);
break; break;
case MINIMIZE: case MINIMIZE:
XDrawRectangle(disp, window().window(), window().drawRectangle(gc(),
gc(), 2, height() - 5, width() - 5, 2);
2, height() - 5, width() - 5, 2);
break; break;
case STICK: case STICK:
/* if (m_stuck) { if (m_listen_to.isStuck()) {
XFillRectangle(disp, window().window(), window().fillRectangle(gc(),
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 { */ window().fillRectangle(gc(),
XFillRectangle(disp, window().window(), width()/2, height()/2,
gc(), width()/5, height()/5);
width()/2, height()/2, }
width()/5, height()/5);
// }
break; break;
case CLOSE: case CLOSE:
XDrawLine(disp, window().window(), window().drawLine(gc(),
gc(), 2, 2,
2, 2, width() - 3, height() - 3);
width() - 3, height() - 3); window().drawLine(gc(),
XDrawLine(disp, window().window(), 2, width() - 3,
gc(), height() - 3, 2);
2, width() - 3,
height() - 3, 2);
break; break;
case SHADE: case SHADE:
break; break;
@ -89,3 +88,7 @@ void WinButton::clear() {
FbTk::Button::clear(); FbTk::Button::clear();
drawType(); drawType();
} }
void WinButton::update(FbTk::Subject *subj) {
clear();
}