YCLIMP
Yandex Command Line Interface Music Player
Loading...
Searching...
No Matches
Utility.hpp File Reference

Utility function list. More...

#include "Primitives.hpp"
#include <string>
#include <vector>
Include dependency graph for Utility.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ProgressBar

Enumerations

enum class  SWHolderType {
  None = -1 , TopInfo = 0 , Main , Additional ,
  Central
}

Functions

std::string getProjectDir ()
bool PrintwInLimitedX (const Vector2i &startPos, const std::string &text, int xLimit, int startIndx=0, bool truncIfNotFit=true)
 Printw line in specified x boundary. if line is larger than x boundary. then truncate the line.
void printwRectangle (const Recti &rect, bool hasSelection=false, int colorPair=1)
void clearArea (const Recti &rect)
 clearArea - clears specified rect, rect itself is not included,
only area inside rectangle without bounds
void printwMsgBox (const std::string &msg, const Recti &availableSpace)
void printOptionsInLine (const Vector2i &startPos, int xAvailableSpace, const std::vector< std::string > &options, int selectionIndx=-1, int colorPair=1)

Detailed Description

Utility function list.

Function Documentation

◆ clearArea()

void clearArea ( const Recti & rect)

clearArea - clears specified rect, rect itself is not included,
only area inside rectangle without bounds

Parameters
rect- rect to clear

◆ printOptionsInLine()

void printOptionsInLine ( const Vector2i & startPos,
int xAvailableSpace,
const std::vector< std::string > & options,
int selectionIndx = -1,
int colorPair = 1 )

raw function, HorizontalOptionChoice uses it It's written badly, but it's fine for now

◆ PrintwInLimitedX()

bool PrintwInLimitedX ( const Vector2i & startPos,
const std::string & text,
int xLimit,
int startIndx = 0,
bool truncIfNotFit = true )

Printw line in specified x boundary. if line is larger than x boundary. then truncate the line.

Parameters
startPoscordinates on the screen
textstring to print(draw)
xLimitavailable space in x axis
startIndxstart printing from indx
truncIfNotFittruncate text if it cannot be fitted fully
Returns
if line can be fitted return true, else false

◆ printwMsgBox()

void printwMsgBox ( const std::string & msg,
const Recti & availableSpace )

uses printwRectangle to draw rectangle and prints in there a message. Note! actual box(bounds) are dynamicly created according to the message size. If message is too big to be fit with bounds, bounds are ignored. If message still to big to be feet, it will be truncated(without "...").

Parameters
msg- message to printw(draw)
availableSpace- max boundaries

◆ printwRectangle()

void printwRectangle ( const Recti & rect,
bool hasSelection = false,
int colorPair = 1 )

printw(draw) rectangular bounds.

Parameters
rectrectangle to printw(draw)
hasSelectionif true uses colorPair(1 by default) to draw rectangle
colorPairif hasSelection true, use specifiedd colorPair