// /// Post a OWL-defined message regarding an event [identified by the 'id' /// parameter] related to the specified document ('doc'). // /// If the current document changes, posts a WM_OWLDOCUMENT message to indicate a /// change in the status of the document. // void TDocManager::PostEvent(int id, TDocument& doc) { TWindow* win = GetApplication()->GetMainWindow(); if (win && win->GetHandle()) win->SendMessage(WM_OWLDOCUMENT, id, TParam2(&doc)); }
// /// Post a OWL-defined message regarding an event [identified by the 'id' /// parameter] related to the specified view ('view'). // /// If the current view changes, posts a WM_OWLVIEW message to indicate a change in /// the status of the view. // void TDocManager::PostEvent(int id, TView& view) { TWindow* win = GetApplication()->GetMainWindow(); if (win && win->GetHandle()) win->SendMessage(WM_OWLVIEW, id, TParam2(&view)); }
// /// Give the decorations an opportunity to do pre-processing. Don't bother /// checking the client window since it is typically in the focus chain and /// will be given an opportunity to do pre-processing // bool TDecoratedFrame::PreProcessMsg(MSG& msg) { TWindow* firstChild = GetFirstChild(); if (firstChild) { TWindow* child = firstChild; do { if (child != ClientWnd && child->GetHandle() && (child->GetWindowLong(GWL_STYLE) & WS_VISIBLE) && child->PreProcessMsg(msg)) return true; child = child->Next(); } while (child != firstChild); } return TFrameWindow::PreProcessMsg(msg); }
// /// Causes the window to resize and position its children according to the specified /// metrics. You can call Layout to implement changes that occur in the layout /// metrics. // void TLayoutWindow::Layout() { if (ChildMetrics) { TChildMetrics* childMetrics; GetFontHeight(); // Initialize the parent's variables // Variables[2].Value = ClientSize.cx - 1; Variables[3].Value = ClientSize.cy - 1; TRACEX(OwlLayout, 0, _T("Layout() ClientSize: ") << ClientSize); if (hasBorder(this)) { int cxBorder = TUIMetric::CxBorder; int cyBorder = TUIMetric::CyBorder; Variables[0].Value = -cxBorder; Variables[1].Value = -cyBorder; Variables[2].Value += cxBorder; Variables[3].Value += cyBorder; } else { Variables[0].Value = 0; Variables[1].Value = 0; } TRACEX(OwlLayout, 1, _T("Layout() Variables: 0=>") << Variables[0] << _T(", 1=>" << Variables[1]<< ", 2=>" << Variables[2]<< ", 3=>") << Variables[3]); // Rebuild layout plan if necessary // if (PlanIsDirty) { PlanIsDirty = false; for (childMetrics = ChildMetrics; childMetrics; childMetrics = childMetrics->Next) BuildConstraints(*childMetrics); BuildPlan(); } // Use the plan to calculate actual child window position values // ExecutePlan(); // Find out how many windows we're dealing with // int numWindows = 0; for (childMetrics = ChildMetrics; childMetrics; childMetrics = childMetrics->Next) { TWindow* win = childMetrics->Child; if (win->GetHandle()) numWindows++; } #if !defined(OWL_NO_DEFERWINDOWPOS_LAYOUT) // Helper object to use 'DefWindowPos' API // TDeferWinPos dwp(numWindows); #endif // Do actual resizing // for (childMetrics = ChildMetrics; childMetrics; childMetrics = childMetrics->Next) { TWindow* win = childMetrics->Child; TVariable* variables = childMetrics->Variables; TRACEX(OwlLayout, 0, _T("Layout() variables: ") << variables[0] << _T(',') << variables[1] << _T(',') << variables[2] << _T(',') << variables[3]); if (win->GetHandle()) { #if defined(OWL_NO_DEFERWINDOWPOS_LAYOUT) win->SetWindowPos( 0, variables[0].Value, variables[1].Value, variables[2].Value - variables[0].Value + 1, variables[3].Value - variables[1].Value + 1, SWP_NOACTIVATE | SWP_NOZORDER ); #else dwp.DeferWindowPos(*win, 0, variables[0].Value, variables[1].Value, variables[2].Value - variables[0].Value + 1, variables[3].Value - variables[1].Value + 1, SWP_NOACTIVATE | SWP_NOZORDER); #endif } else { win->GetWindowAttr().X = variables[0].Value; win->GetWindowAttr().Y = variables[1].Value; win->GetWindowAttr().W = variables[2].Value - variables[0].Value + 1; win->GetWindowAttr().H = variables[3].Value - variables[1].Value + 1; } } } }