StanfordCPPLib
Public Member Functions | Static Public Member Functions | List of all members
GConsoleWindow Class Reference

#include "gconsolewindow.h"

Inheritance diagram for GConsoleWindow:
GWindow GObservable GForwardDrawingSurface GDrawingSurface

Public Member Functions

void clearConsole()
 
void clipboardCopy()
 
void clipboardCut()
 
void clipboardPaste()
 
void close()
 
void compareOutput(string filename)
 
string getAllOutput() const
 
string getBackground() const
 
int getBackgroundInt() const
 
string getColor() const
 
int getColorInt() const
 
string getErrorColor() const
 
string getForeground() const
 
int getForegroundInt() const
 
string getOutputColor() const
 
bool isClearEnabled() const
 
bool isEcho() const
 
bool isLocationSaved() const
 
bool isLocked() const
 
void loadConfiguration()
 
void loadInputScript(int number)
 
void loadInputScript(string filename)
 
void print(string str, bool isStdErr=false)
 
void println(bool isStdErr=false)
 
void println(string str, bool isStdErr=false)
 
string readLine()
 
void save()
 
void saveAs(string filename="")
 
void saveConfiguration(bool prompt=true)
 
void showAboutDialog()
 
void showColorDialog(bool background=false)
 
void showCompareOutputDialog()
 
void showFontDialog()
 
void showInputScriptDialog()
 
void showPrintDialog()
 
void selectAll()
 
void setBackground(int color)
 
void setBackground(string color)
 
void setClearEnabled(bool clearEnabled)
 
void setConsoleSize(double width, double height)
 
void setColor(int color)
 
void setColor(string color)
 
void setEcho(bool echo)
 
void setErrorColor(string errorColor)
 
void setFont(const QFont &font)
 
void setFont(string font)
 
void setForeground(int color)
 
void setForeground(string color)
 
void setLocationSaved(bool locationSaved)
 
void setLocked(bool locked)
 
void setOutputColor(int rgb)
 
void setOutputColor(string outputColor)
 
void shutdown()
 
- Public Member Functions inherited from GWindow
 GWindow(double width=0, double height=0, bool visible=true)
 
~GWindow()
 
void add(GInteractor *interactor)
 
void add(GInteractor *interactor, double x, double y)
 
void add(GInteractor &interactor)
 
void add(GInteractor &interactor, double x, double y)
 
void add(GObject *obj)
 
void add(GObject *obj, double x, double y)
 
void add(GObject &obj)
 
void add(GObject &obj, double x, double y)
 
QMenu * addMenu(string text)
 
QAction * addMenuItem(string menu, string item, string icon="")
 
QAction * addMenuItem(string menu, string item, string icon, GEventListenerVoid func)
 
QAction * addMenuItemCheckBox(string menu, string item, bool checked=false, string icon="")
 
QAction * addMenuItemCheckBox(string menu, string item, bool checked, string icon, GEventListenerVoid func)
 
QAction * addMenuSeparator(string menu)
 
QMenu * addSubMenu(string menu, string submenu)
 
void addToRegion(GInteractor *interactor, Region region)
 
void addToRegion(GInteractor *interactor, string region="Center")
 
void addToRegion(GInteractor &interactor, Region region)
 
void addToRegion(GInteractor &interactor, string region="Center")
 
void clear()
 
void clearCanvas()
 
void clearCanvasObjects()
 
void clearCanvasPixels()
 
void clearRegion(Region region)
 
void clearRegion(string region)
 
void center()
 
void compareToImage(string filename, bool ignoreWindowSize=true) const
 
bool eventsEnabled() const
 
double getCanvasHeight() const
 
GDimension getCanvasSize() const
 
double getCanvasWidth() const
 
CloseOperation getCloseOperation() const
 
GObjectgetGObject(int index) const
 
GObjectgetGObjectAt(double x, double y) const
 
int getGObjectCount() const
 
GPoint getLocation() const
 
double getHeight() const
 
GDimension getPreferredSize() const
 
