mirror of
https://github.com/edeproject/ede.git
synced 2023-08-10 21:13:03 +03:00
Support for panel height resize.
Now, when panel height get resized, children will update their height's too. Children height is always calculated in form (parent()->h() - 10).
This commit is contained in:
parent
7c4628dfa1
commit
229914358a
@ -80,8 +80,7 @@ static int xerror_handler(Display *d, XErrorEvent *e) {
|
||||
* construct the similar message format like X11 is using by default, but again, little
|
||||
* bit different so we knows it comes from here
|
||||
*/
|
||||
|
||||
sprintf(buf, "%d", e->request_code);
|
||||
snprintf(buf, sizeof(buf), "%d", e->request_code);
|
||||
|
||||
XGetErrorDatabaseText(d, "XRequest", buf, "%d", buf, sizeof(buf));
|
||||
fprintf(stderr, "%s: ", buf);
|
||||
@ -121,12 +120,12 @@ static int x_events(int ev) {
|
||||
}
|
||||
|
||||
/* horizontaly centers widget in the panel */
|
||||
static void center_widget_h(Fl_Widget *o, Panel *self) {
|
||||
int ph, wy;
|
||||
static void fix_widget_h(Fl_Widget *o, Panel *self) {
|
||||
int ph, wy, H = self->h() - 10;
|
||||
|
||||
ph = self->panel_h() / 2;
|
||||
wy = ph - (o->h() / 2);
|
||||
o->position(o->x(), wy);
|
||||
wy = ph - (H / 2);
|
||||
o->resize(o->x(), wy, o->w(), H);
|
||||
}
|
||||
|
||||
static void add_from_list(WidgetList &lst, Panel *self, int &X, bool inc) {
|
||||
@ -278,8 +277,8 @@ void Panel::do_layout(void) {
|
||||
for(int i = 0; i < children(); i++) {
|
||||
o = child(i);
|
||||
|
||||
/* first center it vertically */
|
||||
center_widget_h(o, this);
|
||||
/* first resize it to some reasonable height and center it vertically */
|
||||
fix_widget_h(o, this);
|
||||
|
||||
/* manage hider specifically */
|
||||
if(hider && o == hider) {
|
||||
|
@ -36,15 +36,15 @@
|
||||
#define EDE_PANEL_MENU_AUTOUPDATE 1
|
||||
|
||||
#ifdef EDE_PANEL_MENU_AUTOUPDATE
|
||||
#include <edelib/DirWatch.h>
|
||||
# include <edelib/DirWatch.h>
|
||||
EDELIB_NS_USING(DirWatch)
|
||||
EDELIB_NS_USING_LIST(4, (DW_CREATE, DW_MODIFY, DW_DELETE, DW_REPORT_RENAME))
|
||||
|
||||
/* when menu needs to be update, after how long to do real update */
|
||||
#define MENU_UPDATE_TIMEOUT 5.0
|
||||
# define MENU_UPDATE_TIMEOUT 5.0
|
||||
|
||||
/* elapsed seconds between changes reports from DirWatch; to prevent event throttling */
|
||||
#define MENU_UPDATE_DIFF 5
|
||||
# define MENU_UPDATE_DIFF 5
|
||||
#endif
|
||||
|
||||
EDELIB_NS_USING(MenuBase)
|
||||
|
@ -233,11 +233,12 @@ void Taskbar::layout_children(void) {
|
||||
if(!children()) return;
|
||||
|
||||
Fl_Widget *o;
|
||||
int X, Y, W, reduce = 0, sz = 0, all_buttons_w = 0;
|
||||
int X, Y, W, child_h, reduce = 0, sz = 0, all_buttons_w = 0;
|
||||
|
||||
X = x() + Fl::box_dx(box());
|
||||
Y = y() + Fl::box_dy(box());
|
||||
W = w() - Fl::box_dw(box());
|
||||
child_h = parent()->h() - 10; /* same sizes as in panel */
|
||||
|
||||
for(int i = 0; i < children(); i++) {
|
||||
o = child(i);
|
||||
@ -246,7 +247,7 @@ void Taskbar::layout_children(void) {
|
||||
sz++;
|
||||
|
||||
/* resize every child to default size so we can calculate total length */
|
||||
o->resize(o->x(), o->y(), (fixed_layout ? DEFAULT_CHILD_W : W), o->h());
|
||||
o->resize(o->x(), o->y(), (fixed_layout ? DEFAULT_CHILD_W : W), child_h);
|
||||
all_buttons_w += o->w();
|
||||
|
||||
/* do not include ending spaces */
|
||||
@ -267,7 +268,7 @@ void Taskbar::layout_children(void) {
|
||||
* I'm putting -1 here to leave a small space at the end of group; this will also
|
||||
* make children adaptive to not overflow group in case too many of them was created
|
||||
*/
|
||||
o->resize(X, Y, o->w() - reduce - 1, o->h());
|
||||
o->resize(X, Y, o->w() - reduce - 1, child_h);
|
||||
X += o->w() + DEFAULT_SPACING;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user