- lot of new separated Etk and Evas classes
- fixed some warnings SVN revision: 38419
This commit is contained in:
parent
e74f5e323c
commit
2d61537d2c
|
@ -1,3 +1,7 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <eflpp_sys.h>
|
||||
|
||||
#include "calibrate.h"
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include <eflpp_evas.h>
|
||||
#include <eflpp_ecore.h>
|
||||
|
||||
using namespace efl;
|
||||
|
||||
enum
|
||||
|
|
|
@ -30,11 +30,13 @@ int main( int argc, const char **argv )
|
|||
// char* test
|
||||
EcoreList <char> strList;
|
||||
|
||||
char *str[3] = {"First", "Second", "Third"};
|
||||
|
||||
strList.append( str[0] );
|
||||
strList.append( str[1] );
|
||||
strList.append( str[2] );
|
||||
char first[] = "First";
|
||||
char second[] = "Second";
|
||||
char third[] = "Third";
|
||||
|
||||
strList.append( first );
|
||||
strList.append( second );
|
||||
strList.append( third );
|
||||
|
||||
char *s = strList.gotoFirst ();
|
||||
s = strList.next ();
|
||||
|
|
|
@ -42,7 +42,7 @@ TimerApp( int argc, const char** argv ) : efl::EcoreApplication( argc, argv, "Ec
|
|||
logo->setColor( 255, 255, 255, 0 );
|
||||
logo->show();
|
||||
|
||||
for( int i = 0; i < NUMBALLS; ++i )
|
||||
for( unsigned int i = 0; i < NUMBALLS; ++i )
|
||||
{
|
||||
balls[i] = new efl::EvasImage( 20*i, 20*i, PACKAGE_DATA_DIR "/images/boing-shadow.png", evas );
|
||||
balls[i]->resize( BALLSIZE, BALLSIZE, true );
|
||||
|
@ -57,6 +57,7 @@ efl::EcoreEvasWindowSoftwareX11* mw;
|
|||
efl::EvasCanvas* evas;
|
||||
efl::EvasImage* image, *shadow, *logo;
|
||||
efl::EvasImage* balls[NUMBALLS];
|
||||
|
||||
double xoffset; double yoffset;
|
||||
double xstep; double ystep;
|
||||
int size; int direction;
|
||||
|
@ -70,7 +71,7 @@ virtual bool timerEvent()
|
|||
alpha += alphadirection;
|
||||
if ( alpha == 0 || alpha == 255 ) alphadirection *= -1;
|
||||
|
||||
for ( int i = 0; i < NUMBALLS; ++i )
|
||||
for ( unsigned int i = 0; i < NUMBALLS; ++i )
|
||||
{
|
||||
balls[i]->move( BALLWIDTH / 2 + sin( xoffset + xaddfactor*i*(2*PI/NUMBALLS) ) * BALLWIDTH/2,
|
||||
BALLHEIGHT / 2 + cos( yoffset + yaddfactor*i*(2*PI/NUMBALLS) ) * BALLHEIGHT/2 );
|
||||
|
|
|
@ -9,19 +9,29 @@ AM_CXXFLAGS = @PACKAGE_CFLAGS@ \
|
|||
noinst_LTLIBRARIES = libeflpp_etk.la
|
||||
|
||||
libeflpp_etk_la_SOURCES = \
|
||||
eflpp_etk.cpp \
|
||||
eflpp_etkimage.cpp \
|
||||
eflpp_etkcontainer.cpp \
|
||||
eflpp_etkwidget.cpp \
|
||||
eflpp_etkobject.cpp
|
||||
eflpp_etk.cpp\
|
||||
eflpp_etkimage.cpp\
|
||||
eflpp_etkcontainer.cpp\
|
||||
eflpp_etkwidget.cpp\
|
||||
eflpp_etkobject.cpp\
|
||||
eflpp_etkbox.cpp\
|
||||
eflpp_etkbutton.cpp\
|
||||
eflpp_etkapplication.cpp\
|
||||
eflpp_etktoplevel.cpp\
|
||||
eflpp_etkwindow.cpp
|
||||
|
||||
libeflpp_includedir = $(pkgincludedir)
|
||||
|
||||
libeflpp_include_DATA = \
|
||||
eflpp_etk.h \
|
||||
eflpp_etkimage.h \
|
||||
eflpp_etkcontainer.h \
|
||||
eflpp_etkwidget.h \
|
||||
eflpp_etkobject.h
|
||||
eflpp_etk.h\
|
||||
eflpp_etkimage.h\
|
||||
eflpp_etkcontainer.h\
|
||||
eflpp_etkwidget.h\
|
||||
eflpp_etkobject.h\
|
||||
eflpp_etkbox.h\
|
||||
eflpp_etkbutton.h\
|
||||
eflpp_etkapplication.h\
|
||||
eflpp_etktoplevel.h\
|
||||
eflpp_etkwindow.h
|
||||
|
||||
EXTRA_DIST = $(libeflpp_include_DATA)
|
||||
|
|
|
@ -12,28 +12,12 @@ using namespace std;
|
|||
|
||||
namespace efl {
|
||||
|
||||
EtkApplication* EtkApplication::_instance = 0;
|
||||
|
||||
//==========================================================================//
|
||||
// EtkTopLevelWidget
|
||||
//==========================================================================//
|
||||
|
||||
EtkTopLevelWidget::EtkTopLevelWidget( EtkObject* parent, const char* type, const char* name )
|
||||
:EtkContainer( parent, type, name )
|
||||
{
|
||||
init( );
|
||||
}
|
||||
|
||||
EtkTopLevelWidget::~EtkTopLevelWidget()
|
||||
{
|
||||
}
|
||||
|
||||
//==========================================================================//
|
||||
// EtkEmbed
|
||||
//==========================================================================//
|
||||
|
||||
EtkEmbed::EtkEmbed( EvasCanvas* canvas, EtkObject* parent, const char* type, const char* name )
|
||||
:EtkTopLevelWidget( parent, type, name )
|
||||
:EtkTopLevel( parent, type, name )
|
||||
{
|
||||
init( );
|
||||
_o = ETK_OBJECT( etk_embed_new( canvas->obj()) );
|
||||
|
@ -62,38 +46,6 @@ EvasEtk::~EvasEtk()
|
|||
{
|
||||
}
|
||||
|
||||
//==========================================================================//
|
||||
// EtkWindow
|
||||
//==========================================================================//
|
||||
|
||||
EtkWindow::EtkWindow( EtkObject* parent, const char* type, const char* name )
|
||||
:EtkTopLevelWidget( parent, type, name )
|
||||
{
|
||||
}
|
||||
|
||||
EtkWindow::~EtkWindow()
|
||||
{
|
||||
}
|
||||
|
||||
void EtkWindow::setTitle( const char* title )
|
||||
{
|
||||
etk_window_title_set( ETK_WINDOW( _o ), strdup( title ) );
|
||||
}
|
||||
|
||||
//==========================================================================//
|
||||
// EtkBox
|
||||
//==========================================================================//
|
||||
|
||||
EtkBox::EtkBox( EtkObject* parent, const char* type, const char* name )
|
||||
:EtkContainer( parent, type, name )
|
||||
{
|
||||
//_o = ETK_OBJECT( etk_box_new() );
|
||||
}
|
||||
|
||||
EtkBox::~EtkBox()
|
||||
{
|
||||
}
|
||||
|
||||
//==========================================================================//
|
||||
// EtkHBox
|
||||
//==========================================================================//
|
||||
|
@ -123,156 +75,5 @@ EtkVBox::EtkVBox( EtkObject* parent, const char* type, const char* name )
|
|||
EtkVBox::~EtkVBox()
|
||||
{
|
||||
}
|
||||
|
||||
//==========================================================================//
|
||||
// EtkButton
|
||||
//==========================================================================//
|
||||
|
||||
EtkButton::EtkButton( EtkObject* parent, const char* type, const char* name )
|
||||
:EtkBox( parent, type, name )
|
||||
{
|
||||
init( );
|
||||
setLabel( name ? name : "unnamed" );
|
||||
}
|
||||
|
||||
EtkButton::EtkButton( const char* text, EtkObject* parent, const char* type, const char* name )
|
||||
:EtkBox( parent, type, name )
|
||||
{
|
||||
setLabel( text );
|
||||
}
|
||||
|
||||
EtkButton::EtkButton( Etk_Object *o )
|
||||
{
|
||||
_o = o;
|
||||
_managed = false;
|
||||
}
|
||||
|
||||
EtkButton::~EtkButton()
|
||||
{
|
||||
}
|
||||
|
||||
void EtkButton::setLabel( const string &label )
|
||||
{
|
||||
etk_button_label_set( ETK_BUTTON(_o), label.c_str () );
|
||||
}
|
||||
|
||||
const string EtkButton::getLabel( )
|
||||
{
|
||||
return etk_button_label_get (ETK_BUTTON(_o));
|
||||
}
|
||||
|
||||
void EtkButton::setImage( EtkImage *image )
|
||||
{
|
||||
etk_button_image_set( ETK_BUTTON( _o ), ETK_IMAGE( image->obj( ) ));
|
||||
}
|
||||
|
||||
EtkImage *EtkButton::getImage( )
|
||||
{
|
||||
return EtkImage::wrap ( ETK_OBJECT( etk_button_image_get( ETK_BUTTON (_o ) )));
|
||||
}
|
||||
|
||||
EtkButton *EtkButton::wrap( Etk_Object* o )
|
||||
{
|
||||
return new EtkButton( o );
|
||||
}
|
||||
|
||||
void EtkButton::setFromStock( Etk_Stock_Id stock_id )
|
||||
{
|
||||
etk_button_set_from_stock( ETK_BUTTON( _o ), stock_id );
|
||||
}
|
||||
|
||||
void EtkButton::setStyle( Etk_Button_Style style )
|
||||
{
|
||||
etk_button_style_set( ETK_BUTTON( _o ), style );
|
||||
}
|
||||
|
||||
Etk_Button_Style EtkButton::getStyle( )
|
||||
{
|
||||
return etk_button_style_get( ETK_BUTTON( _o ));
|
||||
}
|
||||
|
||||
void EtkButton::setStockSize( Etk_Stock_Size size )
|
||||
{
|
||||
etk_button_stock_size_set( ETK_BUTTON( _o ), size );
|
||||
}
|
||||
|
||||
Etk_Stock_Size EtkButton::getStockSize( )
|
||||
{
|
||||
return etk_button_stock_size_get( ETK_BUTTON( _o ) );
|
||||
}
|
||||
|
||||
void EtkButton::setAlignment( float xalign, float yalign )
|
||||
{
|
||||
etk_button_alignment_set( ETK_BUTTON( _o ), xalign, yalign );
|
||||
}
|
||||
|
||||
void EtkButton::getAlignment( float &xalign, float &yalign )
|
||||
{
|
||||
etk_button_alignment_get( ETK_BUTTON( _o ), &xalign, &yalign);
|
||||
}
|
||||
|
||||
|
||||
//===============================================================================================
|
||||
// EtkApplication
|
||||
//===============================================================================================
|
||||
|
||||
EtkApplication::EtkApplication( int argc, const char **argv, const char* name )
|
||||
:_name( name )
|
||||
{
|
||||
if ( EtkApplication::_instance )
|
||||
{
|
||||
cout << "FATAL: EtkApplication object already created" << endl;
|
||||
::exit( -1 );
|
||||
}
|
||||
cout << "EtkApplication::EtkApplication" << endl;
|
||||
if ( !etk_init( argc, const_cast<char**>(argv) ) )
|
||||
{
|
||||
cout << "FATAL: Couldn't initialize Etk" << endl;
|
||||
::exit( -1 );
|
||||
}
|
||||
EtkApplication::_instance = this;
|
||||
}
|
||||
|
||||
EtkApplication::~EtkApplication()
|
||||
{
|
||||
cout << "EtkApplication::~EtkApplication" << endl;
|
||||
etk_shutdown();
|
||||
}
|
||||
|
||||
EtkApplication* EtkApplication::application()
|
||||
{
|
||||
if ( !EtkApplication::_instance )
|
||||
{
|
||||
cerr << "FATAL: EtkApplication object hasn't been created yet" << endl;
|
||||
::exit( -1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
return EtkApplication::_instance;
|
||||
}
|
||||
}
|
||||
|
||||
void EtkApplication::setMainWindow( EtkWindow* mw )
|
||||
{
|
||||
_mainWindow = mw;
|
||||
mw->setTitle( _name );
|
||||
}
|
||||
|
||||
EtkWindow* EtkApplication::mainWindow() const
|
||||
{
|
||||
return _mainWindow;
|
||||
}
|
||||
|
||||
void EtkApplication::exec()
|
||||
{
|
||||
cout << "EtkApplication::exec() - >>> jumping into main loop" << endl;
|
||||
etk_main();
|
||||
cout << "EtkApplication::exec() - <<< returned from main loop" << endl;
|
||||
}
|
||||
|
||||
void EtkApplication::exit()
|
||||
{
|
||||
//ecore_main_loop_quit();
|
||||
}
|
||||
|
||||
}
|
||||
} // end namespace efl
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef ETK_BASE
|
||||
#define ETK_BASE
|
||||
#ifndef EFLPP_ETK_H
|
||||
#define EFLPP_ETK_H
|
||||
|
||||
/* STL */
|
||||
#include <string>
|
||||
|
@ -10,32 +10,22 @@
|
|||
#include <eflpp_countedptr.h>
|
||||
#include <eflpp_evascanvas.h>
|
||||
|
||||
#include "eflpp_etkobject.h"
|
||||
#include "eflpp_etkwidget.h"
|
||||
#include "eflpp_etkcontainer.h"
|
||||
#include "eflpp_etkimage.h"
|
||||
#include "eflpp_etkbox.h"
|
||||
#include "eflpp_etktoplevel.h"
|
||||
#include "eflpp_etkbutton.h"
|
||||
#include "eflpp_etkapplication.h"
|
||||
|
||||
/* EFL */
|
||||
#include <etk/Etk.h>
|
||||
|
||||
#define etkApp EtkApplication::application()
|
||||
|
||||
using std::string;
|
||||
|
||||
namespace efl {
|
||||
|
||||
class EtkTopLevelWidget : public EtkContainer
|
||||
{
|
||||
public:
|
||||
EtkTopLevelWidget( EtkObject* parent = 0, const char* type = "TopLevelWidget", const char* name = 0 );
|
||||
virtual ~EtkTopLevelWidget();
|
||||
};
|
||||
|
||||
class EtkBox : public EtkContainer
|
||||
{
|
||||
public:
|
||||
EtkBox( EtkObject* parent = 0, const char* type = "Box", const char* name = 0 );
|
||||
virtual ~EtkBox();
|
||||
};
|
||||
|
||||
class EtkHBox : public EtkBox
|
||||
{
|
||||
public:
|
||||
|
@ -50,116 +40,7 @@ class EtkVBox : public EtkBox
|
|||
virtual ~EtkVBox();
|
||||
};
|
||||
|
||||
/// \todo wrap C enum types to C++
|
||||
class EtkButton : public EtkBox
|
||||
{
|
||||
public:
|
||||
EtkButton( EtkObject* parent = 0, const char* type = "Button", const char* name = 0 );
|
||||
EtkButton( const char* text, EtkObject* parent = 0, const char* type = "Button", const char* name = 0 );
|
||||
virtual ~EtkButton();
|
||||
|
||||
/*
|
||||
TODO:
|
||||
Etk_Widget * etk_button_new (void)
|
||||
Creates a new button.
|
||||
Etk_Widget * etk_button_new_with_label (const char *label)
|
||||
Creates a new button with a label.
|
||||
Etk_Widget * etk_button_new_from_stock (Etk_Stock_Id stock_id)
|
||||
Creates a new button with a label and an icon defined by a stock-id.
|
||||
void etk_button_press (Etk_Button *button)
|
||||
Presses the button if it wasn't already pressed.
|
||||
void etk_button_release (Etk_Button *button)
|
||||
Releases the button if it was pressed.
|
||||
void etk_button_click (Etk_Button *button)
|
||||
Clicks on the button.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Sets the text of the button's label
|
||||
* @param label the text to set to the button's label
|
||||
*/
|
||||
void setLabel( const string &label );
|
||||
|
||||
/**
|
||||
* @brief Gets the text of the button's label
|
||||
* @return Returns the text of the button's label
|
||||
*/
|
||||
const string getLabel( );
|
||||
|
||||
/**
|
||||
* @brief Sets the image of the button
|
||||
* @param image the image to set
|
||||
* @note If the button already has an image, the current image will just be unpacked, it will not be destroyed
|
||||
* @note The image will be automatically shown, but you can still manually hide it with calling etk_widget_hide()
|
||||
* after having called etk_button_image_set()
|
||||
* @todo Change usage to CountedPtr!
|
||||
*/
|
||||
void setImage( EtkImage *image );
|
||||
|
||||
/**
|
||||
* @brief Gets the image of the button
|
||||
* @return Returns the image of the button, or NULL if the button has no image
|
||||
* @todo Change usage to CountedPtr!
|
||||
*/
|
||||
EtkImage *getImage( );
|
||||
|
||||
/**
|
||||
* @brief Sets the label and the image of the button from a stock-id
|
||||
* @param stock_id the stock-id to use
|
||||
* @note For some stock-id, the label is empty
|
||||
*/
|
||||
void setFromStock( Etk_Stock_Id stock_id );
|
||||
|
||||
/**
|
||||
* @brief Sets the style of the button (icon, text, both vertically, both horizontally)
|
||||
* @param style the style to give to the button
|
||||
*/
|
||||
void setStyle( Etk_Button_Style style );
|
||||
|
||||
/**
|
||||
* @brief Gets the style of the button
|
||||
* @return Returns the button's style
|
||||
*/
|
||||
Etk_Button_Style getStyle( );
|
||||
|
||||
/**
|
||||
* @brief Sets the stock-size of the button's image
|
||||
* @param size the stock-size
|
||||
*/
|
||||
void setStockSize( Etk_Stock_Size size );
|
||||
|
||||
/**
|
||||
* @brief Gets the stock-size of the button's image
|
||||
* @return Returns the stock-size of the button's image
|
||||
*/
|
||||
Etk_Stock_Size getStockSize( );
|
||||
|
||||
/**
|
||||
* @brief Sets the alignment of the child of the button
|
||||
* @param xalign the horizontal alignment (0.0 = left, 0.5 = center, 1.0 = right, ...)
|
||||
* @param yalign the vertical alignment (0.0 = top, 0.5 = center, 1.0 = bottom, ...)
|
||||
* @note It only has effect if the child is a label or an alignment
|
||||
*/
|
||||
void setAlignment( float xalign, float yalign );
|
||||
|
||||
/**
|
||||
* @brief Gets the alignment of the button's child
|
||||
* @param xalign the location where to store the horizontal alignment
|
||||
* @param yalign the location where to store the vertical alignment
|
||||
*/
|
||||
void getAlignment( float &xalign, float &yalign );
|
||||
|
||||
/**
|
||||
* @brief C object wrapper factory method
|
||||
* Only for internal usage!
|
||||
*/
|
||||
static EtkButton *wrap( Etk_Object* o );
|
||||
|
||||
private:
|
||||
EtkButton( Etk_Object *o );
|
||||
};
|
||||
|
||||
class EtkEmbed : public EtkTopLevelWidget
|
||||
class EtkEmbed : public EtkTopLevel
|
||||
{
|
||||
public:
|
||||
EtkEmbed( EvasCanvas*, EtkObject* parent = 0, const char* type = "Embed", const char* name = 0 );
|
||||
|
@ -175,38 +56,6 @@ class EvasEtk : public EvasObject
|
|||
~EvasEtk();
|
||||
};
|
||||
|
||||
class EtkWindow : public EtkTopLevelWidget
|
||||
{
|
||||
public:
|
||||
EtkWindow( EtkObject* parent = 0, const char* type = "Window", const char* name = 0 );
|
||||
virtual ~EtkWindow();
|
||||
|
||||
void setTitle( const char* title );
|
||||
};
|
||||
|
||||
class EtkApplication
|
||||
{
|
||||
public:
|
||||
EtkApplication( int argc, const char** argv, const char* name );
|
||||
~EtkApplication();
|
||||
|
||||
static EtkApplication* application();
|
||||
const char* name() const { return _name; };
|
||||
|
||||
/* Main Window */
|
||||
void setMainWindow( EtkWindow* );
|
||||
EtkWindow* mainWindow() const;
|
||||
|
||||
/* Main Loop */
|
||||
void exec();
|
||||
void exit();
|
||||
|
||||
private:
|
||||
const char* _name;
|
||||
static EtkApplication* _instance;
|
||||
EtkWindow* _mainWindow;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // EFLPP_ETK_H
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "eflpp_etkapplication.h"
|
||||
|
||||
/* EFL */
|
||||
#include <etk/Etk.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace efl {
|
||||
|
||||
EtkApplication* EtkApplication::_instance = 0;
|
||||
|
||||
EtkApplication::EtkApplication( int argc, const char **argv, const char* name )
|
||||
:_name( name )
|
||||
{
|
||||
// TOOD: use Exceptions
|
||||
if ( EtkApplication::_instance )
|
||||
{
|
||||
cout << "FATAL: EtkApplication object already created" << endl;
|
||||
::exit( -1 );
|
||||
}
|
||||
cout << "EtkApplication::EtkApplication" << endl;
|
||||
if ( !etk_init( argc, const_cast<char**>(argv) ) )
|
||||
{
|
||||
cout << "FATAL: Couldn't initialize Etk" << endl;
|
||||
::exit( -1 );
|
||||
}
|
||||
EtkApplication::_instance = this;
|
||||
}
|
||||
|
||||
EtkApplication::~EtkApplication()
|
||||
{
|
||||
cout << "EtkApplication::~EtkApplication" << endl;
|
||||
etk_shutdown();
|
||||
}
|
||||
|
||||
EtkApplication* EtkApplication::application()
|
||||
{
|
||||
if ( !EtkApplication::_instance )
|
||||
{
|
||||
cerr << "FATAL: EtkApplication object hasn't been created yet" << endl;
|
||||
::exit( -1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
return EtkApplication::_instance;
|
||||
}
|
||||
}
|
||||
|
||||
void EtkApplication::setMainWindow( EtkWindow* mw )
|
||||
{
|
||||
_mainWindow = mw;
|
||||
mw->setTitle( _name );
|
||||
}
|
||||
|
||||
EtkWindow* EtkApplication::mainWindow() const
|
||||
{
|
||||
return _mainWindow;
|
||||
}
|
||||
|
||||
void EtkApplication::exec()
|
||||
{
|
||||
cout << "EtkApplication::exec() - >>> jumping into main loop" << endl;
|
||||
etk_main();
|
||||
cout << "EtkApplication::exec() - <<< returned from main loop" << endl;
|
||||
}
|
||||
|
||||
void EtkApplication::exit()
|
||||
{
|
||||
//ecore_main_loop_quit();
|
||||
}
|
||||
|
||||
} // end namespace efl
|
|
@ -0,0 +1,46 @@
|
|||
#ifndef EFLPP_ETKAPPLICATION_H
|
||||
#define EFLPP_ETKAPPLICATION_H
|
||||
|
||||
/* STL */
|
||||
#include <string>
|
||||
|
||||
/* EFL++ */
|
||||
#include <eflpp_common.h>
|
||||
#include <eflpp_evas.h>
|
||||
#include <eflpp_countedptr.h>
|
||||
#include "eflpp_etkwindow.h"
|
||||
|
||||
#define etkApp EtkApplication::application()
|
||||
|
||||
using std::string;
|
||||
|
||||
namespace efl {
|
||||
|
||||
class EtkApplication
|
||||
{
|
||||
public:
|
||||
EtkApplication( int argc, const char** argv, const char* name );
|
||||
~EtkApplication();
|
||||
|
||||
static EtkApplication* application();
|
||||
const char* name() const { return _name; };
|
||||
|
||||
/* Main Window */
|
||||
void setMainWindow( EtkWindow* );
|
||||
EtkWindow* mainWindow() const;
|
||||
|
||||
/* Main Loop */
|
||||
void exec();
|
||||
void exit();
|
||||
|
||||
private:
|
||||
const char* _name;
|
||||
static EtkApplication* _instance;
|
||||
EtkWindow* _mainWindow;
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // end namespace efl
|
||||
|
||||
#endif // EFLPP_ETKAPPLICATION_H
|
|
@ -0,0 +1,22 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "eflpp_etkbox.h"
|
||||
|
||||
/* EFL */
|
||||
#include <etk/etk_widget.h>
|
||||
|
||||
namespace efl {
|
||||
|
||||
EtkBox::EtkBox( EtkObject* parent, const char* type, const char* name )
|
||||
:EtkContainer( parent, type, name )
|
||||
{
|
||||
//_o = ETK_OBJECT( etk_box_new() );
|
||||
}
|
||||
|
||||
EtkBox::~EtkBox()
|
||||
{
|
||||
}
|
||||
|
||||
} // end namespace efl
|
|
@ -0,0 +1,28 @@
|
|||
#ifndef EFLPP_ETKBOX_H
|
||||
#define EFLPP_ETKBOX_H
|
||||
|
||||
/* STL */
|
||||
#include <string>
|
||||
|
||||
/* EFL++ */
|
||||
#include <eflpp_common.h>
|
||||
#include <eflpp_evas.h>
|
||||
#include <eflpp_countedptr.h>
|
||||
|
||||
#include "eflpp_etkcontainer.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
namespace efl {
|
||||
|
||||
class EtkBox : public EtkContainer
|
||||
{
|
||||
public:
|
||||
EtkBox( EtkObject* parent = 0, const char* type = "Box", const char* name = 0 );
|
||||
virtual ~EtkBox();
|
||||
};
|
||||
|
||||
|
||||
} // end namespace efl
|
||||
|
||||
#endif // EFLPP_ETKBOX_H
|
|
@ -0,0 +1,95 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "eflpp_etkbutton.h"
|
||||
|
||||
/* EFL */
|
||||
#include <etk/etk_button.h>
|
||||
|
||||
namespace efl {
|
||||
|
||||
EtkButton::EtkButton( EtkObject* parent, const char* type, const char* name )
|
||||
:EtkBox( parent, type, name )
|
||||
{
|
||||
init( );
|
||||
setLabel( name ? name : "unnamed" );
|
||||
}
|
||||
|
||||
EtkButton::EtkButton( const char* text, EtkObject* parent, const char* type, const char* name )
|
||||
:EtkBox( parent, type, name )
|
||||
{
|
||||
setLabel( text );
|
||||
}
|
||||
|
||||
EtkButton::EtkButton( Etk_Object *o )
|
||||
{
|
||||
_o = o;
|
||||
_managed = false;
|
||||
}
|
||||
|
||||
EtkButton::~EtkButton()
|
||||
{
|
||||
}
|
||||
|
||||
void EtkButton::setLabel( const string &label )
|
||||
{
|
||||
etk_button_label_set( ETK_BUTTON(_o), label.c_str () );
|
||||
}
|
||||
|
||||
const string EtkButton::getLabel( )
|
||||
{
|
||||
return etk_button_label_get (ETK_BUTTON(_o));
|
||||
}
|
||||
|
||||
void EtkButton::setImage( EtkImage *image )
|
||||
{
|
||||
etk_button_image_set( ETK_BUTTON( _o ), ETK_IMAGE( image->obj( ) ));
|
||||
}
|
||||
|
||||
EtkImage *EtkButton::getImage( )
|
||||
{
|
||||
return EtkImage::wrap ( ETK_OBJECT( etk_button_image_get( ETK_BUTTON (_o ) )));
|
||||
}
|
||||
|
||||
EtkButton *EtkButton::wrap( Etk_Object* o )
|
||||
{
|
||||
return new EtkButton( o );
|
||||
}
|
||||
|
||||
void EtkButton::setFromStock( Etk_Stock_Id stock_id )
|
||||
{
|
||||
etk_button_set_from_stock( ETK_BUTTON( _o ), stock_id );
|
||||
}
|
||||
|
||||
void EtkButton::setStyle( Etk_Button_Style style )
|
||||
{
|
||||
etk_button_style_set( ETK_BUTTON( _o ), style );
|
||||
}
|
||||
|
||||
Etk_Button_Style EtkButton::getStyle( )
|
||||
{
|
||||
return etk_button_style_get( ETK_BUTTON( _o ));
|
||||
}
|
||||
|
||||
void EtkButton::setStockSize( Etk_Stock_Size size )
|
||||
{
|
||||
etk_button_stock_size_set( ETK_BUTTON( _o ), size );
|
||||
}
|
||||
|
||||
Etk_Stock_Size EtkButton::getStockSize( )
|
||||
{
|
||||
return etk_button_stock_size_get( ETK_BUTTON( _o ) );
|
||||
}
|
||||
|
||||
void EtkButton::setAlignment( float xalign, float yalign )
|
||||
{
|
||||
etk_button_alignment_set( ETK_BUTTON( _o ), xalign, yalign );
|
||||
}
|
||||
|
||||
void EtkButton::getAlignment( float &xalign, float &yalign )
|
||||
{
|
||||
etk_button_alignment_get( ETK_BUTTON( _o ), &xalign, &yalign);
|
||||
}
|
||||
|
||||
} // end namespace efl
|
|
@ -0,0 +1,133 @@
|
|||
#ifndef EFLPP_ETKBUTTON_H
|
||||
#define EFLPP_ETKBUTTON_H
|
||||
|
||||
/* STL */
|
||||
#include <string>
|
||||
|
||||
/* EFL++ */
|
||||
#include <eflpp_common.h>
|
||||
#include <eflpp_evas.h>
|
||||
#include <eflpp_countedptr.h>
|
||||
|
||||
#include "eflpp_etkbox.h"
|
||||
#include "eflpp_etkimage.h"
|
||||
|
||||
#include <etk/etk_button.h> // TODO: Wrap C enum types to not use C header (e.g. for Etk_Stock_Id)!
|
||||
|
||||
using std::string;
|
||||
|
||||
namespace efl {
|
||||
|
||||
class EtkButton : public EtkBox
|
||||
{
|
||||
public:
|
||||
EtkButton( EtkObject* parent = 0, const char* type = "Button", const char* name = 0 );
|
||||
EtkButton( const char* text, EtkObject* parent = 0, const char* type = "Button", const char* name = 0 );
|
||||
virtual ~EtkButton();
|
||||
|
||||
/*
|
||||
TODO:
|
||||
Etk_Widget * etk_button_new (void)
|
||||
Creates a new button.
|
||||
Etk_Widget * etk_button_new_with_label (const char *label)
|
||||
Creates a new button with a label.
|
||||
Etk_Widget * etk_button_new_from_stock (Etk_Stock_Id stock_id)
|
||||
Creates a new button with a label and an icon defined by a stock-id.
|
||||
void etk_button_press (Etk_Button *button)
|
||||
Presses the button if it wasn't already pressed.
|
||||
void etk_button_release (Etk_Button *button)
|
||||
Releases the button if it was pressed.
|
||||
void etk_button_click (Etk_Button *button)
|
||||
Clicks on the button.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Sets the text of the button's label
|
||||
* @param label the text to set to the button's label
|
||||
*/
|
||||
void setLabel( const string &label );
|
||||
|
||||
/**
|
||||
* @brief Gets the text of the button's label
|
||||
* @return Returns the text of the button's label
|
||||
*/
|
||||
const string getLabel( );
|
||||
|
||||
/**
|
||||
* @brief Sets the image of the button
|
||||
* @param image the image to set
|
||||
* @note If the button already has an image, the current image will just be unpacked, it will not be destroyed
|
||||
* @note The image will be automatically shown, but you can still manually hide it with calling etk_widget_hide()
|
||||
* after having called etk_button_image_set()
|
||||
* @todo Change usage to CountedPtr!
|
||||
*/
|
||||
void setImage( EtkImage *image );
|
||||
|
||||
/**
|
||||
* @brief Gets the image of the button
|
||||
* @return Returns the image of the button, or NULL if the button has no image
|
||||
* @todo Change usage to CountedPtr!
|
||||
*/
|
||||
EtkImage *getImage( );
|
||||
|
||||
/**
|
||||
* @brief Sets the label and the image of the button from a stock-id
|
||||
* @param stock_id the stock-id to use
|
||||
* @note For some stock-id, the label is empty
|
||||
*/
|
||||
void setFromStock( Etk_Stock_Id stock_id );
|
||||
|
||||
/**
|
||||
* @brief Sets the style of the button (icon, text, both vertically, both horizontally)
|
||||
* @param style the style to give to the button
|
||||
*/
|
||||
void setStyle( Etk_Button_Style style );
|
||||
|
||||
/**
|
||||
* @brief Gets the style of the button
|
||||
* @return Returns the button's style
|
||||
*/
|
||||
Etk_Button_Style getStyle( );
|
||||
|
||||
/**
|
||||
* @brief Sets the stock-size of the button's image
|
||||
* @param size the stock-size
|
||||
*/
|
||||
void setStockSize( Etk_Stock_Size size );
|
||||
|
||||
/**
|
||||
* @brief Gets the stock-size of the button's image
|
||||
* @return Returns the stock-size of the button's image
|
||||
*/
|
||||
Etk_Stock_Size getStockSize( );
|
||||
|
||||
/**
|
||||
* @brief Sets the alignment of the child of the button
|
||||
* @param xalign the horizontal alignment (0.0 = left, 0.5 = center, 1.0 = right, ...)
|
||||
* @param yalign the vertical alignment (0.0 = top, 0.5 = center, 1.0 = bottom, ...)
|
||||
* @note It only has effect if the child is a label or an alignment
|
||||
*/
|
||||
void setAlignment( float xalign, float yalign );
|
||||
|
||||
/**
|
||||
* @brief Gets the alignment of the button's child
|
||||
* @param xalign the location where to store the horizontal alignment
|
||||
* @param yalign the location where to store the vertical alignment
|
||||
*/
|
||||
void getAlignment( float &xalign, float &yalign );
|
||||
|
||||
/**
|
||||
* @brief C object wrapper factory method
|
||||
* Only for internal usage!
|
||||
*/
|
||||
static EtkButton *wrap( Etk_Object* o );
|
||||
|
||||
private:
|
||||
EtkButton( Etk_Object *o );
|
||||
};
|
||||
|
||||
|
||||
|
||||
} // end namespace efl
|
||||
|
||||
#endif // EFLPP_ETKBUTTON_H
|
|
@ -0,0 +1,19 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "eflpp_etktoplevel.h"
|
||||
|
||||
namespace efl {
|
||||
|
||||
EtkTopLevel::EtkTopLevel( EtkObject* parent, const char* type, const char* name )
|
||||
:EtkContainer( parent, type, name )
|
||||
{
|
||||
init( );
|
||||
}
|
||||
|
||||
EtkTopLevel::~EtkTopLevel()
|
||||
{
|
||||
}
|
||||
|
||||
} // end namespace efl
|
|
@ -0,0 +1,26 @@
|
|||
#ifndef EFLPP_ETKTOPLEVEL_H
|
||||
#define EFLPP_ETKTOPLEVEL_H
|
||||
|
||||
/* STL */
|
||||
#include <string>
|
||||
|
||||
/* EFL++ */
|
||||
#include <eflpp_common.h>
|
||||
#include <eflpp_evas.h>
|
||||
#include <eflpp_countedptr.h>
|
||||
#include "eflpp_etkcontainer.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
namespace efl {
|
||||
|
||||
class EtkTopLevel : public EtkContainer
|
||||
{
|
||||
public:
|
||||
EtkTopLevel( EtkObject* parent = 0, const char* type = "TopLevelWidget", const char* name = 0 );
|
||||
virtual ~EtkTopLevel();
|
||||
};
|
||||
|
||||
} // end namespace efl
|
||||
|
||||
#endif // EFLPP_ETKTOPLEVEL_H
|
|
@ -0,0 +1,26 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "eflpp_etkwindow.h"
|
||||
|
||||
/* EFL */
|
||||
#include <etk/Etk.h>
|
||||
|
||||
namespace efl {
|
||||
|
||||
EtkWindow::EtkWindow( EtkObject* parent, const char* type, const char* name )
|
||||
:EtkTopLevel( parent, type, name )
|
||||
{
|
||||
}
|
||||
|
||||
EtkWindow::~EtkWindow()
|
||||
{
|
||||
}
|
||||
|
||||
void EtkWindow::setTitle( const char* title )
|
||||
{
|
||||
etk_window_title_set( ETK_WINDOW( _o ), strdup( title ) );
|
||||
}
|
||||
|
||||
} // end namespace efl
|
|
@ -0,0 +1,28 @@
|
|||
#ifndef EFLPP_ETKWINDOW_H
|
||||
#define EFLPP_ETKWINDOW_H
|
||||
|
||||
/* STL */
|
||||
#include <string>
|
||||
|
||||
/* EFL++ */
|
||||
#include <eflpp_common.h>
|
||||
#include <eflpp_evas.h>
|
||||
#include <eflpp_countedptr.h>
|
||||
#include "eflpp_etktoplevel.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
namespace efl {
|
||||
|
||||
class EtkWindow : public EtkTopLevel
|
||||
{
|
||||
public:
|
||||
EtkWindow( EtkObject* parent = 0, const char* type = "Window", const char* name = 0 );
|
||||
virtual ~EtkWindow();
|
||||
|
||||
void setTitle( const char* title );
|
||||
};
|
||||
|
||||
} // end namespace efl
|
||||
|
||||
#endif // EFLPP_ETKWINDOW_H
|
|
@ -13,7 +13,8 @@ libeflpp_evas_la_SOURCES = \
|
|||
eflpp_evastextblockstyle.cpp\
|
||||
eflpp_evasobject.cpp\
|
||||
eflpp_evascanvas.cpp\
|
||||
eflpp_evasimage.cpp
|
||||
eflpp_evasimage.cpp\
|
||||
eflpp_evastext.cpp
|
||||
|
||||
libeflpp_includedir = $(pkgincludedir)
|
||||
|
||||
|
@ -25,6 +26,7 @@ libeflpp_include_DATA = \
|
|||
eflpp_evasutils.h\
|
||||
eflpp_evasobject.h\
|
||||
eflpp_evascanvas.h\
|
||||
eflpp_evasimage.h
|
||||
eflpp_evasimage.h\
|
||||
eflpp_evastext.h
|
||||
|
||||
EXTRA_DIST = $(libeflpp_include_DATA)
|
||||
|
|
|
@ -117,146 +117,6 @@ void EvasPolygon::clearPoints()
|
|||
evas_object_polygon_points_clear( o );
|
||||
}
|
||||
|
||||
|
||||
//===============================================================================================
|
||||
// Text
|
||||
//===============================================================================================
|
||||
|
||||
EvasText::EvasText( EvasCanvas* canvas, const char* name )
|
||||
{
|
||||
o = evas_object_text_add( canvas->obj() );
|
||||
init( name ? name : "text" );
|
||||
|
||||
setFont( EvasFont() );
|
||||
}
|
||||
|
||||
EvasText::EvasText( int x, int y, const char* text, EvasCanvas* canvas, const char* name )
|
||||
{
|
||||
o = evas_object_text_add( canvas->obj() );
|
||||
init( name ? name : "text" );;
|
||||
|
||||
move( x, y );
|
||||
setFont( EvasFont() );
|
||||
setText( text );
|
||||
}
|
||||
|
||||
EvasText::EvasText( const char* font, int size, const char* text, EvasCanvas* canvas, const char* name )
|
||||
{
|
||||
o = evas_object_text_add( canvas->obj() );
|
||||
init( name ? name : "text" );
|
||||
|
||||
setFont( font, size );
|
||||
setText( text );
|
||||
}
|
||||
|
||||
EvasText::EvasText( const char* font, int size, int x, int y, const char* text, EvasCanvas* canvas, const char* name )
|
||||
{
|
||||
o = evas_object_text_add( canvas->obj() );
|
||||
init( name ? name : "text" );
|
||||
|
||||
move( x, y );
|
||||
setFont( font, size );
|
||||
setText( text );
|
||||
}
|
||||
|
||||
EvasText::EvasText( EvasText* ao, EvasCanvas* canvas )
|
||||
{
|
||||
Dout( dc::notice, *this << " EvasText::EvasText copy constructor" );
|
||||
o = evas_object_text_add( canvas->obj() );
|
||||
init( "text" );
|
||||
|
||||
setGeometry( ao->geometry() );
|
||||
setLayer( ao->layer() );
|
||||
setText( ao->text() );
|
||||
setClip( ao->clip() );
|
||||
setFont( ao->font() );
|
||||
setColor( ao->color() );
|
||||
setVisible( ao->isVisible() );
|
||||
}
|
||||
|
||||
const Size EvasText::size() const
|
||||
{
|
||||
int width = horizontalAdvance();
|
||||
int height = verticalAdvance();
|
||||
Dout( dc::notice, *this << " EvasText::size() - width = " << width << ", height = " << height );
|
||||
|
||||
return Size( width, height );
|
||||
}
|
||||
|
||||
void EvasText::setFontSource( const char* source )
|
||||
{
|
||||
evas_object_text_font_source_set( o, source );
|
||||
}
|
||||
|
||||
EvasFont EvasText::font() const
|
||||
{
|
||||
const char* name;
|
||||
Evas_Font_Size size;
|
||||
evas_object_text_font_get( o, &name, &size );
|
||||
return EvasFont( name, size );
|
||||
}
|
||||
|
||||
void EvasText::setFont( const char* font, Evas_Font_Size size )
|
||||
{
|
||||
evas_object_text_font_set( o, font, size );
|
||||
}
|
||||
|
||||
void EvasText::setFont( const EvasFont& f )
|
||||
{
|
||||
setFont( f.name(), f.size() );
|
||||
}
|
||||
|
||||
void EvasText::setText( const char* text )
|
||||
{
|
||||
evas_object_text_text_set( o, text );
|
||||
}
|
||||
|
||||
const char* EvasText::text() const
|
||||
{
|
||||
return evas_object_text_text_get( o );
|
||||
}
|
||||
|
||||
int EvasText::ascent() const
|
||||
{
|
||||
return evas_object_text_ascent_get( o );
|
||||
}
|
||||
|
||||
int EvasText::descent() const
|
||||
{
|
||||
return evas_object_text_descent_get( o );
|
||||
}
|
||||
|
||||
int EvasText::maxAscent() const
|
||||
{
|
||||
return evas_object_text_max_ascent_get( o );
|
||||
}
|
||||
|
||||
int EvasText::maxDescent() const
|
||||
{
|
||||
return evas_object_text_max_descent_get( o );
|
||||
}
|
||||
|
||||
int EvasText::horizontalAdvance() const
|
||||
{
|
||||
return evas_object_text_horiz_advance_get( o );
|
||||
}
|
||||
|
||||
int EvasText::verticalAdvance() const
|
||||
{
|
||||
return evas_object_text_vert_advance_get( o );
|
||||
}
|
||||
|
||||
int EvasText::inset() const
|
||||
{
|
||||
return evas_object_text_inset_get( o );
|
||||
}
|
||||
|
||||
|
||||
EvasText::~EvasText()
|
||||
{
|
||||
evas_object_del( o );
|
||||
}
|
||||
|
||||
//===============================================================================================
|
||||
// Textblock
|
||||
//===============================================================================================
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "eflpp_evasobject.h"
|
||||
#include "eflpp_evascanvas.h"
|
||||
#include "eflpp_evasimage.h"
|
||||
#include "eflpp_evastext.h"
|
||||
|
||||
/* EFL++ */
|
||||
#include <eflpp_common.h>
|
||||
|
@ -82,45 +83,6 @@ class EvasPolygon : public EvasObject
|
|||
void clearPoints();
|
||||
};
|
||||
|
||||
/*
|
||||
* Wraps an Evas Text Object
|
||||
*/
|
||||
class EvasText : public EvasObject
|
||||
{
|
||||
public:
|
||||
EvasText( EvasText* ao, EvasCanvas* canvas );
|
||||
EvasText( EvasCanvas* canvas, const char* name = 0 );
|
||||
EvasText( int x, int y, const char* text, EvasCanvas* canvas, const char* name = 0 );
|
||||
EvasText( const char* font, int size, const char* text, EvasCanvas* canvas, const char* name = 0 );
|
||||
EvasText( const char* font, int size, int x, int y, const char* text, EvasCanvas* canvas, const char* name = 0 );
|
||||
virtual ~EvasText();
|
||||
|
||||
virtual const Size size() const;
|
||||
|
||||
void setFontSource( const char* source );
|
||||
EvasFont font() const;
|
||||
void setFont( const char* font, Evas_Font_Size size );
|
||||
void setFont( const EvasFont& font );
|
||||
const char* text() const;
|
||||
void setText( const char* );
|
||||
|
||||
int ascent() const;
|
||||
int descent() const;
|
||||
int maxAscent() const;
|
||||
int maxDescent() const;
|
||||
int horizontalAdvance() const;
|
||||
int verticalAdvance() const;
|
||||
int inset() const;
|
||||
|
||||
/*
|
||||
//int characterPosition() const;
|
||||
//int characterCoordinates() const;
|
||||
EAPI int evas_object_text_char_pos_get (Evas_Object *obj, int pos, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch);
|
||||
EAPI int evas_object_text_char_coords_get (Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch);
|
||||
*/
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
* Wraps an Evas Textblock Object
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,146 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "eflpp_evastext.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace efl {
|
||||
|
||||
EvasText::EvasText( EvasCanvas* canvas, const char* name )
|
||||
{
|
||||
o = evas_object_text_add( canvas->obj() );
|
||||
init( name ? name : "text" );
|
||||
|
||||
setFont( EvasFont() );
|
||||
}
|
||||
|
||||
EvasText::EvasText( int x, int y, const char* text, EvasCanvas* canvas, const char* name )
|
||||
{
|
||||
o = evas_object_text_add( canvas->obj() );
|
||||
init( name ? name : "text" );;
|
||||
|
||||
move( x, y );
|
||||
setFont( EvasFont() );
|
||||
setText( text );
|
||||
}
|
||||
|
||||
EvasText::EvasText( const char* font, int size, const char* text, EvasCanvas* canvas, const char* name )
|
||||
{
|
||||
o = evas_object_text_add( canvas->obj() );
|
||||
init( name ? name : "text" );
|
||||
|
||||
setFont( font, size );
|
||||
setText( text );
|
||||
}
|
||||
|
||||
EvasText::EvasText( const char* font, int size, int x, int y, const char* text, EvasCanvas* canvas, const char* name )
|
||||
{
|
||||
o = evas_object_text_add( canvas->obj() );
|
||||
init( name ? name : "text" );
|
||||
|
||||
move( x, y );
|
||||
setFont( font, size );
|
||||
setText( text );
|
||||
}
|
||||
|
||||
EvasText::EvasText( EvasText* ao, EvasCanvas* canvas )
|
||||
{
|
||||
Dout( dc::notice, *this << " EvasText::EvasText copy constructor" );
|
||||
o = evas_object_text_add( canvas->obj() );
|
||||
init( "text" );
|
||||
|
||||
setGeometry( ao->geometry() );
|
||||
setLayer( ao->layer() );
|
||||
setText( ao->text() );
|
||||
setClip( ao->clip() );
|
||||
setFont( ao->font() );
|
||||
setColor( ao->color() );
|
||||
setVisible( ao->isVisible() );
|
||||
}
|
||||
|
||||
const Size EvasText::size() const
|
||||
{
|
||||
int width = horizontalAdvance();
|
||||
int height = verticalAdvance();
|
||||
Dout( dc::notice, *this << " EvasText::size() - width = " << width << ", height = " << height );
|
||||
|
||||
return Size( width, height );
|
||||
}
|
||||
|
||||
void EvasText::setFontSource( const char* source )
|
||||
{
|
||||
evas_object_text_font_source_set( o, source );
|
||||
}
|
||||
|
||||
EvasFont EvasText::font() const
|
||||
{
|
||||
const char* name;
|
||||
Evas_Font_Size size;
|
||||
evas_object_text_font_get( o, &name, &size );
|
||||
return EvasFont( name, size );
|
||||
}
|
||||
|
||||
void EvasText::setFont( const char* font, Evas_Font_Size size )
|
||||
{
|
||||
evas_object_text_font_set( o, font, size );
|
||||
}
|
||||
|
||||
void EvasText::setFont( const EvasFont& f )
|
||||
{
|
||||
setFont( f.name(), f.size() );
|
||||
}
|
||||
|
||||
void EvasText::setText( const char* text )
|
||||
{
|
||||
evas_object_text_text_set( o, text );
|
||||
}
|
||||
|
||||
const char* EvasText::text() const
|
||||
{
|
||||
return evas_object_text_text_get( o );
|
||||
}
|
||||
|
||||
int EvasText::ascent() const
|
||||
{
|
||||
return evas_object_text_ascent_get( o );
|
||||
}
|
||||
|
||||
int EvasText::descent() const
|
||||
{
|
||||
return evas_object_text_descent_get( o );
|
||||
}
|
||||
|
||||
int EvasText::maxAscent() const
|
||||
{
|
||||
return evas_object_text_max_ascent_get( o );
|
||||
}
|
||||
|
||||
int EvasText::maxDescent() const
|
||||
{
|
||||
return evas_object_text_max_descent_get( o );
|
||||
}
|
||||
|
||||
int EvasText::horizontalAdvance() const
|
||||
{
|
||||
return evas_object_text_horiz_advance_get( o );
|
||||
}
|
||||
|
||||
int EvasText::verticalAdvance() const
|
||||
{
|
||||
return evas_object_text_vert_advance_get( o );
|
||||
}
|
||||
|
||||
int EvasText::inset() const
|
||||
{
|
||||
return evas_object_text_inset_get( o );
|
||||
}
|
||||
|
||||
|
||||
EvasText::~EvasText()
|
||||
{
|
||||
evas_object_del( o );
|
||||
}
|
||||
|
||||
} // end namespace efl
|
|
@ -0,0 +1,63 @@
|
|||
#ifndef EFLPP_EVASTEXT_H
|
||||
#define EFLPP_EVASTEXT_H
|
||||
|
||||
/* STL */
|
||||
#include <string>
|
||||
|
||||
/* EFL++ */
|
||||
#include <eflpp_common.h>
|
||||
#include <eflpp_countedptr.h>
|
||||
#include "eflpp_evasobject.h"
|
||||
#include "eflpp_evascanvas.h"
|
||||
#include "eflpp_evasfont.h"
|
||||
|
||||
/* EFL */
|
||||
#include <Evas.h>
|
||||
|
||||
using std::string;
|
||||
|
||||
namespace efl {
|
||||
|
||||
/**
|
||||
* Wraps an Evas Text Object
|
||||
*/
|
||||
class EvasText : public EvasObject
|
||||
{
|
||||
public:
|
||||
EvasText( EvasText* ao, EvasCanvas* canvas );
|
||||
EvasText( EvasCanvas* canvas, const char* name = 0 );
|
||||
EvasText( int x, int y, const char* text, EvasCanvas* canvas, const char* name = 0 );
|
||||
EvasText( const char* font, int size, const char* text, EvasCanvas* canvas, const char* name = 0 );
|
||||
EvasText( const char* font, int size, int x, int y, const char* text, EvasCanvas* canvas, const char* name = 0 );
|
||||
virtual ~EvasText();
|
||||
|
||||
virtual const Size size() const;
|
||||
|
||||
void setFontSource( const char* source );
|
||||
EvasFont font() const;
|
||||
void setFont( const char* font, Evas_Font_Size size );
|
||||
void setFont( const EvasFont& font );
|
||||
const char* text() const;
|
||||
void setText( const char* );
|
||||
|
||||
int ascent() const;
|
||||
int descent() const;
|
||||
int maxAscent() const;
|
||||
int maxDescent() const;
|
||||
int horizontalAdvance() const;
|
||||
int verticalAdvance() const;
|
||||
int inset() const;
|
||||
|
||||
/*
|
||||
//int characterPosition() const;
|
||||
//int characterCoordinates() const;
|
||||
EAPI int evas_object_text_char_pos_get (Evas_Object *obj, int pos, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch);
|
||||
EAPI int evas_object_text_char_coords_get (Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch);
|
||||
*/
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // end namespace efl
|
||||
|
||||
#endif // EFLPP_EVASTEXT_H
|
Loading…
Reference in New Issue