libscratchcpp
A library for C++ based Scratch project players
Loading...
Searching...
No Matches
libscratchcpp::Input Class Reference

The Input class represents a Scratch block input. More...

#include <scratchcpp/input.h>

Public Types

enum class  Type { Shadow = 1 , NoShadow = 2 , ObscuredShadow = 3 }
 

Public Member Functions

 Input (const std::string &name, Type type)
 
 Input (const Input &)=delete
 
const std::string & name () const
 
Type type () const
 
InputValueprimaryValue ()
 
InputValuesecondaryValue ()
 
void setPrimaryValue (const Value &value)
 
void setSecondaryValue (const Value &value)
 
BlockvalueBlock () const
 
const std::string & valueBlockId () const
 
void setValueBlock (Block *block)
 
void setValueBlockId (const std::string &id)
 
bool pointsToDropdownMenu () const
 
std::string selectedMenuItem () const
 

Detailed Description

The Input class represents a Scratch block input.

Member Enumeration Documentation

◆ Type

enum class libscratchcpp::Input::Type
strong
Enumerator
Shadow 
NoShadow 
ObscuredShadow 

Constructor & Destructor Documentation

◆ Input() [1/2]

Input::Input ( const std::string & name,
Type type )

Constructs Input.

◆ Input() [2/2]

libscratchcpp::Input::Input ( const Input & )
delete

Member Function Documentation

◆ name()

const std::string & Input::name ( ) const

Returns the name of the input.

◆ pointsToDropdownMenu()

bool Input::pointsToDropdownMenu ( ) const

Returns true if the input points to a dropdown menu.
(if valueBlock() points to a shadow block with a single field which does not point to an entity)

◆ primaryValue()

InputValue * Input::primaryValue ( )

Returns the primary value.

◆ secondaryValue()

InputValue * Input::secondaryValue ( )

Returns the secondary value (usually the value of an obscured shadow).

◆ selectedMenuItem()

std::string Input::selectedMenuItem ( ) const

Returns the selected item in the dropdown menu.
Works only pointsToDropdownMenu() is true.

◆ setPrimaryValue()

void Input::setPrimaryValue ( const Value & value)

Sets the primary value.

◆ setSecondaryValue()

void Input::setSecondaryValue ( const Value & value)

Sets the secondary value.

◆ setValueBlock()

void Input::setValueBlock ( Block * block)

Sets the block which obscures the shadow or, if there's a shadow, sets the block the input points to.

◆ setValueBlockId()

void Input::setValueBlockId ( const std::string & id)

Sets the ID of the value block.

See also
setValueBlock()

◆ type()

Input::Type Input::type ( ) const

Returns the type of the input.

◆ valueBlock()

Block * Input::valueBlock ( ) const

Returns the block which obscures the shadow.

◆ valueBlockId()

const std::string & Input::valueBlockId ( ) const

Returns the ID of the block which obscures the shadow or, if there's a shadow, returns the block the input points to.


The documentation for this class was generated from the following files: