mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-17 23:52:30 +00:00
Moving from algo back to std.
git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@238 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -7,6 +7,6 @@ libsub_display_a_SOURCES = \
|
||||
manager.h \
|
||||
manager_element.h \
|
||||
window.h \
|
||||
window.cc \
|
||||
window.cc
|
||||
|
||||
INCLUDES = -I$(srcdir) -I$(srcdir)/.. -I$(top_srcdir)
|
||||
|
||||
@@ -1,18 +1,15 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <stdexcept>
|
||||
#include <algo/call.h>
|
||||
#include <algo/entry.h>
|
||||
#include <algo/lambda.h>
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
|
||||
#include "canvas.h"
|
||||
#include "manager.h"
|
||||
#include "window_base.h"
|
||||
#include "window.h"
|
||||
|
||||
namespace display {
|
||||
|
||||
using namespace algo;
|
||||
|
||||
void
|
||||
Manager::adjust_layout() {
|
||||
adjust_row(begin(), end(), 0, 0, display::Canvas::get_screen_width(), display::Canvas::get_screen_height());
|
||||
@@ -43,7 +40,7 @@ Manager::adjust_row(iterator bItr, iterator eItr, int x, int y, int w, int h) {
|
||||
|
||||
void
|
||||
Manager::do_update() {
|
||||
std::for_each(begin(), end(), mem_fun(*mem_fun(_0(), &WindowBase::get_canvas), &Canvas::refresh));
|
||||
std::for_each(begin(), end(), std::mem_fun_ref(&ManagerElement::redraw));
|
||||
|
||||
Canvas::do_update();
|
||||
}
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
|
||||
namespace display {
|
||||
|
||||
class WindowBase;
|
||||
|
||||
class Manager : private std::list<ManagerElement> {
|
||||
public:
|
||||
typedef std::list<ManagerElement> Base;
|
||||
@@ -26,14 +24,14 @@ public:
|
||||
NEW_ROW = 0x1
|
||||
};
|
||||
|
||||
Base::iterator add(WindowBase* w, int flags = 0) { return Base::insert(end(), ManagerElement(w, flags)); }
|
||||
Base::iterator add(Window* w, int flags = 0) { return Base::insert(end(), ManagerElement(w, flags)); }
|
||||
|
||||
void adjust_layout();
|
||||
void do_update();
|
||||
void adjust_layout();
|
||||
void do_update();
|
||||
|
||||
private:
|
||||
// Functions for adjusting ranges in different directions.
|
||||
void adjust_row(iterator bItr, iterator eItr, int x, int y, int w, int h);
|
||||
void adjust_row(iterator bItr, iterator eItr, int x, int y, int w, int h);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -1,23 +1,26 @@
|
||||
#ifndef RTORRENT_DISPLAY_MANAGER_ELEMENT_H
|
||||
#define RTORRENT_DISPLAY_MANAGER_ELEMENT_H
|
||||
|
||||
namespace display {
|
||||
#include "window.h"
|
||||
|
||||
class WindowBase;
|
||||
namespace display {
|
||||
|
||||
class ManagerElement {
|
||||
public:
|
||||
ManagerElement(WindowBase* w, int flags) : m_window(w), m_flags(flags) {}
|
||||
ManagerElement(Window* w, int flags) : m_window(w), m_flags(flags) {}
|
||||
|
||||
WindowBase* get_window() { return m_window; }
|
||||
void set_window(WindowBase* w) { m_window = w; }
|
||||
void refresh() { m_window->refresh(); }
|
||||
void redraw() { m_window->redraw(); }
|
||||
|
||||
int get_flags() { return m_flags; }
|
||||
void set_flags(int flags) { m_flags = flags; }
|
||||
Window* get_window() { return m_window; }
|
||||
void set_window(Window* w) { m_window = w; }
|
||||
|
||||
int get_flags() { return m_flags; }
|
||||
void set_flags(int flags) { m_flags = flags; }
|
||||
|
||||
private:
|
||||
WindowBase* m_window;
|
||||
int m_flags;
|
||||
Window* m_window;
|
||||
int m_flags;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "window_base.h"
|
||||
#include "canvas.h"
|
||||
#include "window.h"
|
||||
|
||||
namespace display {
|
||||
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
#ifndef RTORRENT_WINDOW_BASE_H
|
||||
#define RTORRENT_WINDOW_BASE_H
|
||||
|
||||
namespace display {
|
||||
|
||||
class Canvas;
|
||||
|
||||
class Window {
|
||||
public:
|
||||
Window() : m_canvas(NULL) {}
|
||||
virtual ~Window() {}
|
||||
|
||||
Canvas* get_canvas() { return m_canvas; }
|
||||
void set_canvas(Canvas* c) { m_canvas = c; }
|
||||
|
||||
void refresh();
|
||||
void resize(int x, int y, int w, int h);
|
||||
|
||||
virtual void redraw() = 0;
|
||||
|
||||
protected:
|
||||
Window(const Window&);
|
||||
void operator = (const Window&);
|
||||
|
||||
Canvas* m_canvas;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
#ifndef RTORRENT_WINDOW_BASE_H
|
||||
#define RTORRENT_WINDOW_BASE_H
|
||||
|
||||
namespace display {
|
||||
|
||||
class Canvas;
|
||||
|
||||
class WindowBase {
|
||||
public:
|
||||
WindowBase() : m_canvas(NULL) {}
|
||||
virtual ~WindowBase() {}
|
||||
|
||||
Canvas* get_canvas() { return m_canvas; }
|
||||
void set_canvas(Canvas* c) { m_canvas = c; }
|
||||
|
||||
void refresh();
|
||||
void resize(int x, int y, int w, int h);
|
||||
|
||||
virtual void do_update() = 0;
|
||||
|
||||
protected:
|
||||
Canvas* m_canvas;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user