Mercurial > ~dholland > hg > ag > index.cgi
view anagram/vaclgui/toolbar.cpp @ 13:43d8b194fb4e
Remove unused variables.
author | David A. Holland |
---|---|
date | Tue, 31 May 2022 00:59:00 -0400 |
parents | 13d2b8934445 |
children |
line wrap: on
line source
/* * AnaGram, A System for Syntax Directed Programming * Copyright 1997-2002 Parsifal Software. All Rights Reserved. * See the file COPYING for license and usage terms. * * toolbar.cpp */ #include <ifont.hpp> #include "base.h" #include "toolbar.hpp" #if 0 /* unused */ /* note: classes used to be in toolbar.hpp */ class AgEventHandler { public: class Kernel { int useCount; public: virtual ~Kernel() {} virtual Boolean perform(IEvent &) const = 0; Kernel() : useCount(0) {} void lock() { useCount++; } int unlock() { return --useCount <= 0; } }; protected: Kernel *kernel; public: AgEventHandler(); AgEventHandler(AgEventHandler::Kernel *kernel_); AgEventHandler(const AgEventHandler &a); AgEventHandler &operator = (const AgEventHandler &h); ~AgEventHandler(); Boolean operator () (IEvent &event) const; }; template <class T> class AgMemberEventHandler : public AgEventHandler { private: class Kernel : public AgEventHandler::Kernel { private: T *object; Boolean (T:: * memberFunction)(IEvent &); public: Kernel(T *object_, Boolean (T:: * memberFunction_)(IEvent &)); Boolean perform(IEvent &event) const { return (object->*memberFunction)(event); } }; public: AgMemberEventHandler(T *object_, Boolean (T:: * memberFunction_)(IEvent &)): AgMemberEventHandler<T>::AgMemberEventHandler( const AgMemberEventHandler<T> &a); }; template <class T> AgMemberEventHandler<T>::Kernel::Kernel(T *object_, Boolean (T:: * memberFunction_)(IEvent &)) : object(object_) , memberFunction(memberFunction_) {} template <class T> AgMemberEventHandler<T>::AgMemberEventHandler(T *object_, Boolean (T:: * memberFunction_)(IEvent &)) : AgEventHandler( new AgMemberEventHandler<T>::Kernel(object_,memberFunction_) ) {} template <class T> AgMemberEventHandler<T>::AgMemberEventHandler(const AgMemberEventHandler<T> &a) : AgEventHandler(a) {} template <class T> AgEventHandler eventHandlerObject(T *object, Boolean (T:: * memberFunction)(IEvent &)) { return AgMemberEventHandler<T>(object, memberFunction); } AgEventHandler::AgEventHandler() : kernel(0) {} AgEventHandler::AgEventHandler(AgEventHandler::Kernel *kernel_) : kernel(kernel_) { if (kernel) { kernel->lock(); } } AgEventHandler::AgEventHandler(const AgEventHandler &a) : kernel(a.kernel) { if (kernel) { kernel->lock(); } } AgEventHandler &AgEventHandler::operator = (const AgEventHandler &h) { if (kernel && kernel->unlock()) { delete kernel; } kernel = h.kernel; if (kernel) { kernel->lock(); } return *this; } AgEventHandler::~AgEventHandler() { if (kernel && kernel->unlock()) { delete kernel; kernel = 0; } } Boolean AgEventHandler::operator () (IEvent &event) const { if (kernel) { return kernel->perform(event); } return false; } #endif /* 0 - unused */ ToolBar::ToolBar(IWindow *owner, ISetCanvas::Style style) : ISetCanvas(nextChildId(), owner, owner, IRectangle(), style | ISetCanvas::horizontalDecks | ISetCanvas::rightAlign //| ISetCanvas::centerVerticalAlign | IWindow::clipChildren | IWindow::visible) { IPaintHandler::handleEventsFor(this); } ToolBar::~ToolBar() { IPaintHandler::stopHandlingEventsFor(this); } Boolean ToolBar::paintWindow(IPaintEvent &event) { //LOGSECTION("Toolbar::paintWindow"); //LOGV(event.rect().asString()); event.clearBackground(IGUIColor::dialogBgnd); return false; } ToolButton::ToolButton(int id, IWindow *owner, char *text, IPushButton::Style style) : IPushButton(id, owner, owner, IRectangle(), style | visible) { setFont(IFont("Arial", 9)); setText(text); }