mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-13 21:52:30 +00:00
* Fixed download menu.
* Use bold when ElementMenu loses focus. * Added an exit slot to ElementBase and bind to that from withing the subclasses. * Moved peer info to ElementPeerList, accessed by the right arrow. Download info will be moved to a seperate Element. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@752 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -475,7 +475,7 @@ Frame::balance_column(uint32_t x, uint32_t y, uint32_t width, uint32_t height) {
|
||||
|
||||
(*itr)->balance(x, y, std::min((*itr)->m_width, width), m_height);
|
||||
|
||||
y += (*itr)->m_width;
|
||||
x += (*itr)->m_width;
|
||||
width -= (*itr)->m_width;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,12 +45,18 @@ namespace display {
|
||||
|
||||
class TextElement {
|
||||
public:
|
||||
typedef uint32_t extent_type;
|
||||
|
||||
static const extent_type extent_full = ~extent_type();
|
||||
|
||||
virtual ~TextElement() {}
|
||||
|
||||
// The last element must point to a valid memory location into which
|
||||
// the caller must write a '\0' to terminate the c string. The
|
||||
// attributes must contain at least one attribute.
|
||||
virtual char* print(char* first, const char* last, Canvas::attributes_list* attributes, void* object) = 0;
|
||||
|
||||
virtual extent_type max_length() = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -59,4 +59,20 @@ TextElementList::print(char* first, const char* last, Canvas::attributes_list* a
|
||||
return first;
|
||||
}
|
||||
|
||||
TextElementList::extent_type
|
||||
TextElementList::max_length() {
|
||||
size_type length = 0;
|
||||
|
||||
for (iterator itr = begin(); itr != end(); ++itr) {
|
||||
size_type l = (*itr)->max_length();
|
||||
|
||||
if (l == extent_full)
|
||||
return extent_full;
|
||||
|
||||
length += l;
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -66,6 +66,8 @@ public:
|
||||
void clear();
|
||||
|
||||
virtual char* print(char* first, const char* last, Canvas::attributes_list* attributes, void* object);
|
||||
|
||||
virtual extent_type max_length();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -73,4 +73,9 @@ TextElementString::print(char* first, const char* last, Canvas::attributes_list*
|
||||
return first + length;
|
||||
}
|
||||
|
||||
TextElementString::extent_type
|
||||
TextElementString::max_length() {
|
||||
return m_string.size();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -56,6 +56,8 @@ public:
|
||||
|
||||
virtual char* print(char* first, const char* last, Canvas::attributes_list* attributes, void* object);
|
||||
|
||||
virtual extent_type max_length();
|
||||
|
||||
private:
|
||||
std::string m_string;
|
||||
int m_attributes;
|
||||
|
||||
@@ -86,7 +86,7 @@ public:
|
||||
bool is_height_dynamic() const { return m_maxHeight > m_minHeight; }
|
||||
|
||||
bool is_dirty() { return m_taskUpdate.is_queued(); }
|
||||
void mark_dirty() { m_slotSchedule(this, cachedTime + 1); }
|
||||
void mark_dirty() { if (!is_active()) return; m_slotSchedule(this, cachedTime + 1); }
|
||||
|
||||
extent_type min_width() const { return m_minWidth; }
|
||||
extent_type min_height() const { return m_minHeight; }
|
||||
|
||||
@@ -58,6 +58,9 @@ WindowText::push_back(TextElement* element) {
|
||||
// m_minHeight = size();
|
||||
m_maxHeight = size();
|
||||
|
||||
if (element != NULL)
|
||||
m_maxWidth = std::max(m_maxWidth, element->max_length() + 2);
|
||||
|
||||
// Check if active, if so do the update thingie. Or be lazy?
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
using base_type::rbegin;
|
||||
using base_type::rend;
|
||||
|
||||
WindowText() : Window(new Canvas, 0, 0, 0, extent_full, extent_static) {}
|
||||
WindowText() : Window(new Canvas, 0, 0, 0, extent_static, extent_static) {}
|
||||
~WindowText() { clear(); }
|
||||
|
||||
void clear();
|
||||
|
||||
Reference in New Issue
Block a user