[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[E-devel] ecore_evas_callback_resize in c++



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:

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;

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;
		void		AutoResize(Ecore_Evas *ee);
		//~ int 			app_signal_exit(void *data, int type, void *event);
};

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);
	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();
}

void EdjeWindow::AutoResize() {
	ecore_evas_geometry_get(ee, NULL, NULL, &edje_w, &edje_h);
	evas_object_resize(edje, edje_w, edje_h);
}