Re: How to extend a widget?

2011-12-16 Thread Michael Torrie
On 12/16/2011 08:16 AM, jacky wrote: As I said, I'm not sure this is the right way to do such a thing, so I would appreciate any help/information on how one would do this properly. Since GTK is object oriented, you could just create a new class that inherits from GtkCalender. However this is

Re: How to extend a widget?

2011-12-16 Thread Michael Torrie
On 12/16/2011 11:05 AM, Michael Torrie wrote: stuff As I think about it, my knowledge of extending GTK really is out of date. So I'm not at all sure how to do in C anymore. But Vala still just might be the ticket. Emitted Vala code is supped to be directly usable from a C program. I know the

Re: How to extend a widget?

2011-12-16 Thread jjacky
Thanks. I will have a look into Vala, although for projects I have planned, I really want/need to be using C. And while GTK is oriented-object, it is written in C and, AFAIK, there are no such things as classes in C? I believe the way to create a widget based on/extending another one is how I

Re: How to extend a widget?

2011-12-16 Thread Michael Cronenworth
jacky wrote: What I was looking into would be more taking an existing widget, and modifying it a little, as in changing its behavior on some aspect, or adding a feature, something like that. My question is: what would be the best/standard/recommanded way to do such a thing? Widgets are not

Re: How to extend a widget?

2011-12-16 Thread Michael Cronenworth
Michael Cronenworth wrote: 2. Create a shell widget Rereading your post I think you called this composite widget. I'm not sure why you are opposed to this idea. I've created a composite widget myself and it has worked great for me. ___

Re: How to extend a widget?

2011-12-16 Thread jjacky
Right, thanks. Alright so using extend might not have been the right term (probably comes because I've done some PHP and have been influenced by that), sorry. Oh, and I've used the term composite widget simply because I read it here, and assumed it was how such widgets were called:

Re: How to extend a widget?

2011-12-16 Thread Michael Cronenworth
jjacky wrote: Anyways, I don't have a problem with creating a new (shell/composite) widget using another one inside of it, it's actually exactly what I did in my example: created a widget JjkCalendar which contains a GtkCalendar. Your composite widget project is similar to mine. I created a

Re: How to extend a widget?

2011-12-16 Thread Michael Torrie
On 12/16/2011 02:52 PM, jjacky wrote: Thanks. I will have a look into Vala, although for projects I have planned, I really want/need to be using C. Precisely. Vala makes the C Gobjects. You could use Vala to construct a class with a bunch of empty methods and then use the generated C code

Re: How to extend a widget?

2011-12-16 Thread Michael Torrie
On 12/16/2011 03:03 PM, Michael Cronenworth wrote: jacky wrote: What I was looking into would be more taking an existing widget, and modifying it a little, as in changing its behavior on some aspect, or adding a feature, something like that. My question is: what would be the

Re: How to extend a widget?

2011-12-16 Thread Michael Torrie
On 12/16/2011 03:03 PM, Michael Cronenworth wrote: Widgets are not plugins. They are whole objects. There is no extensible feature to them. Just for your information, here's a couple of examples of extending GtkButton using inheritance and the GObject Builder tool:

Re: How to extend a widget?

2011-12-16 Thread Michael Torrie
On 12/16/2011 02:52 PM, jjacky wrote: And while GTK is oriented-object, it is written in C and, AFAIK, there are no such things as classes in C? As always, read the docs. Here is the documentation describing how to create new GObjects, and inherit from existing ones, implement virtual

Re: How to extend a widget?

2011-12-16 Thread David Nečas
On Fri, Dec 16, 2011 at 04:09:54PM -0700, Michael Torrie wrote: 1. Copy an entire GTK widget and give it a unique name. Example: GtkButton becomes GtkMyButton You really could Create a GtkMyButton by inheriting from GtkButton and adding your own code. However, just as in C++, the

Re: How to extend a widget?

2011-12-16 Thread jjacky
Thanks, I do need to do some more reading on the gobject docs, great stuff there. What I'm looking for is inheritance, and I see how it could be done yes. However, that would require the original widget to be done using virtual public methods, and I'm afraid this isn't the case

Re: How to extend a widget?

2011-12-16 Thread jjacky
Alright, I think I'm starting to see things a little better now - thank you all. I believe, in the case of GtkCalendar, there are no virtual public methods, only static/private ones, and most of them use other such methods as well as the private structure, which is why creating a widget

Re: How to extend a widget?

2011-12-16 Thread Michael Torrie
On 12/16/2011 05:24 PM, jjacky wrote: Thanks, I do need to do some more reading on the gobject docs, great stuff there. What I'm looking for is inheritance, and I see how it could be done yes. However, that would require the original widget to be done using virtual public methods, and