news download themes documentation links










Button.hh

00001 // Button.hh for FbTk - Fluxbox Toolkit
00002 // Copyright (c) 2002 Henrik Kinnunen (fluxgen at users.sourceforge.net)
00003 //
00004 // Permission is hereby granted, free of charge, to any person obtaining a
00005 // copy of this software and associated documentation files (the "Software"),
00006 // to deal in the Software without restriction, including without limitation
00007 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
00008 // and/or sell copies of the Software, and to permit persons to whom the
00009 // Software is furnished to do so, subject to the following conditions:
00010 //
00011 // The above copyright notice and this permission notice shall be included in
00012 // all copies or substantial portions of the Software.
00013 //
00014 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00015 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00016 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
00017 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00018 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
00019 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
00020 // DEALINGS IN THE SOFTWARE.
00021 
00022 // $Id: Button.hh,v 1.8 2003/12/16 17:06:49 fluxgen Exp $
00023 
00024 #ifndef FBTK_BUTTON_HH
00025 #define FBTK_BUTTON_HH
00026 
00027 #include "EventHandler.hh"
00028 #include "NotCopyable.hh"
00029 #include "RefCount.hh"
00030 #include "FbWindow.hh"
00031 #include "Command.hh"
00032 #include "Color.hh"
00033 
00034 #include <X11/Xlib.h>
00035 #include <memory>
00036 
00037 namespace FbTk {
00038 
00039 class Button:public FbTk::FbWindow, public EventHandler, 
00040              private NotCopyable {
00041 public:
00042     Button(int screen_num, int x, int y, unsigned int width, unsigned int height);
00043     Button(const FbWindow &parent, int x, int y, unsigned int width, unsigned int height);
00044     virtual ~Button();
00045     
00047     void setOnClick(RefCount<Command> &com, int button = 1);
00048 
00050     void setPixmap(Pixmap pm);
00052     void setPressedPixmap(Pixmap pm);
00053     void setPressedColor(const FbTk::Color &color);
00055     void setGC(GC gc) { m_gc = gc; }
00057     virtual void setBackgroundPixmap(Pixmap pm);
00059     virtual void setBackgroundColor(const Color &color);
00060 
00065     virtual void buttonPressEvent(XButtonEvent &event);
00066     virtual void buttonReleaseEvent(XButtonEvent &event);
00067     virtual void exposeEvent(XExposeEvent &event);
00069 
00071     bool pressed() const { return m_pressed; }
00072 
00073     GC gc() const { return m_gc; }
00074     Pixmap backgroundPixmap() const { return m_background_pm; }
00075     const Color &backgroundColor() const { return m_background_color; }
00076     Pixmap foregroundPixmap() const { return m_foreground_pm; }
00077 private:
00078     Pixmap m_foreground_pm; 
00079     Pixmap m_background_pm; 
00080     Color m_background_color; 
00081     Pixmap m_pressed_pm; 
00082     Color m_pressed_color;
00083     GC m_gc; 
00084     bool m_pressed; 
00085     RefCount<Command> m_onclick[5]; 
00086 };
00087 
00088 } // namespace FbTk
00089 
00090 #endif // FBTK_BUTTON_HH

Fluxbox CVS-Jan-2003




      



Got comments about the page? Send them to webmaster.
If you have general Fluxbox related questions ask them on our irc channel or mailing lists.

Show Source








Designed by aLEczapKA