void baseMenu::draw() { setColor(Colors::C_NORMAL); // Write a title and a separator. t_uint ypos = 1; mvwprintw(window_, ypos, 1, "%s", title_.c_str()); ypos++; mvwprintw(window_, ypos, 1, "%s", "--"); ypos++; std::vector<menuEntry>::const_iterator iter; t_int counter = 0; for (iter = contents_.begin(); iter != contents_.end(); iter++) { if (selection_ == counter) { unSetColor(Colors::C_NORMAL); setColor(Colors::C_MARK); ::wattron(window_, A_REVERSE); std::string spacestr; t_int spaces = width_ - iter->label.size() - 2; // box takes two characters. if (spaces > 0) { for (t_int spacecounter = 0; spacecounter < spaces; spacecounter++) { spacestr += " "; } } mvwprintw(window_, ypos, 1, "%s%s", iter->label.c_str(), spacestr.c_str()); unSetColor(Colors::C_MARK); setColor(Colors::C_NORMAL); ::wattroff(window_, A_REVERSE); statusWindow_.setStatus(iter->descr); } else { mvwprintw(window_, ypos, 1, "%s", iter->label.c_str()); } counter++; ypos++; } unSetColor(Colors::C_NORMAL); }
void helpWindow::draw() { setColor(Colors::C_NORMAL); ::wattron(window_, A_REVERSE); for (t_uint y = 0; y < height_; y++) { for (t_uint x = 0; x < width_; x++) { mvwaddch(window_, y, x, ' '); } } t_uint counter = 0; std::vector<std::string>::const_iterator iter; for (iter = text_.begin(); iter != text_.end(); iter++) { mvwprintw(window_, counter, 0, "%s", iter->c_str()); counter++; } ::wattroff(window_, A_REVERSE); unSetColor(Colors::C_NORMAL); }
void textInput::draw() { setColor(Colors::C_NORMAL); counter_ = 0; addTopic(topic_); addValue(); unSetColor(Colors::C_NORMAL); }
void numberInputWindow::draw() { setColor(Colors::C_NORMAL); counter_ = 0; addTopic(topic_); addValue(); unSetColor(Colors::C_NORMAL); }
void baseMenu::refresh() { if (window_ == 0) { return; } clear(); setColor(Colors::C_BORDER); box(window_, 0 , 0); unSetColor(Colors::C_BORDER); draw(); wrefresh(window_); }
void GraphicsEdge::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); switch(_toolHandler->getToolType()) { case SELECTTOOL: //without break, will also unset color case REMOVEEDGETOOL: unSetColor(); break; default: // addNode doesn't need to do anything ; } scene()->update(boundingRect()); }
GraphicsEdge::GraphicsEdge(QGraphicsItem *parent, QGraphicsScene *scene) : QGraphicsItem(parent) { _isSelfEdge = false; _edge = NULL; _toolHandler = NULL; unSetColor(); _zValue = _GlobalzValue--; setZValue(_zValue); _selfEdgeCircle = new QRect(); _x1 = 0; _y1 = 0; _x2 = 0; _y2 = 0; _labelX = 0; _labelY = 0; _pen.setWidth(2); _brush.setColor(Qt::black); _brush.setStyle(Qt::SolidPattern); setAcceptHoverEvents(true); }
void fileSelect::drawList() { std::vector<btg::core::selectedFileEntry>::iterator iterBeg = selected_files_.begin(); std::vector<btg::core::selectedFileEntry>::iterator iterEnd = selected_files_.begin(); if (positionWindowEnd_ == 0) { positionWindowEnd_ = numberOfLines_; } if (positionWindowEnd_ > static_cast<t_int>(selected_files_.size())) { positionWindowEnd_ = selected_files_.size(); } // Move the iterator the the start of the window to display. for (t_int counter = 0; counter < positionWindowStart_; counter++) { iterBeg++; } // Move the iterator the the end of the window to display. for (t_int counter = 0; counter < positionWindowEnd_; counter++) { iterEnd++; } // Display the window. t_int counter = 0; t_int scr_counter = 0; std::vector<btg::core::selectedFileEntry>::const_iterator iter; for (iter = iterBeg; iter != iterEnd; iter++) { // Split the filename into path + file. std::string path; std::string filename; splitPath(iter->filename(), path, filename); // Find out how much padding is required. std::string path_spaces; std::string filename_spaces; genSpaces(path, path_spaces); genSpaces(filename, filename_spaces); // Display marked torrents with different color. if (iter->selected()) { setColor(Colors::C_MARK); } if (counter == currentPosition_) { ::wattron(window_, A_REVERSE); if (!iter->selected()) { setColor(Colors::C_FILE); } mvwprintw(window_, scr_counter, 0, " %s%s", filename.c_str(), filename_spaces.c_str()); mvwprintw(window_, scr_counter+1, 0, " %s%s", path.c_str(), path_spaces.c_str()); if (!iter->selected()) { unSetColor(Colors::C_FILE); } ::wattroff(window_, A_REVERSE); } else { if (!iter->selected()) { setColor(Colors::C_FILE); } mvwprintw(window_, scr_counter, 0, " %s%s", filename.c_str(), filename_spaces.c_str()); mvwprintw(window_, scr_counter+1, 0, " %s%s", path.c_str(), path_spaces.c_str()); if (!iter->selected()) { unSetColor(Colors::C_FILE); } } // Display marked torrents with different color. if (iter->selected()) { unSetColor(Colors::C_MARK); } counter++; scr_counter += linesPerFile; } }
void fileView::drawList() { std::vector<btg::core::fileInformation>::const_iterator iterBeg = info_.begin(); std::vector<btg::core::fileInformation>::const_iterator iterEnd = info_.begin(); if (positionWindowEnd_ == 0) { positionWindowEnd_ = numberOfLines_; } if (positionWindowEnd_ > static_cast<t_int>(info_.size())) { positionWindowEnd_ = info_.size(); } // Move the iterator the the start of the window to display. for (t_int counter = 0; counter < positionWindowStart_; counter++) { iterBeg++; } // Move the iterator the the end of the window to display. for (t_int counter = 0; counter < positionWindowEnd_; counter++) { iterEnd++; } // Display the window. t_int counter = 0; t_int scr_counter = 0; std::vector<btg::core::fileInformation>::const_iterator iter; for (iter = iterBeg; iter != iterEnd; iter++) { btg::core::fileInformation const& fi = *iter; std::string org_filename = fi.getFilename(); // Split the filename into path + file. std::string path; std::string filename; splitPath(org_filename, path, filename); // Convert the file size into human readable units. t_ulong bytes = fi.getFileSize(); btg::core::humanReadableUnit hru = btg::core::humanReadableUnit::convert(bytes); std::string fsize = hru.toString(); // Display the pieces that we have and the percent of the file downloaded. std::string pieces; genPieces(fi, pieces); // Find out how much padding is required. std::string path_spaces; std::string filename_spaces; std::string fsize_spaces; std::string pieces_spaces; genSpaces(path, path_spaces); genSpaces(filename, filename_spaces); genSpaces(fsize, fsize_spaces); genSpaces(pieces, pieces); if (counter == currentPosition_) { ::wattron(window_, A_REVERSE); setColor(Colors::C_FILE); mvwprintw(window_, scr_counter, 0, " %s%s", filename.c_str(), filename_spaces.c_str()); mvwprintw(window_, scr_counter+1, 0, " %s%s", path.c_str(), path_spaces.c_str()); mvwprintw(window_, scr_counter+2, 0, " %s%s", fsize.c_str(), fsize_spaces.c_str()); mvwprintw(window_, scr_counter+3, 0, " %s%s", pieces.c_str(), pieces_spaces.c_str()); unSetColor(Colors::C_FILE); ::wattroff(window_, A_REVERSE); } else { setColor(Colors::C_FILE); mvwprintw(window_, scr_counter, 0, " %s%s", filename.c_str(), filename_spaces.c_str()); mvwprintw(window_, scr_counter+1, 0, " %s%s", path.c_str(), path_spaces.c_str()); mvwprintw(window_, scr_counter+2, 0, " %s%s", fsize.c_str(), fsize_spaces.c_str()); mvwprintw(window_, scr_counter+3, 0, " %s%s", pieces.c_str(), pieces_spaces.c_str()); unSetColor(Colors::C_FILE); } counter++; scr_counter += linesPerFile; } }