| 316 | |
| 317 | |
| 318 | void StyledRenderable::PushWindowStyleChanges(DrawingContext& context, ImFont*& font) |
| 319 | { |
| 320 | if (Font) { |
| 321 | auto info = gExtender->IMGUI().GetFont(Font); |
| 322 | if (info) font = info->Font; |
| 323 | } |
| 324 | |
| 325 | if (font) ImGui::PushFont(font); |
| 326 | |
| 327 | if (!IDContext.empty()) { |
| 328 | ImGui::PushID(IDContext.data(), IDContext.data() + IDContext.size()); |
| 329 | } else if (Label.empty()) { |
| 330 | ImGui::PushID((int32_t)Handle | (int32_t)(Handle >> 32)); |
| 331 | } |
| 332 | |
| 333 | if (PositionOffset) { |
| 334 | auto pos = ImGui::GetCursorPos(); |
| 335 | auto offset = context.Scale(*PositionOffset); |
| 336 | ImGui::SetCursorPos(ImVec2(pos.x + offset.x, pos.y + offset.y)); |
| 337 | } else if (AbsolutePosition) { |
| 338 | ImGui::SetCursorPos(ToImVec(*AbsolutePosition)); |
| 339 | } |
| 340 | |
| 341 | if (SameLine) ImGui::SameLine(); |
| 342 | if (SamePosition) ImGui::SamePosition(); |
| 343 | if (TextWrapPos) ImGui::PushTextWrapPos(context.Scale(*TextWrapPos)); |
| 344 | } |
| 345 | |
| 346 | |
| 347 | void StyledRenderable::PopWindowStyleChanges(ImFont* font) |