move shape handling from FbMenu to FbTk::Menu
This commit is contained in:
parent
2940869cd7
commit
0f6b73f36a
4 changed files with 10 additions and 33 deletions
|
@ -25,36 +25,13 @@
|
|||
#include "FbMenu.hh"
|
||||
|
||||
#include "fluxbox.hh"
|
||||
#include "FbTk/MenuTheme.hh"
|
||||
#include "Screen.hh"
|
||||
|
||||
#include "FbTk/Shape.hh"
|
||||
|
||||
FbMenu::FbMenu(FbTk::MenuTheme &tm, FbTk::ImageControl &imgctrl,
|
||||
FbTk::XLayer &layer):
|
||||
FbTk::Menu(tm, imgctrl),
|
||||
m_layeritem(fbwindow(), layer),
|
||||
m_shape(new FbTk::Shape(fbwindow(), tm.shapePlaces())) {
|
||||
|
||||
}
|
||||
m_layeritem(fbwindow(), layer) {
|
||||
|
||||
FbMenu::~FbMenu() {
|
||||
|
||||
}
|
||||
|
||||
void FbMenu::updateMenu(int index) {
|
||||
FbTk::Menu::updateMenu(index);
|
||||
m_shape->update();
|
||||
}
|
||||
|
||||
void FbMenu::clearWindow() {
|
||||
FbTk::Menu::clearWindow();
|
||||
m_shape->update();
|
||||
}
|
||||
|
||||
void FbMenu::reconfigure() {
|
||||
m_shape->setPlaces(theme().shapePlaces());
|
||||
FbTk::Menu::reconfigure();
|
||||
}
|
||||
|
||||
void FbMenu::buttonReleaseEvent(XButtonEvent &be) {
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
|
||||
namespace FbTk {
|
||||
class MenuTheme;
|
||||
class Shape;
|
||||
}
|
||||
|
||||
/// a layered and shaped menu
|
||||
|
@ -38,16 +37,12 @@ class FbMenu:public FbTk::Menu {
|
|||
public:
|
||||
FbMenu(FbTk::MenuTheme &tm, FbTk::ImageControl &imgctrl,
|
||||
FbTk::XLayer &layer);
|
||||
virtual ~FbMenu();
|
||||
void updateMenu(int index = -1);
|
||||
void clearWindow();
|
||||
virtual ~FbMenu() { }
|
||||
void raise() { m_layeritem.raise(); }
|
||||
void lower() { m_layeritem.lower(); }
|
||||
void reconfigure();
|
||||
void buttonReleaseEvent(XButtonEvent &be);
|
||||
private:
|
||||
FbTk::XLayerItem m_layeritem;
|
||||
std::auto_ptr<FbTk::Shape> m_shape;
|
||||
};
|
||||
|
||||
#endif // FBMENU_HH
|
||||
|
|
|
@ -92,6 +92,7 @@ Menu::Menu(MenuTheme &tm, ImageControl &imgctrl):
|
|||
m_screen_height(DisplayHeight(FbTk::App::instance()->display(), tm.screenNum())),
|
||||
m_alignment(ALIGNDONTCARE),
|
||||
m_active_index(-1),
|
||||
m_shape(new Shape(fbwindow(), tm.shapePlaces())),
|
||||
m_need_update(true) {
|
||||
// setup timers
|
||||
|
||||
|
@ -496,6 +497,7 @@ void Menu::updateMenu(int active_index) {
|
|||
|
||||
clearWindow();
|
||||
m_need_update = false;
|
||||
m_shape->update();
|
||||
}
|
||||
|
||||
|
||||
|
@ -563,6 +565,7 @@ void Menu::clearWindow() {
|
|||
for (size_t i = 0; i < menuitems.size(); i++) {
|
||||
clearItem(i, false); // no clear
|
||||
}
|
||||
m_shape->update();
|
||||
}
|
||||
|
||||
void Menu::redrawFrame(FbDrawable &drawable) {
|
||||
|
@ -1091,6 +1094,7 @@ void Menu::keyPressEvent(XKeyEvent &event) {
|
|||
|
||||
|
||||
void Menu::reconfigure() {
|
||||
m_shape->setPlaces(theme().shapePlaces());
|
||||
|
||||
if (FbTk::Transparent::haveComposite()) {
|
||||
menu.window.setOpaque(alpha());
|
||||
|
|
|
@ -203,13 +203,12 @@ private:
|
|||
void startHide();
|
||||
void stopHide();
|
||||
|
||||
|
||||
typedef std::vector<MenuItem *> Menuitems;
|
||||
MenuTheme &m_theme;
|
||||
Menu *m_parent;
|
||||
ImageControl &m_image_ctrl;
|
||||
Menuitems menuitems;
|
||||
|
||||
typedef std::vector<MenuItem *> Menuitems;
|
||||
Menuitems menuitems;
|
||||
TypeAhead<Menuitems, MenuItem *> m_type_ahead;
|
||||
Menuitems m_matches;
|
||||
|
||||
|
@ -242,6 +241,8 @@ private:
|
|||
|
||||
int m_active_index; ///< current highlighted index
|
||||
|
||||
std::auto_ptr<FbTk::Shape> m_shape;
|
||||
|
||||
Drawable m_root_pm;
|
||||
static Menu *shown; ///< used for determining if there's a menu open at all
|
||||
static Menu *s_focused; ///< holds current input focused menu, so one can determine if a menu is focused
|
||||
|
|
Loading…
Reference in a new issue