Re: Parent <--> Child and header files



Hi :)

Didn't read your post completely (man, you've no idea how lazy iam :P),
but i figured you may need signals.
Check here:
http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/apb.html

and/or read the recent discussion on the mailinglist about signals etc..

Hope this helps,

Bart

PS. i think you suffer from circular inclusion. Think about it, if A
includes B and B includes A, then A also includes A and A includes B and
B includes A... (*sound of bart going back to his beer* :P )

On Sat, 2004-11-20 at 21:51 +0100, Mateusz 'vArDo' Bilinski wrote:
> Hi, 
> I've got problem in including header files when I want to do a parent-
> child relation to be remembered from child widget. 
> 
> What I've got is CMainWindow class that consists of CMainToolbar and
> CMainStatus. On a toolbar there's a button. When it will be hit I want
> the text to show up on a status bar. So I want to remember a parent
> widget pointer in Toolbar, to get back to CMainWindow class, and from
> there push the text to statusbar. 
> 
> In other words I want to call:
> 
> 'm_parent->status_bar.push("text")'
> 
> form one of the toolbars methods. I hope the idea isn't very bad. If
> there a simple method I will be glad to know.
> 
> What is the PROBLEM is that I can't include "mainwindow.hh" file in
> "maintoolbar.hh" files because I get errors (very strange;/ - listing at
> the bottom). In "mainwindow.hh" I've got of course "#include
> "maintoolbar.hh" because toolbar is the part of mainwindow.
> 
> At the end, here's the a part of gcc output when it comes to compile
> maintoolbar.cc:
> 
> <src>
> 
> In file included from maintoolbar.hh:28,
>                  from maintoolbar.cc:24:
> mainwindow.hh:46: error: syntax error before `;' token
> In file included from /usr/include/gtkmm-2.4/gtkmm/stock.h:24,
>                  from maintoolbar.cc:26:
> /usr/include/gtkmm-2.4/gtkmm/stockitem.h:76: error: parse error before
> `)'
>    token
> In file included from /usr/include/gdkmm-2.4/gdkmm/pixbufanimation.h:31,
>                  from /usr/include/gtkmm-2.4/gtkmm/image.h:31,
>                  from /usr/include/gtkmm-2.4/gtkmm/stock.h:27,
>                  from maintoolbar.cc:26:
> /usr/include/gdkmm-2.4/gdkmm/pixbufanimationiter.h:52: error: ISO C++
> forbids
>    declaration of `PixbufAnimationIter_Class' with no type
> /usr/include/gdkmm-2.4/gdkmm/pixbufanimationiter.h:52: error: parse
> error
>    before `;' token
> In file included from /usr/include/gtkmm-2.4/gtkmm/image.h:31,
>                  from /usr/include/gtkmm-2.4/gtkmm/stock.h:27,
>                  from maintoolbar.cc:26:
> /usr/include/gdkmm-2.4/gdkmm/pixbufanimation.h:54: error: ISO C++
> forbids
>    declaration of `PixbufAnimation_Class' with no type
> /usr/include/gdkmm-2.4/gdkmm/pixbufanimation.h:54: error: parse error
> before `;
>    ' token
> /usr/include/gdkmm-2.4/gdkmm/pixbufanimation.h:105: error: `Pixbuf' was
> not
>    declared in this scope
> /usr/include/gdkmm-2.4/gdkmm/pixbufanimation.h:105: error: template
> argument 1
>    is invalid
> /usr/include/gdkmm-2.4/gdkmm/pixbufanimation.h:105: error: ISO C++
> forbids
>    declaration of `get_static_image' with no type
> /usr/include/gdkmm-2.4/gdkmm/pixbufanimation.h:107: error:
> `PixbufAnimationIter
>    ' was not declared in this scope
> /usr/include/gdkmm-2.4/gdkmm/pixbufanimation.h:107: error: template
> argument 1
>    is invalid
> /usr/include/gdkmm-2.4/gdkmm/pixbufanimation.h:107: error: ISO C++
> forbids
>    declaration of `get_iter' with no type
> In file included from /usr/include/gtkmm-2.4/gtkmm/stock.h:27,
>                  from maintoolbar.cc:26:
> /usr/include/gtkmm-2.4/gtkmm/image.h:70: error: `Value' is not a
> template
> /usr/include/gtkmm-2.4/gtkmm/image.h:73: error: can't make `value_type'
> into a
>    method -- not in a class
> /usr/include/gtkmm-2.4/gtkmm/image.h:102: error: parse error before `{'
> token
> /usr/include/gtkmm-2.4/gtkmm/image.h:106: error: syntax error before `;'
> token
> /usr/include/gtkmm-2.4/gtkmm/image.h:111: error: destructors must be
> member
>    functions
> /usr/include/gtkmm-2.4/gtkmm/image.h:111: error: virtual outside class
>    declaration
> /usr/include/gtkmm-2.4/gtkmm/image.h:115: error: parse error before
> `private'
> /usr/include/gtkmm-2.4/gtkmm/image.h:117: error: syntax error before `;'
> token
> /usr/include/gtkmm-2.4/gtkmm/image.h:120: error: parse error before `&'
> token
> /usr/include/gtkmm-2.4/gtkmm/image.h:120: error: ISO C++ forbids
> declaration of
>    `Image' with no type
> /usr/include/gtkmm-2.4/gtkmm/image.h:121: error: syntax error before `&'
> token
> /usr/include/gtkmm-2.4/gtkmm/image.h:125: error: ISO C++ forbids
> declaration of
>    `Image' with no type
> /usr/include/gtkmm-2.4/gtkmm/image.h:125: error: only declarations of
>    constructors can be `explicit'
> /usr/include/gtkmm-2.4/gtkmm/image.h:129: error: parse error before
> `public'
> /usr/include/gtkmm-2.4/gtkmm/image.h: In function `GtkImage* Gtk::gobj
> ()':
> /usr/include/gtkmm-2.4/gtkmm/image.h:136: error: `gobject_' undeclared
> (first
>    use this function)
> /usr/include/gtkmm-2.4/gtkmm/image.h:136: error: (Each undeclared
> identifier is
>    reported only once for each function it appears in.)
> /usr/include/gtkmm-2.4/gtkmm/image.h: At global scope:
> /usr/include/gtkmm-2.4/gtkmm/image.h:139: error: non-member function
> `const
>    GtkImage* Gtk::gobj()' cannot have `const' method qualifier
> /usr/include/gtkmm-2.4/gtkmm/image.h: In function `const GtkImage*
> Gtk::gobj()
>    ':
> /usr/include/gtkmm-2.4/gtkmm/image.h:139: error: new declaration `const
>    GtkImage* Gtk::gobj()'
> /usr/include/gtkmm-2.4/gtkmm/image.h:136: error: ambiguates old
> declaration `
>    GtkImage* Gtk::gobj()'
> /usr/include/gtkmm-2.4/gtkmm/image.h: At global scope:
> /usr/include/gtkmm-2.4/gtkmm/image.h:142: error: parse error before
> `public'
> /usr/include/gtkmm-2.4/gtkmm/image.h:157: error: ISO C++ forbids
> declaration of
>    `Image' with no type
> /usr/include/gtkmm-2.4/gtkmm/image.h:157: error: only declarations of
>    constructors can be `explicit'
> /usr/include/gtkmm-2.4/gtkmm/image.h:158: error: ISO C++ forbids
> declaration of
>    `Image' with no type
> /usr/include/gtkmm-2.4/gtkmm/image.h:158: error: only declarations of
>    constructors can be `explicit'
> /usr/include/gtkmm-2.4/gtkmm/image.h:159: error: ISO C++ forbids
> declaration of
>    `Image' with no type
> /usr/include/gtkmm-2.4/gtkmm/image.h:159: error: only declarations of
>    constructors can be `explicit'
> /usr/include/gtkmm-2.4/gtkmm/image.h:160: error: ISO C++ forbids
> declaration of
>    `Image' with no type
> /usr/include/gtkmm-2.4/gtkmm/image.h:160: error: only declarations of
>    constructors can be `explicit'
> /usr/include/gtkmm-2.4/gtkmm/image.h:161: error: type specifier omitted
> for
>    parameter `IconSize'
> /usr/include/gtkmm-2.4/gtkmm/image.h:161: error: parse error before `)'
> token
> /usr/include/gtkmm-2.4/gtkmm/image.h:161: error: ISO C++ forbids
> declaration of
> etc.
> </src>
> 
> In CMainWindow I've got a class the inherits from DrawingArea if this to
> help.
> 
> mainwindow.hh:46: error: syntax error before `;' token
> 
> is related to line:
> 
> RLC::CMainToolbar m_MainToolbar_Upper;
> 
> 
> I hope hope I've discrabe clearly my problem.
> 
> Thanks for any suggestions in advance.
> 
> vArDo
> 
> 
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
-- 
www.titanium-it.nl --- Open Minded Open Source
www.real-life.nl <-----Another Source




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