using FbTk GContext
This commit is contained in:
parent
1c3ddb390b
commit
84c9a6a804
4 changed files with 18 additions and 26 deletions
|
@ -19,7 +19,7 @@
|
|||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// $Id: SetWorkspaceName.cc,v 1.1 2003/08/26 23:48:19 fluxgen Exp $
|
||||
// $Id: SetWorkspaceName.cc,v 1.2 2003/08/27 18:05:12 fluxgen Exp $
|
||||
|
||||
#include "SetWorkspaceName.hh"
|
||||
|
||||
|
@ -43,8 +43,7 @@ SetWorkspaceName::SetWorkspaceName(BScreen &screen):
|
|||
m_textbox(*this, m_font, screen.currentWorkspace()->name()),
|
||||
m_label(*this, m_font, "Set workspace name:"),
|
||||
m_font("fixed"),
|
||||
m_gc(XCreateGC(FbTk::App::instance()->display(), m_textbox.window(),
|
||||
0, 0)),
|
||||
m_gc(m_textbox),
|
||||
m_screen(screen),
|
||||
m_move_x(0),
|
||||
m_move_y(0) {
|
||||
|
@ -58,12 +57,12 @@ SetWorkspaceName::SetWorkspaceName(BScreen &screen):
|
|||
m_label.show();
|
||||
|
||||
m_textbox.setBackgroundColor(FbTk::Color("white", m_textbox.screenNumber()));
|
||||
XGCValues gc_val;
|
||||
|
||||
FbTk::Color black("black", m_textbox.screenNumber());
|
||||
gc_val.foreground = black.pixel();
|
||||
XChangeGC(FbTk::App::instance()->display(), m_gc,
|
||||
GCForeground, &gc_val);
|
||||
m_textbox.setGC(m_gc);
|
||||
m_gc.setForeground(black);
|
||||
|
||||
m_textbox.setGC(m_gc.gc());
|
||||
|
||||
m_textbox.moveResize(0, m_label.height(),
|
||||
200, m_font.height() + 2);
|
||||
m_textbox.show();
|
||||
|
@ -80,9 +79,6 @@ SetWorkspaceName::SetWorkspaceName(BScreen &screen):
|
|||
|
||||
SetWorkspaceName::~SetWorkspaceName() {
|
||||
FbTk::EventManager::instance()->remove(*this);
|
||||
if (m_gc)
|
||||
XFreeGC(FbTk::App::instance()->display(), m_gc);
|
||||
|
||||
hide();
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// $Id: SetWorkspaceName.hh,v 1.1 2003/08/26 23:48:19 fluxgen Exp $
|
||||
// $Id: SetWorkspaceName.hh,v 1.2 2003/08/27 18:05:12 fluxgen Exp $
|
||||
|
||||
#ifndef SETWORKSPACENAME_HH
|
||||
#define SETWORKSPACENAME_HH
|
||||
|
@ -27,6 +27,7 @@
|
|||
#include "FbTk/TextBox.hh"
|
||||
#include "FbTk/TextButton.hh"
|
||||
#include "FbTk/Font.hh"
|
||||
#include "FbTk/GContext.hh"
|
||||
|
||||
class BScreen;
|
||||
|
||||
|
@ -47,7 +48,7 @@ private:
|
|||
FbTk::TextBox m_textbox;
|
||||
FbTk::TextButton m_label;
|
||||
FbTk::Font m_font;
|
||||
GC m_gc;
|
||||
FbTk::GContext m_gc;
|
||||
BScreen &m_screen;
|
||||
int m_move_x, m_move_y;
|
||||
};
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// $Id: TextTheme.cc,v 1.5 2003/08/16 11:33:13 fluxgen Exp $
|
||||
// $Id: TextTheme.cc,v 1.6 2003/08/27 18:05:12 fluxgen Exp $
|
||||
|
||||
#include "TextTheme.hh"
|
||||
|
||||
|
@ -33,9 +33,7 @@ TextTheme::TextTheme(FbTk::Theme &theme,
|
|||
m_font(theme, name + ".font", altname + ".Font"),
|
||||
m_text_color(theme, name + ".textColor", altname + ".TextColor"),
|
||||
m_justify(theme, name + ".justify", altname + ".Justify"),
|
||||
m_text_gc(XCreateGC(FbTk::App::instance()->display(),
|
||||
RootWindow(FbTk::App::instance()->display(),
|
||||
theme.screenNum()), 0, 0)) {
|
||||
m_text_gc(RootWindow(FbTk::App::instance()->display(), theme.screenNum())) {
|
||||
*m_justify = FbTk::LEFT;
|
||||
// set default values
|
||||
m_font->load("fixed");
|
||||
|
@ -45,15 +43,11 @@ TextTheme::TextTheme(FbTk::Theme &theme,
|
|||
}
|
||||
|
||||
TextTheme::~TextTheme() {
|
||||
if (m_text_gc)
|
||||
XFreeGC(FbTk::App::instance()->display(), m_text_gc);
|
||||
|
||||
}
|
||||
|
||||
void TextTheme::update() {
|
||||
XGCValues gcv;
|
||||
gcv.foreground = m_text_color->pixel();
|
||||
XChangeGC(FbTk::App::instance()->display(), m_text_gc,
|
||||
GCForeground, &gcv);
|
||||
m_text_gc.setForeground(*m_text_color);
|
||||
}
|
||||
|
||||
void TextTheme::setAntialias(bool value) {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// $Id: TextTheme.hh,v 1.2 2003/08/13 09:54:30 fluxgen Exp $
|
||||
// $Id: TextTheme.hh,v 1.3 2003/08/27 18:05:12 fluxgen Exp $
|
||||
|
||||
#ifndef TEXTTHEME_HH
|
||||
#define TEXTTHEME_HH
|
||||
|
@ -29,6 +29,7 @@
|
|||
#include "FbTk/Font.hh"
|
||||
#include "FbTk/Color.hh"
|
||||
#include "FbTk/Text.hh"
|
||||
#include "FbTk/GContext.hh"
|
||||
|
||||
class TextTheme {
|
||||
public:
|
||||
|
@ -43,12 +44,12 @@ public:
|
|||
const FbTk::Font &font() const { return *m_font; }
|
||||
const FbTk::Color &textColor() const { return *m_text_color; }
|
||||
FbTk::Justify justify() const { return *m_justify; }
|
||||
GC textGC() const { return m_text_gc; }
|
||||
GC textGC() const { return m_text_gc.gc(); }
|
||||
private:
|
||||
FbTk::ThemeItem<FbTk::Font> m_font;
|
||||
FbTk::ThemeItem<FbTk::Color> m_text_color;
|
||||
FbTk::ThemeItem<FbTk::Justify> m_justify;
|
||||
GC m_text_gc;
|
||||
FbTk::GContext m_text_gc;
|
||||
};
|
||||
|
||||
#endif // TEXTTHEME_HH
|
||||
|
|
Loading…
Reference in a new issue