void WMAddSplitViewSubview(WMSplitView * sPtr, WMView * subview) { int wasMapped, count; W_SplitViewSubview *p; CHECK_CLASS(sPtr, WC_SplitView); p = (W_SplitViewSubview *) wmalloc(sizeof(W_SplitViewSubview)); if (!p) return; wasMapped = subview->flags.mapped; if (wasMapped) W_UnmapView(subview); count = _GetSubviewsCount(); p->view = subview; getConstraints(sPtr, count, &(p->minSize), &(p->maxSize)); if (sPtr->flags.vertical) p->size = subview->size.width; else p->size = subview->size.height; WMAddToArray(sPtr->subviews, p); reparentView(sPtr, subview, 0); /* We should have something like that... WMSetViewNotifySizeChanges(subview, True); WMAddNotificationObserver(handleSubviewResized, sPtr, WMViewSizeDidChangeNotification, subview); WMSetViewNotifyMoveChanges(subview, True); WMAddNotificationObserver(handleSubviewResized, sPtr, WMViewMoveDidChangeNotification, subview); */ if (wasMapped) { W_MapView(subview); sPtr->flags.adjustOnPaint = 1; paintSplitView(sPtr); } else { handleViewResized(sPtr, NULL); } }
void W_RealizeView(W_View * view) { Window parentWID; Display *dpy = view->screen->display; W_View *ptr; assert(view->size.width > 0); assert(view->size.height > 0); if (view->parent && !view->parent->flags.realized) { wwarning("trying to realize widget of unrealized parent"); return; } if (!view->flags.realized) { parentWID = view->parent->window; view->window = XCreateWindow(dpy, parentWID, view->pos.x, view->pos.y, view->size.width, view->size.height, 0, view->screen->depth, InputOutput, view->screen->visual, view->attribFlags, &view->attribs); XSaveContext(dpy, view->window, ViewContext, (XPointer) view); view->flags.realized = 1; if (view->flags.mapWhenRealized) { W_MapView(view); view->flags.mapWhenRealized = 0; } WMPostNotificationName(WMViewRealizedNotification, view, NULL); } /* realize children */ ptr = view->childrenList; while (ptr != NULL) { W_RealizeView(ptr); ptr = ptr->nextSister; } }
static void showText(Balloon * bPtr, int x, int y, int w, int h, const char *text) { WMScreen *scr = bPtr->view->screen; Display *dpy = WMScreenDisplay(scr); int width; int height; Pixmap pixmap; Pixmap mask; WMFont *font = bPtr->font ? bPtr->font : scr->normalFont; int textHeight; int side = 0; int ty; int bx, by; { int w; const char *ptr, *ptr2; ptr2 = ptr = text; width = 0; while (ptr && ptr2) { ptr2 = strchr(ptr, '\n'); if (ptr2) { w = WMWidthOfString(font, ptr, ptr2 - ptr); } else { w = WMWidthOfString(font, ptr, strlen(ptr)); } if (w > width) width = w; ptr = ptr2 + 1; } } width += 16; textHeight = W_GetTextHeight(font, text, width, False); height = textHeight + 4; if (height < 16) height = 16; if (width < height) width = height; if (x + width > scr->rootView->size.width) { side = RIGHT; bx = x - width + w / 2; if (bx < 0) bx = 0; } else { side = LEFT; bx = x + w / 2; } if (bx + width > scr->rootView->size.width) bx = scr->rootView->size.width - width; if (y - (height + SPACE) < 0) { side |= TOP; by = y + h - 1; ty = SPACE; } else { side |= BOTTOM; by = y - (height + SPACE); ty = 0; } pixmap = makePixmap(scr, width, height, side, &mask); W_PaintText(bPtr->view, pixmap, font, 8, ty + (height - textHeight) / 2, width, bPtr->flags.alignment, bPtr->textColor ? bPtr->textColor : scr->black, False, text, strlen(text)); XSetWindowBackgroundPixmap(dpy, bPtr->view->window, pixmap); W_ResizeView(bPtr->view, width, height + SPACE); XFreePixmap(dpy, pixmap); #ifdef USE_XSHAPE XShapeCombineMask(dpy, bPtr->view->window, ShapeBounding, 0, 0, mask, ShapeSet); #endif XFreePixmap(dpy, mask); W_MoveView(bPtr->view, bx, by); W_MapView(bPtr->view); }
void WMMapWidget(WMWidget * w) { W_MapView(W_VIEW(w)); }
static void W_MapTabViewItem(WMTabViewItem * item) { wassertr(item->view); W_MapView(item->view); W_RaiseView(item->view); item->flags.visible = 1; }