示例#1
0
void Taskbar::create_task_buttons(void) {
	/* erase all current elements */
	if(children())
		clear();

	/* also current/prev storage */
	curr_active = prev_active = NULL;

	/* redraw it, in case no windows exists in this workspace */
	panel_redraw();

	Window *wins;
	int     nwins = netwm_get_mapped_windows(&wins);

	if(nwins > 0) {
		TaskButton *b;
		int   curr_workspace = netwm_get_current_workspace();
		char *title;

		for(int i = 0; i < nwins; i++) {
			if(!netwm_manageable_window(wins[i]))
				continue;
			/* 
			 * show window per workspace
			 * TODO: allow showing all windows in each workspace
			 */
			if(curr_workspace == netwm_get_window_workspace(wins[i])) {
				b = new TaskButton(0, 0, DEFAULT_CHILD_W, 25);
				b->set_window_xid(wins[i]);
				b->update_title_from_xid();

				/* 
				 * catch the name changes 
				 * TODO: put this in Netwm.{h,cpp} 
				 */
				XSelectInput(fl_display, wins[i], PropertyChangeMask | StructureNotifyMask);

				b->callback((Fl_Callback*)button_cb, this);
				add(b);
			}
		}

		XFree(wins);
	}

	layout_children();
	update_active_button();
}
示例#2
0
	void PositionedLayout::layout_children(Canvas &canvas, View *view)
	{
		for (const std::shared_ptr<View> &child : view->children())
		{
			if (child->hidden())
			{
				continue;
			}
			else if (child->style_cascade().computed_value("position").is_keyword("absolute"))
			{
				// To do: decide how we determine the containing box used for absolute positioning. For now, use the parent padding box.
				layout_from_containing_box(canvas, child.get(), view->geometry().padding_box().translate(-view->geometry().content_pos()));
			}
			else if (child->style_cascade().computed_value("position").is_keyword("fixed"))
			{
				Rectf offset_initial_containing_box;
				View *current = view->parent();
				if (current)
				{
					Pointf offset(view->geometry().content_x, view->geometry().content_y);
					while (true)
					{
						offset = offset + Pointf(current->geometry().content_x, current->geometry().content_y);
						View *parent = current->parent();
						if (!parent)
						{
							offset_initial_containing_box = current->geometry().content_box();
							offset_initial_containing_box.set_top_left(offset_initial_containing_box.get_top_left() - offset);
							break;
						}
					}
				}
				else
				{
					offset_initial_containing_box = view->geometry().content_box();
				}

				layout_from_containing_box(canvas, child.get(), offset_initial_containing_box);
			}

			layout_children(canvas, child.get());
		}
	}
示例#3
0
void tlistbox::layout_children()
{
	layout_children(false);
}
void ttree_view::layout_children()
{
	layout_children(false);
}
示例#5
0
void Taskbar::resize(int X, int Y, int W, int H) {
	Fl_Widget::resize(X, Y, W, H);
	layout_children();
}