double getRegionHeight(Region region) const
 
double getRegionHeight(string region) const
 
GDimension getRegionSize(Region region) const
 
GDimension getRegionSize(string region) const
 
double getRegionWidth(Region region) const
 
double getRegionWidth(string region) const
 
GDimension getSize() const
 
string getTitle() const
 
string getType() const
 
QWidget*  getWidget() const
 
double getWidth() const
 
double getX() const
 
double getY() const
 
void hide()
 
bool inBounds(double x, double y) const
 
bool inCanvasBounds(double x, double y) const
 
bool isMaximized() const
 
bool isMinimized() const
 
bool isOpen() const
 
bool isRepaintImmediately() const
 
bool isResizable() const
 
bool isVisible() const
 
void loadCanvasPixels(string filename)
 
void pack()
 
void pause(double ms)
 
void rememberPosition()
 
void remove(GInteractor *interactor)
 
void remove(GInteractor &interactor)
 
void remove(GObject *obj)
 
void remove(GObject &obj)
 
void removeClickListener()
 
void removeFromRegion(GInteractor *interactor, Region region)
 
void removeFromRegion(GInteractor *interactor, string region)
 
void removeFromRegion(GInteractor &interactor, Region region)
 
void removeFromRegion(GInteractor &interactor, string region)
 
void removeKeyListener()
 
void removeMenuListener()
 
void removeMouseListener()
 
void removeTimerListener()
 
void removeWindowListener()
 
void requestFocus()
 
void saveCanvasPixels(string filename)
 
void setCanvasHeight(double height)
 
void setCanvasSize(double width, double height)
 
void setCanvasSize(const GDimension &size)
 
void setCanvasWidth(double width)
 
void setClickListener(GEventListener func)
 
void setClickListener(GEventListenerVoid func)
 
void setCloseOperation(CloseOperation op)
 
void setExitOnClose(bool exitOnClose)
 
void setHeight(double width)
 
void setKeyListener(GEventListener func)
 
void setKeyListener(GEventListenerVoid func)
 
void setLocation(double x, double y)
 
void setLocation(const GPoint &p)
 
void setLocation(const Point &p)
 
void setMenuItemEnabled(string menu, string item, bool enabled)
 
void setMenuListener(GEventListener func)
 
void setMenuListener(GEventListenerVoid func)
 
void setMouseListener(GEventListener func)
 
void setMouseListener(GEventListenerVoid func)
 
void setRegionAlignment(Region region, HorizontalAlignment halign)
 
void setRegionAlignment(Region region, VerticalAlignment valign)
 
void setRegionAlignment(Region region, HorizontalAlignment halign, VerticalAlignment valign)
 
void setRegionAlignment(string region, string align)
 
void setRegionAlignment(string region, string halign, string valign)
 
void setRegionHorizontalAlignment(Region region, HorizontalAlignment halign)
 
void setRegionHorizontalAlignment(string region, string halign)
 
void setRegionVerticalAlignment(string region, string valign)
 
void setRegionVerticalAlignment(Region region, VerticalAlignment valign)
 
void setResizable(bool resizable)
 
void setSize(double width, double height)
 
void setSize(const GDimension &size)
 
void setTimerListener(double ms, GEventListener func)
 
void setTimerListener(double ms, GEventListenerVoid func)
 
void setTitle(string title)
 
void setVisible(bool visible)
 
void setWidth(double width)
 
void setWindowIcon(string iconFile)
 
void setWindowListener(GEventListener func)
 
void setWindowListener(GEventListenerVoid func)
 
void setWindowTitle(string title)
 
void setX(double x)
 
void setY(double y)
 
void show()
 
void sleep(double ms)
 
void toBack()
 
void toFront()
 
void _autograder_setIsAutograderWindow(bool isAutograderWindow)
 
- Public Member Functions inherited from GObservable
 GObservable()
 
~GObservable()
 
void setEventsEnabled(bool eventsEnabled)
 
string toString() const
 
- Public Member Functions inherited from GForwardDrawingSurface
void draw(GObject *gobj)
 
