void Window::Node::Draw() { // Don't draw if not shown. if (!_win->IsShown()) { return; } // Prevent from drawing beside framebuffer. BlockDrawing(_win); _win->RenderWindow(); // Draw all children recursively. for (std::shared_ptr<ax::Window> it : _children) { if (it == nullptr) { continue; } // Don't draw if not shown. if (!it->IsShown()) { continue; } it->event.OnBeforeDrawing(0); // Block the drawging rectangle if window IsBlockDrawing activated. BlockDrawing(it.get()); // Render window. it->RenderWindow(); // Draw all child nodes (recursive call). it->node.Draw(); // Unblock rectangle. UnBlockDrawing(it.get()); // Draw over children and framebuffer. DrawOverChildren(it.get()); } UnBlockDrawing(_win); // Draw over children and framebuffer. DrawOverChildren(_win); }
void FolderContent::OnPaint() { BlockDrawing(); axGC* gc = GetGC(); axRect rect0(axPoint(0, 0), GetRect().size); gc->SetColor(axColor(0.9, 0.9, 0.9), 1.0); gc->DrawRectangle(axRect(1, 1, rect0.size.x - 2, rect0.size.y -1)); // Folder Content. axColor col1(0.7, 0.7, 0.7); axColor col2(0.8, 0.8, 0.8); int y = 0; int x = 40; gc->SetFontSize(12); deque<DirectoryNavigation::FileInfo>& dirNames = *_dirNavigation->GetFileInfoDeque(); for(int i = 0; i < dirNames.size(); i++) { if(i % 2) gc->SetColor(col1); else gc->SetColor(col2); // Draw file background. axRect backfileRect(1, y, rect0.size.x - 1, 24); gc->DrawRectangle(backfileRect); // Draw file highlight. if(_selected_file == i) { gc->SetColor(axColor(0.7, 0.7, 1.0), 0.5); axRect selected_rect(1, y, rect0.size.x - 2, 24); gc->DrawRectangle(selected_rect); gc->DrawRectangleColorFade(selected_rect, axColor(0.7, 0.7, 0.7), 0.5, axColor(0.8, 0.8, 0.8), 0.5); } // Draw file icon. if(dirNames[i].second != DirectoryNavigation::ICON_NONE) { gc->DrawImageResize(_icons[dirNames[i].second], axPoint(3, y), axSize(24, 24)); } // Draw file name. gc->SetColor(axColor(0.0, 0.0, 0.0), 1.0); gc->DrawString(dirNames[i].first, axPoint(x, y+4)); y += 24; if(i > 30) { break; } } gc->SetColor(axColor(0.0, 0.0, 0.0), 1.0); gc->DrawRectangleContour(axRect(1, 1, rect0.size.x - 1, rect0.size.y - 1)); UnBlockDrawing(); }