PrevNextUpHome SophiaFramework UNIVERSE 5.3
SFOTableCellImageReactor
Class which provides the drawing function of table cells.
#include <SFOTableCellImageReactor.h.hpp>
class SFOTableCellImageReactor : public SFOTableCellReactor;
SFMTYPEDEFREFOBJECT(SFOTableCellImageReactor)
        

Inheritance diagram

 Inheritance diagram of SFOTableCellImageReactorClass

Collaboration diagram

 Collaboration diagram of SFOTableCellImageReactorClass

Description

The SFOTableCellImageReactor class is a table cell reactor which provides the drawing function to cells for the cell objects of the SFBImageSmp type.

Reference

SFOTableCellReactor

Member

Constructor/Destructor
SFOTableCellImageReactor( Void )
Constructor of the SFOTableCellImageReactor class.
~SFOTableCellImageReactor( Void )
Destructor of the SFOTableCellImageReactor class.
Public Functions
static
SFOTableCellImageReactorSmp
NewInstance( SFCErrorPtr exception = null )
Create a new instance of this class.
ValueRec GetProperty( UInt32 key , BoolPtr found = null , Bool recursive = true ) (inherits from SFOTableCellReactor)
Get the property value corresponding to the specified key.
Bool HasProperty( UInt32 key , Bool recursive = true ) (inherits from SFOTableCellReactor)
Check if the specified key is contained.
SFCError SetProperty( UInt32 key , ValueRec value ) (inherits from SFOTableCellReactor)
Set the property value corresponding to the specified key.
Protected Functions
Void Render( SFXGraphicsPtr graphics , SFXRectangleConstRef bound , SFXAnyConstRef object , SInt32 row , Bool active , Bool focus )
Draw a image into a table cell.
static
SFXRectangle
Align( SFXRectangleConstRef src , SFXRectangleConstRef ref , UInt32 alignment ) (inherits from SFOTableCellReactor)
Align the specified rectangle with the base rectangle.
static
SFORefObjectSmp
Factory( SFORefObjectPtr object , SFCErrorPtr exception ) (inherits from SFORefObject)
This function is used to implement the NewInstance function.
UInt32 GetAlignment( Void ) (inherits from SFOTableCellReactor)
Get the alignment.
SFXMargin GetMargin( Void ) (inherits from SFOTableCellReactor)
Get the margin between the table cell area and the cell drawing area.
Bool Handle( SFXAnyRef object , SInt32 row ) (inherits from SFOTableCellReactor)
Handle the selected table cell.
SFCError Initialize( Void ) (inherits from SFORefObject)
Make the initialization which may raise an error.
Void InvokeResultCell( Void ) (inherits from SFOTableCellReactor)
Notify that selecting a table cell is performed.
Bool IsEditable( Void ) (inherits from SFOTableCellReactor)
Check if the cell reactor is editable.
Bool IsWidgetAttachable( Void ) (inherits from SFOTableCellReactor)
Checks if the cell is widget-attachable.
Void OffFocus( SInt32 row , SFYWidgetSmpPtr widget ) (inherits from SFOTableCellReactor)
Handle a table cell which has been unfocused.
Void OnFocus( SFXRectangleConstRef bound , SFXAnyConstRef object , SInt32 row , SFYWidgetSmpPtr widget ) (inherits from SFOTableCellReactor)
Handle a table cell which has been focused.

SFOTableCellImageReactor::SFOTableCellImageReactor
Constructor of the SFOTableCellImageReactor class.
[ protected, explicit ]
SFOTableCellImageReactor(Void);

Description

This constructor does nothing.


SFOTableCellImageReactor::~SFOTableCellImageReactor
Destructor of the SFOTableCellImageReactor class.
[ protected, virtual ]
~SFOTableCellImageReactor(Void);

Description

This destructor does nothing.


SFOTableCellImageReactor::NewInstance
Create a new instance of this class.
[ public, static ]
SFOTableCellImageReactorSmp NewInstance(
    SFCErrorPtr exception = null   // error value
);

Argument

exception

Return the error value generated inside the function.

Return value

  • If succeeds: not null pointer
  • Otherwise: null pointer

Description

This function creates a new instance of the SFOTableCellImageReactor class.

If succeeds, a not null pointer will be returned, and the "exception" argument is SFERR_NO_ERROR. If fails, a null pointer will be returned, and "exception" argument holds the error value.

Example

The following is a code to generate a new instance of the SFOTableCellImageReactor class.

SFOTableCellReactorSmp rtor;
SFCError error;

if ((rtor = SFOTableCellImageReactor::NewInstance(&error)) != null) {
    // .. (omitted) ..
}

Reference

SFOTableCellImageReactor


SFOTableCellImageReactor::Render
Draw a image into a table cell.
[ protected, virtual, const ]
Void Render(
    SFXGraphicsPtr graphics      // graphics oject
    SFXRectangleConstRef bound   // table cell area
    SFXAnyConstRef object        // cell object
    SInt32 row                   // row index of cell to draw
    Bool active                  // active state of cell
    Bool focus                   // focus state of cell
);

Description

This function draws a image into a table cell area with considering the margin and the alignment.

Internal implementation

Internal implementation of this function is as follows.

/*public virtual */Void SFOTableCellImageReactor::Render(SFXGraphicsPtr graphics, SFXRectangleConstRef bound, SFXAnyConstRef object, SInt32 row, Bool active, Bool focus) const
{
    AEEImageInfo                                info;
    SFXRectangle                                rx;
    SFXRectangle                                content;
    SFXRectangle                                clip;
    SFBImageSmpPtr                              ptr;
    SFBImageSmp                                 image;

    unused(row); unused(active); unused(focus);
    if ((ptr = any_cast<SFBImageSmp>(const_cast<SFXAnyPtr>(&object))) != null) {
        if ((image = *ptr) != null) {
            image->GetInfo(&info);
            if (info.cx > 0 && info.cy > 0) {
                clip.Set(graphics->GetClip());
                content.Set(SFXRectangle(bound).Deflate(GetMargin()));
                graphics->SetClip(SFXRectangle(content).Intersection(clip));
                rx.SetSize(info.cx, info.cy);
                rx.Set(Align(rx, content, GetAlignment()));
                graphics->DrawImage(image, rx.GetOrigin());
                graphics->SetClip(clip);
            }
        }
    }
    return;
}// SFOTableCellImageReactor::Render //