void draw(GObject *gobj, double x, double y)
 
void draw(GObject &gobj)
 
void draw(GObject &gobj, double x, double y)
 
void draw(QPainter *painter)
 
int getPixel(double x, double y) const
 
int getPixelARGB(double x, double y) const
 
Grid< int > getPixels() const
 
Grid< int > getPixelsARGB() const
 
bool isAutoRepaint() const
 
void repaint()
 
void repaintRegion(int x, int y, int width, int height)
 
void setAutoRepaint(bool autoRepaint)
 
void setFillColor(int color)
 
void setFillColor(string color)
 
void setLineWidth(double lineWidth)
 
void setPixel(double x, double y, int rgb)
 
void setPixel(double x, double y, int r, int g, int b)
 
void setPixelARGB(double x, double y, int argb)
 
void setPixelARGB(double x, double y, int a, int r, int g, int b)
 
void setPixels(const Grid< int > &pixels)
 
void setPixelsARGB(const Grid< int > &pixelsARGB)
 
void setRepaintImmediately(bool repaintImmediately)
 
- Public Member Functions inherited from GDrawingSurface
 GDrawingSurface()
 
~GDrawingSurface()
 
void conditionalRepaint()
 
void conditionalRepaintRegion(int x, int y, int width, int height)
 
void conditionalRepaintRegion(const GRectangle &bounds)
 
void drawArc(double x, double y, double width, double height, double start, double sweep)
 
void drawImage(string filename, double x=0, double y=0)
 
void drawLine(const GPoint &p0, const GPoint &p1)
 
void drawLine(double x0, double y0, double x1, double y1)
 
void drawOval(const GRectangle &bounds)
 
void drawOval(double x, double y, double width, double height)
 
GPoint drawPolarLine(const GPoint &p0, double r, double theta)
 
GPoint drawPolarLine(double x0, double y0, double r, double theta)
 
void drawPixel(double x, double y)
 
void drawPixel(double x, double y, int color)
 
void drawPixel(double x, double y, string color)
 
void drawPolygon(std::initializer_list< double > coords)
 
void drawPolygon(std::initializer_list< GPoint > points)
 
void drawRect(const GRectangle &bounds)
 
void drawRect(double x, double y, double width, double height)
 
void drawString(string text, double x, double y)
 
void fillArc(double x, double y, double width, double height, double start, double sweep)
 
void fillOval(const GRectangle &bounds)
 
void fillOval(double x, double y, double width, double height)
 
void fillPolygon(std::initializer_list< double > coords)
 
void fillRect(const GRectangle &bounds)
 
void fillRect(double x, double y, double width, double height)
 
int getARGB(double x, double y) const
 
string getFillColor() const
 
int getFillColorInt() const
 
string getFont() const
 
GObject::LineStyle getLineStyle() const
 
double getLineWidth() const
 
string getPixelString(double x, double y) const
 
int getRGB(double x, double y) const
 
string getRGBString(double x, double y) const
 
void repaintRegion(const GRectangle &bounds)
 
void setLineStyle(GObject::LineStyle lineStyle)
 
void setPixel(double x, double y, string color)
 
void setRGB(double x, double y, int rgb)
 
void setRGB(double x, double y, int r, int g, int b)
 
void setRGB(double x, double y, string color)
 

Static Public Member Functions

static bool consoleEnabled()
 
static string getDefaultFont()
 
static GConsoleWindowinstance()
 
static void setConsoleEnabled(bool enabled)
 
- Static Public Member Functions inherited from GWindow
static double getScreenHeight()
 
static GDimension getScreenSize()
 
static double getScreenWidth()
 
static QMainWindow * getLastWindow()
 
static void _autograder_setExitGraphicsEnabled(bool enabled)
 
static void _autograder_setPauseEnabled(bool enabled)
 

Additional Inherited Members

