BTitleView::BTitleView(BPoseView* view) : BView("BTitleView", B_WILL_DRAW), fPoseView(view), fTitleList(10, true), fHorizontalResizeCursor(B_CURSOR_ID_RESIZE_EAST_WEST), fPreviouslyClickedColumnTitle(0), fPreviousLeftClickTime(0), fTrackingState(NULL) { SetHighUIColor(B_PANEL_BACKGROUND_COLOR); SetLowUIColor(B_PANEL_BACKGROUND_COLOR); #if APP_SERVER_CLEARS_BACKGROUND SetViewUIColor(B_PANEL_BACKGROUND_COLOR); #else SetViewColor(B_TRANSPARENT_COLOR); #endif BFont font(be_plain_font); font.SetSize(floorf(be_plain_font->Size() * 0.75f)); SetFont(&font); font_height height; GetFontHeight(&height); fPreferredHeight = ceilf(height.ascent + height.descent) + 2; Reset(); }
void DataView::AttachedToWindow() { fEditor.StartWatching(this); MakeFocus(true); // this seems to be necessary - if we don't do this here, // the view is sometimes focus, but IsFocus() returns false... SetViewUIColor(B_DOCUMENT_BACKGROUND_COLOR); SetLowUIColor(ViewUIColor()); SetHighUIColor(B_DOCUMENT_TEXT_COLOR); }
void PaneSwitch::Draw(BRect) { BRect bounds(Bounds()); // Draw the label, if any const char* label = fLabelOff; if (fLabelOn != NULL && Value() == B_CONTROL_ON) label = fLabelOn; if (label != NULL) { BPoint point; float labelDist = sLatchSize + ceilf(sLatchSize / 2.0); if (fLeftAligned) point.x = labelDist; else point.x = bounds.right - labelDist - StringWidth(label); SetHighUIColor(B_PANEL_TEXT_COLOR); font_height fontHeight; GetFontHeight(&fontHeight); point.y = (bounds.top + bounds.bottom - ceilf(fontHeight.ascent) - ceilf(fontHeight.descent)) / 2 + ceilf(fontHeight.ascent); DrawString(label, point); } // draw the latch if (fPressing) DrawInState(kPressed); else if (Value()) DrawInState(kExpanded); else DrawInState(kCollapsed); // ...and the focus indication if (!IsFocus() || !Window()->IsActive()) return; rgb_color markColor = ui_color(B_KEYBOARD_NAVIGATION_COLOR); BeginLineArray(2); AddLine(BPoint(bounds.left + 2, bounds.bottom - 1), BPoint(bounds.right - 2, bounds.bottom - 1), markColor); AddLine(BPoint(bounds.left + 2, bounds.bottom), BPoint(bounds.right - 2, bounds.bottom), kWhite); EndLineArray(); }
WrappingTextView::WrappingTextView(BRect a_frame,const char* a_name,int32 a_resize_mode,int32 a_flags) : BTextView(a_frame, a_name, BRect(4.0f,4.0f,a_frame.right-a_frame.left-4.0f,a_frame.bottom-a_frame.top-4.0f), a_resize_mode,a_flags) { m_vertical_offset = 0; m_modified = false; m_modified_disabled = false; m_fixed_width = 0; m_modification_msg = NULL; m_curr_undo_index = 0; m_max_undo_index = 0; m_in_undo_redo = false; m_undo_context = NULL; m_last_key_was_del = false; m_separator_chars = " "; // just a default, will be overridden by Beam-Prefs ResetTextRect(); SetViewUIColor(B_DOCUMENT_BACKGROUND_COLOR); SetLowUIColor(B_DOCUMENT_BACKGROUND_COLOR); SetHighUIColor(B_DOCUMENT_TEXT_COLOR); }