Thanks!
I defined the AutoResize function outside the class, and it's working.
Thanks for both of you. I attached the new header file, in case if
you're interested.
On Thu, 25 May 2006 08:06:34 +0900
Carsten Haitzler (The Rasterman) <[EMAIL PROTECTED]> wrote:
> On Wed, 24 May 2006 23:44:52 +0200 Sevcsik Andr=C3=A1s
> <[EMAIL PROTECTED] .hu>
> babbled:
> Mime-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: binary
>
> On Wed, 24 May 2006 23:44:52 +0200 Sevcsik AndrĂĄs
> <[EMAIL PROTECTED]> babbled:
>
> > Hi!
> >
> > I'm trying to make an EdjeWindow class in c++. The problem is, that
> > I can't bind with ecore_evas_callback_resize(). The compiler says:
> >
> > contactlist.h: In constructor âEdjeWindow::EdjeWindow(char*,
> > char*)â: contactlist.h:67: error: argument of type âvoid
> > (EdjeWindow::)(Ecore_Evas*)â does not match âvoid
> > (*)(Ecore_Evas*)â
> >
> > Here is the method I want to bind to callback_resize:
> >
> > void EdjeWindow::AutoResize() {
> > ecore_evas_geometry_get(ee, NULL, NULL, &edje_w, &edje_h);
> > evas_object_resize(edje, edje_w, edje_h);
> > }
> >
> > I tried to add an "Ecore_Evas * ee" parameter to the method, but it
> > doesn't work. Anyway, I don't need a parameter, since "ee" and
> > "edje" are defined as class members:
>
> well - actually you do need ee. ecore_evas calls the callback on a
> window resize and passes in the ecore_evas (ee) that got resized. you
> can then query/get all object specific data from the ee (you can
> attach data with string keys ect.). something you attach is goign to
> HAVE to be a pointer to your c++ object so from the c callback you
> can now start doing c++. (ie maybe call another function like
> cc_obj->resize_handle(); for example) THEN inside this resize_handle
> method you will be happily in raw c++ land with "this" being your
> object etc.
>
> > private:
> > Ecore_Evas *ee;
> > Evas *evas;
> > Evas_Object *edje;
> >
> > SetTitle() method works fine this way... I see that
> > ecore_evas_callback_resize needs a function with an Evas_Ecore type
> > parameter, but it doesn't work even with it.
> >
> > Please keep in mind that I'm VERY BEGINNER IN C++, so be gentle
> > please :) I know EFL wasn't designed for c++, but I really prefer
> > c++ than c.
> >
> > I attached my whole header file.
> >
> > Thanks,
> > Sevcsik
>
>
/* EJABBER CONTANCT LIST HEADER FILE */
#include <iostream>
#include <string>
#include <Ecore_Evas.h>
#include <Ecore.h>
#include <Evas.h>
using namespace std;
void AutoResize(Ecore_Evas *ee) {
int edje_w, edje_h;
Evas_Object *edje;
ecore_evas_geometry_get(ee, NULL, NULL, &edje_w, &edje_h);
edje = evas_object_name_find(ecore_evas_get(ee), "edje");
evas_object_resize(edje, edje_w, edje_h);
}
class EdjeWindow {
public:
EdjeWindow(char *, char *);
void SetTitle(char *);
void Show();
private:
Ecore_Evas *ee;
Evas *evas;
Evas_Object *edje;
int edje_h;
int edje_w;
char *theme_file;
char *container;
char *window_title;
};
EdjeWindow::EdjeWindow(char * theme_file, char * container) {
/* Init */
if (ecore_init()) {
cout << "Ecore loaded.\n";
} else {
cout << "Loading Ecore failed\n";
exit(1);
}
if (ecore_evas_init()) {
cout << "Ecore_Evas loaded.\n";
} else {
cout << "Loading Ecore_Evas failed\n";
exit(1);
}
if (edje_init()) {
cout << "Edje loaded.\n";
} else {
cout << "Loading Edje failed\n";
exit(1);
}
/* Building window */
ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 0, 0);
ecore_evas_show(ee);
evas = ecore_evas_get(ee);
edje = edje_object_add(evas);
edje_object_file_set(edje, theme_file, container);
cout << theme_file << '\n';
evas_object_move(edje, 0, 0);
evas_object_name_set(edje, "edje");
edje_object_size_min_get(edje, &edje_w, &edje_h);
evas_object_resize(edje, edje_w, edje_h);
ecore_evas_resize(ee, (int)edje_w, (int)edje_h);
ecore_evas_callback_resize_set(ee, AutoResize);
}
void EdjeWindow::SetTitle(char * window_title) {
ecore_evas_title_set(ee, window_title);
}
void EdjeWindow::Show() {
ecore_evas_show(ee);
evas_object_show(edje);
ecore_main_loop_begin();
}