- Public Types inherited from GWindow
enum  Region { REGION_CENTER = GContainer::REGION_CENTER, REGION_EAST = GContainer::REGION_EAST, REGION_NORTH = GContainer::REGION_NORTH, REGION_SOUTH = GContainer::REGION_SOUTH, REGION_WEST = GContainer::REGION_WEST }
 
enum  CloseOperation { CLOSE_DO_NOTHING, CLOSE_HIDE, CLOSE_DISPOSE, CLOSE_EXIT }
 
- Static Public Attributes inherited from GWindow
static const int DEFAULT_WIDTH = 500
 
static const int DEFAULT_HEIGHT = 300
 
static const string DEFAULT_ICON_FILENAME = "splicon-large.png"
 
- Protected Member Functions inherited from GWindow
void processKeyPressEventInternal(QKeyEvent *event)
 
- Protected Member Functions inherited from GObservable
void clearEventListeners()
 
void ensureThreadSafety(string memberName="")
 
void fireEvent(GEvent &event)
 
void fireGEvent(QEvent *event, EventType eventType, string eventName)
 
void fireGEvent(QCloseEvent *event, EventType eventType, string eventName)
 
void fireGEvent(QKeyEvent *event, EventType eventType, string eventName)
 
void fireGEvent(QMouseEvent *event, EventType eventType, string eventName, string actionCommand="")
 
void fireGEvent(QResizeEvent *event, EventType eventType, string eventName)
 
void fireGEvent(QTimerEvent *event, EventType eventType, string eventName)
 
void fireGEvent(QWheelEvent *event, EventType eventType, string eventName)
 
void fireGEvent(QWindowStateChangeEvent *event, EventType eventType, string eventName)
 
bool hasEventListener(string eventName) const
 
bool isAcceptingEvent(int eventMask) const
 
bool isAcceptingEvent(const GEvent &event) const
 
bool isAcceptingEvent(string eventType) const
 
void removeEventListener(string eventName)
 
void removeEventListeners(std::initializer_list< string > eventNames)
 
void setEventListener(string eventName, GEventListener func)
 
void setEventListener(string eventName, GEventListenerVoid func)
 
void setEventListeners(std::initializer_list< string > eventNames, GEventListener func)
 
void setEventListeners(std::initializer_list< string > eventNames, GEventListenerVoid func)
 
- Protected Member Functions inherited from GForwardDrawingSurface
void ensureForwardTargetConstHack() const
 
- Protected Member Functions inherited from GDrawingSurface
void checkBounds(string member, double x, double y, double width, double height) const
 
void checkColor(string member, int rgb) const
 
void checkSize(string member, double width, double height) const
 
void initializeGObject(GObject &obj, bool filled=false)
 
void initializeGObject(GObject *obj, bool filled=false)
 
void setDrawingForwardTarget(GDrawingSurface *forwardTarget)
 
- Protected Attributes inherited from GObservable
Map< string, GEvent::EventListenerWrapper_eventMap
 
bool _eventsEnabled
 
- Protected Attributes inherited from GDrawingSurface
GDrawingSurface_forwardTarget
 
string _backgroundColor
 
string _color
 
string _fillColor
 
string _font
 
int _backgroundColorInt
 
int _colorInt
 
int _fillColorInt
 
GObject::LineStyle _lineStyle
 
double _lineWidth
 
bool _autoRepaint
 

Member Function Documentation

◆ clearConsole()

void clearConsole ( )
virtual

◆ clipboardCopy()

void clipboardCopy ( )
virtual

◆ clipboardCut()

void clipboardCut ( )
virtual

◆ clipboardPaste()

void clipboardPaste ( )
virtual

◆ close()

void close ( )
virtual

Reimplemented from GWindow.

◆ compareOutput()

void compareOutput ( string   filename)
virtual

◆ consoleEnabled()

bool consoleEnabled ( )
static

◆ getAllOutput()

string getAllOutput ( ) const
virtual

◆ getBackground()

string getBackground ( ) const
virtual

Reimplemented from GDrawingSurface.

◆ getBackgroundInt()

int getBackgroundInt ( ) const
virtual

Reimplemented from GDrawingSurface.

