/** * @brief 初期化 */ void TextDiffView::Initialize() { BRect bounds = Bounds(); float leftWidth = floor((bounds.Width() + 1 - B_H_SCROLL_BAR_HEIGHT - PANE_SPLITTER_WIDTH) / 2); // 左ペインを作成 BRect leftFrame = BRect(bounds.left, bounds.top, bounds.left + leftWidth - 1, bounds.bottom - B_H_SCROLL_BAR_HEIGHT); DiffPaneView* leftPaneView = new DiffPaneView(leftFrame, NAME_LEFT_PANE, B_FOLLOW_ALL_SIDES); leftPaneView->SetTextDiffView(this); leftPaneView->SetPaneIndex(LeftPane); BScrollView* leftView = new BScrollView(NAME_LEFT_PANE_SCROLLER, leftPaneView, B_FOLLOW_NONE, B_FRAME_EVENTS, true, false, B_NO_BORDER); AddChild(leftView); // 右ペインを作成 BRect rightFrame = BRect(bounds.left + leftWidth + PANE_SPLITTER_WIDTH, bounds.top, bounds.right - B_V_SCROLL_BAR_WIDTH, bounds.bottom - B_H_SCROLL_BAR_HEIGHT); DiffPaneView* rightPaneView = new DiffPaneView(rightFrame, NAME_RIGHT_PANE, B_FOLLOW_ALL_SIDES); rightPaneView->SetTextDiffView(this); rightPaneView->SetPaneIndex(RightPane); BScrollView* rightView = new BScrollView(NAME_RIGHT_PANE_SCROLLER, rightPaneView, B_FOLLOW_NONE, B_FRAME_EVENTS, true, true, B_NO_BORDER); AddChild(rightView); // 自身の色を設定 SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); // 念のためレイアウトを調整 recalcLayout(); leftPaneView->DataChanged(); rightPaneView->DataChanged(); }
/** * @brief フォントを変更するときに呼び出されます。 */ void TextDiffView::DiffPaneView::SetFont(const BFont* font, uint32 properties /* = B_FONT_ALL */) { BView::SetFont(font, properties); // タブ幅のキャッシュをクリア tabUnit = -1; // 再レイアウト recalcLayout(); }
void FolderView::visibleFolderPane(xpr_bool_t aVisible, xpr_bool_t aLoading) { if (XPR_IS_TRUE(aVisible)) { createFolderPane(); } else { destroyFolderPane(); } if (XPR_IS_FALSE(aLoading)) { recalcLayout(); RedrawWindow(XPR_NULL, XPR_NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE | RDW_INTERNALPAINT | RDW_ALLCHILDREN); } }
/** * @brief フレームのサイズが変化したときに呼び出されます。 */ void TextDiffView::DiffPaneView::FrameResized(float width, float height) { BView::FrameResized(width, height); recalcLayout(); }
void FolderView::OnSize(xpr_uint_t aType, xpr_sint_t cx, xpr_sint_t cy) { super::OnSize(aType, cx, cy); recalcLayout(); }