◆ getColor()

string getColor ( ) const
virtual

Reimplemented from GDrawingSurface.

◆ getColorInt()

int getColorInt ( ) const
virtual

Reimplemented from GDrawingSurface.

◆ getDefaultFont()

string getDefaultFont ( )
static

◆ getErrorColor()

string getErrorColor ( ) const
virtual

◆ getForeground()

string getForeground ( ) const
virtual

Reimplemented from GDrawingSurface.

◆ getForegroundInt()

int getForegroundInt ( ) const
virtual

Reimplemented from GDrawingSurface.

◆ getOutputColor()

string getOutputColor ( ) const
virtual

◆ instance()

GConsoleWindow * instance ( )
static

◆ isClearEnabled()

bool isClearEnabled ( ) const
virtual

◆ isEcho()

bool isEcho ( ) const
virtual

◆ isLocationSaved()

bool isLocationSaved ( ) const
virtual

◆ isLocked()

bool isLocked ( ) const
virtual

◆ loadConfiguration()

void loadConfiguration ( )
virtual

◆ loadInputScript() [1/2]

void loadInputScript ( int  number)
virtual

◆ loadInputScript() [2/2]

void loadInputScript ( string   filename)
virtual

◆ print()

void print ( string   str,
bool  isStdErr = false 
)
virtual

◆ println() [1/2]

void println ( bool  isStdErr = false)
virtual

◆ println() [2/2]

void println ( string   str,
bool  isStdErr = false 
)
virtual

◆ readLine()

string readLine ( )
virtual

◆ save()

void save ( )
virtual

◆ saveAs()

void saveAs ( string   filename = "")
virtual

◆ saveConfiguration()

void saveConfiguration ( bool  prompt = true)
virtual

◆ selectAll()

void selectAll ( )
virtual

◆ setBackground() [1/2]

void setBackground ( int  color)
virtual

Reimplemented from GWindow.

◆ setBackground() [2/2]

void setBackground ( string   color)
virtual

Reimplemented from GWindow.

◆ setClearEnabled()

void setClearEnabled ( bool  clearEnabled)
virtual

◆ setColor() [1/2]

void setColor ( int  color)
virtual

Reimplemented from GForwardDrawingSurface.

◆ setColor() [2/2]

void setColor ( string   color)
virtual

Reimplemented from GForwardDrawingSurface.

◆ setConsoleEnabled()

void setConsoleEnabled ( bool  enabled)
static

◆ setConsoleSize()

void setConsoleSize ( double  width,
double  height 
)
virtual

◆ setEcho()

void setEcho ( bool  echo)
virtual

◆ setErrorColor()

void setErrorColor ( string   errorColor)
virtual

◆ setFont() [1/2]

void setFont ( const QFont &  font)
virtual

Reimplemented from GForwardDrawingSurface.

◆ setFont() [2/2]

void setFont ( string   font)
virtual

Reimplemented from GForwardDrawingSurface.

◆ setForeground() [1/2]

void setForeground ( int  color)
virtual

Reimplemented from GDrawingSurface.

◆ setForeground() [2/2]

void setForeground ( string   color)
virtual

Reimplemented from GDrawingSurface.

◆ setLocationSaved()

void setLocationSaved ( bool  locationSaved)
virtual

◆ setLocked()

void setLocked ( bool  locked)
virtual

◆ setOutputColor() [1/2]

void setOutputColor ( int  rgb)
virtual

◆ setOutputColor() [2/2]

void setOutputColor ( string   outputColor)
virtual

◆ showAboutDialog()

void showAboutDialog ( )
virtual

◆ showColorDialog()

void showColorDialog ( bool  background = false)
virtual

◆ showCompareOutputDialog()

void showCompareOutputDialog ( )
virtual

◆ showFontDialog()

void showFontDialog ( )
virtual

◆ showInputScriptDialog()

void showInputScriptDialog ( )
virtual

◆ showPrintDialog()

void showPrintDialog ( )
virtual

◆ shutdown()

void shutdown ( )
virtual