Re: Please help (core dump)

2020-07-28 Thread aitor

Hi,

On 27/7/20 14:00, Carlo Wood  wrote:

Hi aitor,

thank you so much for your examples!
I will definitely study them in depth as soon as I get
my current problem resolved of how to add a 'Mode' to
my menu having a separate Gtk::Builder (aka, how to
combine multiple Gtk::Builder objects into a single
menu). Or, alternatively, I could have just a single
Gtk::Builder object, but then I still need to be
able to somehow add a Gio::SimpleActionGroup to my
menu.

It seems that your approach is entirely different:
you have a MenuBar class that deals with everything
related to the menu. From an object oriented point
of view that makes a lot of sense. You're not using
Gtk::Builder at all, but - instead of using an xml
string - hardcode the menu into the constructor of
myMenuBar.



Yes, Gtk::Builder is cool, but the other point of view simplifies 
dynamic changes because
you can define an iterator which can be used for the addition/removal of 
the items in the

menu.



For some reason you're passing `*this` to every
sigc::mem_fun - aka*all*  `on_menu_*` menu callbacks
are member functions of myMenuBar. I'd prefer it
if I could use callbacks that are member functions
of several different objects (namely those that
they operate on). I suppose I can do that by passing
a pointer to all those objects to the constructor
of myMenuBar. Currently you pass only a WindowMain*,
for the on_menu_mode_quit method.

Why are you using the construct of passing this WindowMain*
as an argument to myMenuBar::on_menu_mode_quit?
Wouldn't it be possible, and make more sense, to do:

 m_QuitItem->signal_activate().connect (
 sigc::mem_fun(*caller, ::on_menu_mode_quit)
 );

?



The sort answer: Yes, you are write! It makes more sense in the other 
way around, so i left the

callbackas follows:

m_QuitItem->signal_activate().connect (
            sigc::mem_fun(*caller, ::hide)
);

Indeed, i was doing something similar in the callback of the status icon 
of my new
network manager. I still didn't finish it, but shortly i'll share the 
code here in the mailing list.

Anyway, I can give you a link to the backend so far:

https://git.devuan.org/aitor_czr/libnetaid

Thanks for your constructive correctness :)

Aitor.





___
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


Re: Please help

2020-07-27 Thread Carlo Wood
Hi aitor,

thank you so much for your examples!
I will definitely study them in depth as soon as I get
my current problem resolved of how to add a 'Mode' to
my menu having a separate Gtk::Builder (aka, how to
combine multiple Gtk::Builder objects into a single
menu). Or, alternatively, I could have just a single
Gtk::Builder object, but then I still need to be
able to somehow add a Gio::SimpleActionGroup to my
menu.

It seems that your approach is entirely different:
you have a MenuBar class that deals with everything
related to the menu. From an object oriented point
of view that makes a lot of sense. You're not using
Gtk::Builder at all, but - instead of using an xml
string - hardcode the menu into the constructor of
myMenuBar.

For some reason you're passing `*this` to every
sigc::mem_fun - aka *all* `on_menu_*` menu callbacks
are member functions of myMenuBar. I'd prefer it
if I could use callbacks that are member functions
of several different objects (namely those that 
they operate on). I suppose I can do that by passing
a pointer to all those objects to the constructor
of myMenuBar. Currently you pass only a WindowMain*,
for the on_menu_mode_quit method.

Why are you using the construct of passing this WindowMain*
as an argument to myMenuBar::on_menu_mode_quit?
Wouldn't it be possible, and make more sense, to do:

m_QuitItem->signal_activate().connect (
sigc::mem_fun(*caller, ::on_menu_mode_quit)
);

?


On Sun, 26 Jul 2020 20:56:15 +0200
aitor  wrote:

> Hi again,
> 
> On 26/7/20 14:00, aitor_czr  wrote:
> > In the next examples i'll explain how to add an icon factory for
> > your custom stock icons and how to add the toolbar to
> >
> > the project. They'll be uploaded to the following link:
> >
> > https://www.gnuinos.org/Gtkmm%20Examples/
> >
> > Hope this helps,  
> 
> Finally, I added the toolbar with the custom icons:
> 
> https://www.gnuinos.org/Gtkmm%20Examples/Example_4/
> 
> Quote.- The SeparatorToolItem at the left of the last item is missing
> in Gtkmm3:
> 
> https://www.gnuinos.org/Gtkmm%20Examples/Example_4/screenshot.png
> 
> This separator only appears in Gtkmm-2.4 ...
> 
> Cheers,
> 
> Aitor.
> 
> 

___
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


Re: Please help (core dump)

2020-07-27 Thread Kjell Ahlstedt via gtkmm-list

On 2020-07-27 09:40, Carlo Wood wrote:

Is there an example somewhere that shows how I can combine the
`void on_menu_mode_*()` member functions of a widget that is not
derived (indirectly) from Gio::ActionMap to the menu of the window
that this widgets belongs to?

Thanks,
Carlo Wood


Look at 
https://gitlab.gnome.org/GNOME/gtkmm-documentation/-/blob/gtkmm-3-24/examples/book/menus_and_toolbars/examplewindow.cc


I think that's what you can do. Create a Gio::SimpleActionGroup. Add 
your actions to it. Insert it in your widget with Gtk::Widget's 
insert_action_group() method. In the call to insert_action_group() you 
choose what prefix to use in the ui file.


___
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


Re: Please help (core dump)

2020-07-27 Thread Carlo Wood
On Sun, 26 Jul 2020 20:22:43 +0100
Daniel Boles via gtkmm-list  wrote:

> On Sun, 26 Jul 2020, 20:21 Carlo Wood,  wrote:
> 
> >
> > I'm not sure what you mean with doing
> >
> > LinuxChessboardWidget(..) : Glib::ObjectBase("myWidgetClass")
> >
> > since Glib::ObjectBase is a base class of Gio::ActionMap,
> > I can't call that from LinuxChessboardWidget no?
> >  
> 
> yes, you can: research "virtual base classes"

I don't have to research that :p. I realized that this is possible
when Glib::ObjectBase is a virtual base class; that is why I looked
on https://developer.gnome.org/glibmm/stable/classGio_1_1ActionMap.html

and since there I saw no indication whatsoever that ObjectBase would
be a virtual base class, I concluded it wasn't :/.

I hope my other questions can be answered too, since Kjell said
that deriving from Gio::ActionMap was very unusual and apparently
not the route I should take.

Is there an example somewhere that shows how I can combine the
`void on_menu_mode_*()` member functions of a widget that is not
derived (indirectly) from Gio::ActionMap to the menu of the window
that this widgets belongs to?

Thanks,
Carlo Wood

___
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


Re: Please help (core dump)

2020-07-26 Thread Daniel Boles via gtkmm-list
On Sun, 26 Jul 2020, 20:21 Carlo Wood,  wrote:

>
> I'm not sure what you mean with doing
>
> LinuxChessboardWidget(..) : Glib::ObjectBase("myWidgetClass")
>
> since Glib::ObjectBase is a base class of Gio::ActionMap,
> I can't call that from LinuxChessboardWidget no?
>

yes, you can: research "virtual base classes"
___
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


Re: Please help (core dump)

2020-07-26 Thread Carlo Wood
Hi Kjell,

thank you so much for helping me out!

I'm not sure what you mean with doing

LinuxChessboardWidget(..) : Glib::ObjectBase("myWidgetClass")

since Glib::ObjectBase is a base class of Gio::ActionMap,
I can't call that from LinuxChessboardWidget no?

What I have is the following:

class LinuxChessApplication : public Gtk::Application
{
...
  void on_menu_file_exit();

Where 'Exit' is not related to a single window, but is application
wide (it closes all windows and exits the application).
I add this with add_action to Gtk::Application.

Then I have:

class LinuxChessWindow : public Gtk::ApplicationWindow
{
...
  void on_menu_file_load();
  void on_menu_file_save();
  void on_menu_game_new();
  void on_menu_game_clear();
  void on_menu_game_export();
  void on_menu_game_undo();
  void on_menu_game_flip();
  void on_menu_mode_editposition();
  void on_menu_mode_editgame();

These are added, using add_action, to Gtk::ApplicationWindow.

So, I am using what you said. But, then I have:

class LinuxChessboardWidget : public cwmm::ChessPositionWidget
{
...
  void on_menu_mode_showcandidates();
  void on_menu_mode_showreachables();
  void on_menu_mode_showattacked();
  void on_menu_mode_showdefendables();
  void on_menu_mode_showdefended_black();
  void on_menu_mode_showdefended_white();
  void on_menu_mode_showmoves();
  void on_menu_mode_placepieces();

It is possible, though silly imho, to add those member funtions to
LinuxChessWindow (all those would do is call the member functions of
its LinuxChessboardWidget). So, I rather register these directly.

I couldn't think of another way than to derive LinuxChessboardWidget
from Gio::ActionMap, like Gtk::Application and Gtk::ApplicationWindow.

Should I add a Gio::SimpleActionGroup to LinuxChessboardWidget instead
and add them to that? If I do that, then how can get this
Gio::SimpleActionGroup to be used for my menu? And under what name
would do I have to refer to them in the `ui_info` xml string that
I use for my Gtk::Builder? Or should I use a separate Gtk::Builder?

With 'name' I mean that the menu entries that are added to
Gtk::Application are refered to as "app.*" and those that are
added to Gtk::ApplicationWindow are refered to as "win.*".
I'd like it when the methods of LinuxChessboardWidget can be
refered to as -say- "chessboard.*".


On Sun, 26 Jul 2020 11:06:53 +0200
Kjell Ahlstedt  wrote:

> Gio::ActionMap is an interface. That's why its constructor is
> protected. An interface can't be instantiated by itself. It must be
> implemented by a class which can be instantiated. If you really must
> implement Gio::ActionMap in your class (which I doubt), there is one
> or (probably) two errors.
> 
> First, interfaces must come before the widget class in the list of
> base classes.
> 
> class LinuxChessboardWidget : public Gio::ActionMap, public
> cwmm::ChessPositionWidget
> 
> This is opposite to what's done in gtkmm's classes that wrap gtk
> classes.
> 
> Second, your constructor must call a special Glib::ObjectBase
> constructor that registers your class with its own GType in glib's
> GType system. For instance
> 
> LinuxChessboardWidget(..) : Glib::ObjectBase("myWidgetClass")
> . // Or whatever you want to call it.
> 
> This is an unusual way of using Gio::ActionMap. I don't know if these
> are the only necessary changes. Much more common is to use one of the
> classes that already implement Gio::ActionMap:
> Gio::SimpleActionGroup, Gtk::Application (via Gio::Application) or
> Gtk::ApplicationWindow.
> 

___
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


Re: Please help

2020-07-26 Thread aitor

Hi again,

On 26/7/20 14:00, aitor_czr  wrote:

In the next examples i'll explain how to add an icon factory for your
custom stock icons and how to add the toolbar to

the project. They'll be uploaded to the following link:

https://www.gnuinos.org/Gtkmm%20Examples/

Hope this helps,


Finally, I added the toolbar with the custom icons:

https://www.gnuinos.org/Gtkmm%20Examples/Example_4/

Quote.- The SeparatorToolItem at the left of the last item is missing in 
Gtkmm3:


https://www.gnuinos.org/Gtkmm%20Examples/Example_4/screenshot.png

This separator only appears in Gtkmm-2.4 ...

Cheers,

Aitor.


___
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


Re: Please help (core dump)

2020-07-26 Thread aitor

Hi Carlo,

On 25/7/20 15:35, Carlo Wood wrote:

Hi Aitor,

is this gtkmm3? For example, Gtk::VBox is deprecated,
I'm using Gtk::Grid.



Yes, it is. Have a look at the "pkg_check_modules" in the configuration 
of CMake. I'm using the deprecated VBox because this
code is taken froma network manager project, which i'd like to be 
compatible with goth gtkmm-2.24 and gtkmm-3.24.




Currently my application just core dumps:(.
The backtrace is:

Thread 1 "tstcpp" received signal SIGSEGV, Segmentation fault.
0x76bc29c6 in g_action_map_add_action () from /usr/lib/libgio-2.0.so.0
(gdb) bt
#0  0x76bc29c6 in g_action_map_add_action () at /usr/lib/libgio-2.0.so.0
#1  0x778cc541 in Gio::ActionMap::add_action(Glib::ustring const&) () 
at /usr/lib/libgiomm-2.4.so.1
#2  0x778cc65e in Gio::ActionMap::add_action(Glib::ustring const&, 
sigc::slot const&) ()
 at /usr/lib/libgiomm-2.4.so.1
#3  0x55573871 in LinuxChessboardWidget::LinuxChessboardWidget(Gtk::Window*, 
Glib::RefPtr) (this=
 0x563bd928, drawable=0x563bd8a0, promotion=..., __in_chrg=, __vtt_parm=)
 at 
/home/carlo/projects/cwchessboard/cwchessboard/LinuxChessboardWidget.cxx:164
#4  0x5557b68b in LinuxChessWindow::LinuxChessWindow() (this=0x563bd8a0, 
__in_chrg=, __vtt_parm=)
 at /home/carlo/projects/cwchessboard/cwchessboard/LinuxChessWindow.cxx:4
#5  0x5556e473 in LinuxChessApplication::create_window() 
(this=0x555f6230) at 
/home/carlo/projects/cwchessboard/cwchessboard/LinuxChessApplication.cxx:160
#6  0x5556e3ed in LinuxChessApplication::on_activate() 
(this=0x555f6230) at 
/home/carlo/projects/cwchessboard/cwchessboard/LinuxChessApplication.cxx:155
#7  0x778bbc2c in 
Gio::Application_Class::activate_callback(_GApplication*) () at 
/usr/lib/libgiomm-2.4.so.1
#8  0x7694480a in g_signal_emit_valist () at 
/usr/lib/libgobject-2.0.so.0
#9  0x76944980 in g_signal_emit () at /usr/lib/libgobject-2.0.so.0
#10 0x76bbea89 in  () at /usr/lib/libgio-2.0.so.0
#11 0x778bba8a in Gio::Application::local_command_line_vfunc(char**&, 
int&) () at /usr/lib/libgiomm-2.4.so.1
#12 0x778bbe51 in 
Gio::Application_Class::local_command_line_vfunc_callback(_GApplication*, 
char***, int*) () at /usr/lib/libgiomm-2.4.so.1
#13 0x76bbec0a in g_application_run () at /usr/lib/libgio-2.0.so.0
#14 0x5557a928 in main(int, char**) (argc=1, argv=0x7fffd448) at 
/home/carlo/projects/cwchessboard/cwchessboard/LinuxChess.cxx:14

Frame #3 (the first that is my code) is:

#3  0x55573871 in LinuxChessboardWidget::LinuxChessboardWidget(this=0x563bd928, 
drawable=0x563bd8a0, promotion=...,__in_chrg=, 
__vtt_parm=)
 at 
/home/carlo/projects/cwchessboard/cwchessboard/LinuxChessboardWidget.cxx:164
164   add_action("ModeShowCandidates", sigc::mem_fun(*this, 
::on_menu_mode_showcandidates));


Why would this core dump??

LinuxChessboardWidget is defined as:

class LinuxChessboardWidget : public cwmm::ChessPositionWidget, public 
Gio::ActionMap
{
   ...

I have to derive from Gio::ActionMap because its constructor is protected.
The call to `add_action` above is to that class.

Can someone tell me what I'm doing wrong?



Mmm..., i don't know, but this issue might be related with some missing 
arguments in your defined signal/slot.


BTW, i uploaded my third examples including an icon factory for the 
customized icons of the second part of the menu bar:


https://www.gnuinos.org/Gtkmm Examples/Example_3/screenshot.png 



Cheers,

Aitor.


___
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


Re: Please help (core dump)

2020-07-26 Thread Kjell Ahlstedt via gtkmm-list

On 2020-07-25 17:35, Carlo Wood wrote:

Why would this core dump??

LinuxChessboardWidget is defined as:

class LinuxChessboardWidget : public cwmm::ChessPositionWidget, public 
Gio::ActionMap
{
   ...

I have to derive from Gio::ActionMap because its constructor is protected.
The call to `add_action` above is to that class.

Can someone tell me what I'm doing wrong?

Carlo

Gio::ActionMap is an interface. That's why its constructor is protected. 
An interface can't be instantiated by itself. It must be implemented by 
a class which can be instantiated. If you really must implement 
Gio::ActionMap in your class (which I doubt), there is one or (probably) 
two errors.


First, interfaces must come before the widget class in the list of base 
classes.


class LinuxChessboardWidget : public Gio::ActionMap, public 
cwmm::ChessPositionWidget

This is opposite to what's done in gtkmm's classes that wrap gtk classes.

Second, your constructor must call a special Glib::ObjectBase constructor that 
registers your class with its own GType in glib's GType system. For instance

LinuxChessboardWidget(..) : Glib::ObjectBase("myWidgetClass") . // Or 
whatever you want to call it.

This is an unusual way of using Gio::ActionMap. I don't know if these are the 
only necessary changes. Much more common is to use one of the classes that 
already implement Gio::ActionMap: Gio::SimpleActionGroup, Gtk::Application (via 
Gio::Application) or Gtk::ApplicationWindow.

___
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


Re: Please help (core dump)

2020-07-25 Thread Carlo Wood
Hi Aitor,

is this gtkmm3? For example, Gtk::VBox is deprecated,
I'm using Gtk::Grid.

Currently my application just core dumps :(.
The backtrace is:

Thread 1 "tstcpp" received signal SIGSEGV, Segmentation fault.
0x76bc29c6 in g_action_map_add_action () from /usr/lib/libgio-2.0.so.0
(gdb) bt
#0  0x76bc29c6 in g_action_map_add_action () at /usr/lib/libgio-2.0.so.0
#1  0x778cc541 in Gio::ActionMap::add_action(Glib::ustring const&) () 
at /usr/lib/libgiomm-2.4.so.1
#2  0x778cc65e in Gio::ActionMap::add_action(Glib::ustring const&, 
sigc::slot const&) ()
at /usr/lib/libgiomm-2.4.so.1
#3  0x55573871 in 
LinuxChessboardWidget::LinuxChessboardWidget(Gtk::Window*, 
Glib::RefPtr) (this=
0x563bd928, drawable=0x563bd8a0, promotion=..., 
__in_chrg=, __vtt_parm=)
at 
/home/carlo/projects/cwchessboard/cwchessboard/LinuxChessboardWidget.cxx:164
#4  0x5557b68b in LinuxChessWindow::LinuxChessWindow() 
(this=0x563bd8a0, __in_chrg=, __vtt_parm=)
at /home/carlo/projects/cwchessboard/cwchessboard/LinuxChessWindow.cxx:4
#5  0x5556e473 in LinuxChessApplication::create_window() 
(this=0x555f6230) at 
/home/carlo/projects/cwchessboard/cwchessboard/LinuxChessApplication.cxx:160
#6  0x5556e3ed in LinuxChessApplication::on_activate() 
(this=0x555f6230) at 
/home/carlo/projects/cwchessboard/cwchessboard/LinuxChessApplication.cxx:155
#7  0x778bbc2c in 
Gio::Application_Class::activate_callback(_GApplication*) () at 
/usr/lib/libgiomm-2.4.so.1
#8  0x7694480a in g_signal_emit_valist () at 
/usr/lib/libgobject-2.0.so.0
#9  0x76944980 in g_signal_emit () at /usr/lib/libgobject-2.0.so.0
#10 0x76bbea89 in  () at /usr/lib/libgio-2.0.so.0
#11 0x778bba8a in Gio::Application::local_command_line_vfunc(char**&, 
int&) () at /usr/lib/libgiomm-2.4.so.1
#12 0x778bbe51 in 
Gio::Application_Class::local_command_line_vfunc_callback(_GApplication*, 
char***, int*) () at /usr/lib/libgiomm-2.4.so.1
#13 0x76bbec0a in g_application_run () at /usr/lib/libgio-2.0.so.0
#14 0x5557a928 in main(int, char**) (argc=1, argv=0x7fffd448) at 
/home/carlo/projects/cwchessboard/cwchessboard/LinuxChess.cxx:14

Frame #3 (the first that is my code) is:

#3  0x55573871 in 
LinuxChessboardWidget::LinuxChessboardWidget(this=0x563bd928, 
drawable=0x563bd8a0, promotion=...,__in_chrg=, 
__vtt_parm=)
at 
/home/carlo/projects/cwchessboard/cwchessboard/LinuxChessboardWidget.cxx:164
164   add_action("ModeShowCandidates", sigc::mem_fun(*this, 
::on_menu_mode_showcandidates));


Why would this core dump??

LinuxChessboardWidget is defined as:

class LinuxChessboardWidget : public cwmm::ChessPositionWidget, public 
Gio::ActionMap
{
  ...

I have to derive from Gio::ActionMap because its constructor is protected.
The call to `add_action` above is to that class.

Can someone tell me what I'm doing wrong?

Carlo


___
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


Re: Please help

2020-07-25 Thread aitor_czr

Hi all,

On 7/23/20 2:00 PM, Carlo Wood  wrote:

On Wed, 22 Jul 2020 16:27:33 +0200
Kjell Ahlstedt  wrote:


There are lots of working example programs at
https://gitlab.gnome.org/GNOME/gtkmm-documentation/-/tree/gtkmm-3-24/examples

See e.g.
https://gitlab.gnome.org/GNOME/gtkmm-documentation/-/tree/gtkmm-3-24/examples/book/menus/main_menu  
and

https://gitlab.gnome.org/GNOME/gtkmm-documentation/-/tree/gtkmm-3-24/examples/book/menus_and_toolbars

Ah yes, thank you - with this as example (that I had found before)
I managed to get something working.

Still struggling though to get what I really want (icons in my menu,
separators, radio actions in the menu - a toolbar - ...).


Let's start by an empty window built with CMake:

https://www.gnuinos.org/Gtkmm%20Examples/Example_1/

The second example adds the first part of you purposed menu bar, 
including the Open, Save and Close options.


https://www.gnuinos.org/Gtkmm%20Examples/Example_2/

Here you are a screenshot:

https://www.gnuinos.org/Gtkmm%20Examples/Example_2/screenshot.png

The gtk folder in the examples above will store all the widgets splitted 
in several classes. On the other hand,


the CMakeFile.txt located in this folder will look for all the existent 
*.cpp files at every change


including all the sources in the shared library afterwards; so, we won't 
take care of the CMake configuration anymore.


In the next examples i'll explain how to add an icon factory for your 
custom stock icons and how to add the toolbar to


the project. They'll be uploaded to the following link:

https://www.gnuinos.org/Gtkmm%20Examples/

Hope this helps,

Aitor.


___
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


Re: Please help

2020-07-23 Thread Carlo Wood
On Wed, 22 Jul 2020 16:27:33 +0200
Kjell Ahlstedt  wrote:

> There are lots of working example programs at 
> https://gitlab.gnome.org/GNOME/gtkmm-documentation/-/tree/gtkmm-3-24/examples
> 
> See e.g. 
> https://gitlab.gnome.org/GNOME/gtkmm-documentation/-/tree/gtkmm-3-24/examples/book/menus/main_menu
>  
> and 
> https://gitlab.gnome.org/GNOME/gtkmm-documentation/-/tree/gtkmm-3-24/examples/book/menus_and_toolbars

Ah yes, thank you - with this as example (that I had found before)
I managed to get something working.

Still struggling though to get what I really want (icons in my menu,
separators, radio actions in the menu - a toolbar - ...).


___
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


Re: Please help

2020-07-22 Thread Kjell Ahlstedt via gtkmm-list
There are lots of working example programs at 
https://gitlab.gnome.org/GNOME/gtkmm-documentation/-/tree/gtkmm-3-24/examples


See e.g. 
https://gitlab.gnome.org/GNOME/gtkmm-documentation/-/tree/gtkmm-3-24/examples/book/menus/main_menu 
and 
https://gitlab.gnome.org/GNOME/gtkmm-documentation/-/tree/gtkmm-3-24/examples/book/menus_and_toolbars


The examples in the master branch (as opposed to the gtkmm-3-24 branch) 
are for gtkmm4, which is still very unstable, and not always fully working.


On 2020-07-22 10:27, Carlo Wood wrote:

Hi list,

for more than a week I've been trying to find a good example, but
failed.

Can someone please point me to a "hello world" example that uses
the latest gtkmm3 standards and that has a simple menu bar with
the following content:

.---
| File | Mode
.---

Where 'File' has the entries:

  Open, Save, Quit

and 'Mode' has the entries:

  'Edit position'
  'Edit game'
  --separator--
  'Show candidates'


I could explain where I all searched and what I all found and
why that doesn't explain how to do this etc, but well. All I
want is just a working example :(.

Thanks,
Carlo
___
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


Please help

2020-07-22 Thread Carlo Wood
Hi list,

for more than a week I've been trying to find a good example, but
failed.

Can someone please point me to a "hello world" example that uses
the latest gtkmm3 standards and that has a simple menu bar with
the following content:

.---
| File | Mode
.---

Where 'File' has the entries:

 Open, Save, Quit

and 'Mode' has the entries:

 'Edit position'
 'Edit game'
 --separator--
 'Show candidates'


I could explain where I all searched and what I all found and
why that doesn't explain how to do this etc, but well. All I
want is just a working example :(.

Thanks,
Carlo
___
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


please help me install gtkmm-dev in my linux system

2012-11-05 Thread Dmitry Kruglov
Hi all.

I found new linux (alternative Ubuntu), last kernel and gnome 2. 
http://www.fuduntu.org/
This Linux super, but I do not know how to put the library gtkmm. I previously 
used ubuntu 10.10 (deb) , and now rpm (Fedora).

what files I need to install to use glade and gtkmm? I want to try to write in 
gtkmm 2.4 and gtkmm 3.
This Linux has the right package and where to take the packages, I do not know. 
I spent two days on the search for packages, but I was unable to find glade and 
gtkmm.
Some of the packages are installed, some packages are not installed as is not 
the same version.
maybe someone can help me?
I was tired and lost all power. I do not want to go back to ubuntu.

Please help me.
Thank you.

___
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


RE: please help me install gtkmm-dev in my linux system

2012-11-05 Thread Tilton, James C. (GSFC-6063)
Dmitry,



I built gtkmm 2.4 last Spring on a CentOS release 5.8 system. I hope that the 
attached notes from that build will be helpful to you.



Jim Tilton


Dr. James C. TiltonVoice:   
301-286-9510
NASA Goddard Space Flight Center   FAX: 301-286-1776
Mail Code 606.3E-Mail:  
james.c.til...@nasa.govmailto:james.c.til...@nasa.gov
(Computational  Information Sciences and Technology Office)
Greenbelt, MD 20771
URLs:  http://ipp.gsfc.nasa.gov/ft_tech_rhseg.shtm, 
http://science.gsfc.nasa.gov/606.3/TILTON/ and
https://powellcenter.usgs.gov/globalcroplandwater/.




-Original Message-
From: gtkmm-list-boun...@gnome.org [mailto:gtkmm-list-boun...@gnome.org] On 
Behalf Of Dmitry Kruglov
Sent: Monday, November 05, 2012 3:53 AM
To: gtkmm list
Subject: please help me install gtkmm-dev in my linux system



Hi all.



I found new linux (alternative Ubuntu), last kernel and gnome 2. 
http://www.fuduntu.org/ This Linux super, but I do not know how to put the 
library gtkmm. I previously used ubuntu 10.10 (deb) , and now rpm (Fedora).



what files I need to install to use glade and gtkmm? I want to try to write in 
gtkmm 2.4 and gtkmm 3.

This Linux has the right package and where to take the packages, I do not know. 
I spent two days on the search for packages, but I was unable to find glade and 
gtkmm.

Some of the packages are installed, some packages are not installed as is not 
the same version.

maybe someone can help me?

I was tired and lost all power. I do not want to go back to ubuntu.



Please help me.

Thank you.



___

gtkmm-list mailing list

gtkmm-list@gnome.orgmailto:gtkmm-list@gnome.org

https://mail.gnome.org/mailman/listinfo/gtkmm-list
Notes for building gtkmm-2.4 on CentOS release 5.8 (Final 
release)

(To skip to the actual build notes, search for Building the software)

Obtained gtkmm-2.24.2.tar.xz (or gtkmm-2.24.2.tar.bz2) from 
http://ftp.gnome.org/pub/GNOME/sources/gtkmm/2.24/

Prerequisites for gtkmm-2.24.2:

giomm-2.4 version 2.24 or higher
pangomm-1.4 version 2.27.1 or higher
gtk+-2.0 version 2.24.0 or higher

NOTE: giomm-2.4 is contained in glibmm-2.4, so glibmm-2.4 version 2.24 or 
higher is required.

Decided to install glibmm-2.28.2: obtained glibmm-2.28.2.tar.xz from 
http://ftp.gnome.org/pub/GNOME/sources/glibmm/2.28/

Prerequisites for glibmm-2.28.2:

libsigc++-2.2.10
glib-2.0 version 2.28.0 or higher
gobject-2.0 version 2.28.0 or higher,
gmodule-2.0 version 2.28.0 or higher.

NOTE: gobject-2.0 and gmodule-2.0 are in glib-2.0

Decided to install pangomm-1.4 version 2.28.2: obtained pango-2.28.2.tar.gz 
from http://ftp.gnome.org/pub/GNOME/sources/pangomm/2.28/

Prerequisites for pangomm-1.4 version 2.28.2:

glibmm-2.4 version 2.14.1 or higher
cairomm-1.0 version 1.2.2 or higher,
pangocairo version 1.23.0 or higher (in pango)

Decided to install cairomm-1.0 version 1.10.0: obtained cairomm-1.10.0.tar.gz 
from http://cairographics.org/releases/

Prerequisites for cairomm-1.0 version 1.10.0:

cairo version 1.10.0 or higher
libsigc++-2.2.10

Decided to install gtk+-2.0 version 2.24.5: obtained gtk+-2.24.5.tar.gz from 
http://ftp.gnome.org/pub/GNOME/sources/gtk+/2.24/

Prerequisites for gtk+-2.0 version 2.24.5:

glib-2.0 version 2.27.3 or higher
atk version 1.29.2 or higher, 
pango version 1.20 or higher, 
cairo version 1.6 or higher and 
gdk-pixbuf-2.0 version 2.21.0 or higher.

Decided to install cairo version 1.10.2: obtained from cairo-1.10.2.tar.gz from 
http://cairographics.org/releases/

Prerequisites for cairo version 1.10.2:

cairo-1.10.2 needs pixman-1 version 0.18.4 or higher
NOTE: cairo-1.10.2 optionally needs poppler version 0.13.3 or higher and 
librsvg version 2.15.0 or higher

Decided to install poppler version 0.20.2: obtained poppler-0.20.2.tar.gz from 
http://poppler.freedesktop.org/releases.html

Prerequisites for poppler version 0.20.2:

cairo version 1.10.0 or higher
Also can use zlib, libcurl, libopenjpeg

Decided to install librsvg version 2.36.1: obtained librsvg-2.36.1.tar.gz from 
http://ftp.gnome.org/pub/GNOME/sources/librsvg/2.36/

Prerequisites for librsvg version 2.36.1:

gdk-pixbuf version 1.3.7 or higher,
glib-2.0 version 2.12.0 or higher,
pangocairo version 1.16.0 or higher,
cairo version 1.2.0 or higher, 
libxml-2.0 version 2.7.0 or higher,
gio-2.0 version 2.24.0 or higher and 
libcroco-0.6 version 0.6.1 or higher

Decided to install pango version 1.29.3: obtained pango-1.29.3.tar.gz from 
http://ftp.gnome.org/pub/GNOME/sources/pango/1.29/

Prerequisites for pango version 1.29.3:

pango-1.29.3 needs glib version 2.26.0 or higher

Decided to install atk version 2.0.1: obtained atk-2.0.1.tar.gz from 
http://ftp.gnome.org/pub/GNOME/sources/atk/2.0/

Prerequisites for atk version 2.0.1:

Requires glib version 2.0.0 or higher

Decided

Subject: Gdk::Drawable::draw_image problem please help

2009-03-05 Thread smso
You should do all the drawings on a Gdk::Pixmap (an offscreen drawable) 
and then copy its contents to the Gdk::Window of, say, the drawingarea 
in the on_expose_event callback, e.g.

bool MyDrawingArea::on_expose_event(GdkEventExpose *event)
{
get_window()-draw_drawable
(
get_style()-get_fg_gc(get_state()),
pixmap,
event-area.x, event-area.y,
event-area.x, event-area.y,
event-area.width, event-area.height
);

return false;
}

Best regard,
smso


___
gtkmm-list mailing list
gtkmm-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtkmm-list


Gdk::Drawable::draw_image problem please help

2009-03-03 Thread Rocky Marrone
Hi, All

I am a newbie to gtkmm, and i want to draw an image(test.jpg) with the
help of draw_image of Gdk::Drawable.

   Please any body can help me out to give me the sample application to draw
an image test.jpg with the help of Gdk::Drawable::draw_image or
draw_gray_image.

Thnx in advance :)
Thnx  Best Regards
Rocky
___
gtkmm-list mailing list
gtkmm-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtkmm-list


Please Help Me

2008-10-28 Thread inbox_pub

The following program produces a yellow window.
I am trying to interface a trigger function to change the color and
I have not been successful.

How do I change the color after the window is displayed?

-- 


#include gtkmm.h


class Example : public Gtk::Window
{
public:
  Example();
  virtual ~Example();

protected:
  virtual void on_button_quit();

  Gtk::VBox mc_VBox;

  Gtk::HBox mc_HBox;

  Gdk::Color m_Color_Black, m_Color_Red, m_Color_Green, 
m_Color_Yellow;


  Gtk::EventBox m_Light1, m_Light2, m_Light3;

};


Example::Example()
{
  m_Color_Red.set_rgb_p(0.99, 0.00, 0.00);
  m_Color_Yellow.set_rgb_p(0.99, 0.99, 0.00);
  m_Color_Green.set_rgb_p(0.00, 0.99, 0.00);
  m_Color_Black.set_rgb_p(0.00, 0.00, 0.00);


  add(mc_HBox);

  mc_HBox.pack_start(mc_VBox, Gtk::PACK_SHRINK, 0);

  m_Light1.modify_bg(Gtk::STATE_NORMAL, m_Color_Yellow);

  m_Light1.set_size_request(400, 300);

  mc_HBox.add(m_Light1);

  show_all_children();
}


int main(int argc, char *argv[])
{
  Gtk::Main kit(argc, argv);

  Example window;

  Gtk::Main::run(window);

return 0;
}


Example::~Example()
{
}


void Example::on_button_quit()
{
hide();
}

-- 


___
gtkmm-list mailing list
gtkmm-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtkmm-list


Re: Please Help Me

2008-10-28 Thread John Hobbs
Are you wanting it to change color when you click on it? Or do you have a
button? Or a timeout?

If you want it to change on click do something like...

Example::Example()
{
 m_Color_Red.set_rgb_p(0.99, 0.00, 0.00);
 m_Color_Yellow.set_rgb_p(0.99, 0.99, 0.00);
 m_Color_Green.set_rgb_p(0.00, 0.99, 0.00);
 m_Color_Black.set_rgb_p(0.00, 0.00, 0.00);


 add(mc_HBox);

 mc_HBox.pack_start(mc_VBox, Gtk::PACK_SHRINK, 0);

 m_Light1.modify_bg(Gtk::STATE_NORMAL, m_Color_Yellow);

 m_Light1.set_size_request(400, 300);


m_Light1.signal_button_release_event().connect(sigc::mem_fun(*this,Example::onClickMLight1));

 mc_HBox.add(m_Light1);

 show_all_children();
}

void Example::onClickMLight1 () {
 m_Light1.modify_bg(Gtk::STATE_NORMAL, m_Color_Green);
}

Does that help any?

- John Hobbs

[EMAIL PROTECTED]
___
gtkmm-list mailing list
gtkmm-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtkmm-list


Re: Please Help Me

2008-10-28 Thread inbox_pub




Thank you, John, for your reply!
I already have a program that monitors the creation and close of files
in a specific directory.
I want to read the message from a pipe between the GUI and the monitor
program and
based on the output, change the color of the window (light). Therefore,
after it is initially 
displayed in yellow, it can be changed to different colors.

I understand how to make it change based on a button click. I guess
that this is more how to connect
outside logic to the GUI that I have written. I just don't quite
understand.
--


John Hobbs wrote:
Are you wanting it to change color when you click on
it? Or do you have a button? Or a timeout?
  
If you want it to change on click do something like...
  
Example::Example()
{
  m_Color_Red.set_rgb_p(0.99, 0.00, 0.00);
  m_Color_Yellow.set_rgb_p(0.99,
0.99, 0.00);

m_Color_Green.set_rgb_p(0.00, 0.99, 0.00);
  m_Color_Black.set_rgb_p(0.00, 0.00, 0.00);
  
  
  add(mc_HBox);
  
  mc_HBox.pack_start(mc_VBox, Gtk::PACK_SHRINK, 0);
  
  m_Light1.modify_bg(Gtk::STATE_NORMAL, m_Color_Yellow);
  
  m_Light1.set_size_request(400, 300);
  
 
m_Light1.signal_button_release_event().connect(sigc::mem_fun(*this,Example::onClickMLight1));
  
  mc_HBox.add(m_Light1);
  
  show_all_children();
}
  
  
void Example::onClickMLight1 () {
  m_Light1.modify_bg(Gtk::STATE_NORMAL, m_Color_Green);
}
  
Does that help any?
  
- John Hobbs
  
  [EMAIL PROTECTED]
  
  
-- 


#include gtkmm.h





class Example : public Gtk::Window

{

public:

 Example();

 virtual ~Example();



protected:

 virtual void on_button_quit();



 Gtk::VBox mc_VBox;



 Gtk::HBox mc_HBox;



 Gdk::Color m_Color_Black, m_Color_Red, m_Color_Green, 
m_Color_Yellow;



 Gtk::EventBox m_Light1, m_Light2, m_Light3;



};





Example::Example()

{

 m_Color_Red.set_rgb_p(0.99, 0.00, 0.00);

 m_Color_Yellow.set_rgb_p(0.99, 0.99, 0.00);

 m_Color_Green.set_rgb_p(0.00, 0.99, 0.00);

 m_Color_Black.set_rgb_p(0.00, 0.00, 0.00);





 add(mc_HBox);



 mc_HBox.pack_start(mc_VBox, Gtk::PACK_SHRINK, 0);



 m_Light1.modify_bg(Gtk::STATE_NORMAL, m_Color_Yellow);



 m_Light1.set_size_request(400, 300);



 mc_HBox.add(m_Light1);



 show_all_children();

}





int main(int argc, char *argv[])

{

 Gtk::Main kit(argc, argv);



 Example window;



 Gtk::Main::run(window);



return 0;

}





Example::~Example()

{

}





void Example::on_button_quit()

{

hide();

}



-- 


___
gtkmm-list mailing list
gtkmm-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtkmm-list





___
gtkmm-list mailing list
gtkmm-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtkmm-list


WebKit and Viewports - please help

2008-06-24 Thread Phoenix Revived
Hi,
I am trying to include WebKit in my gtkmm app. I would like to be able to 
scroll the web page from within my app rather than by using mouse or keyboard.

I have tried adding the WebView object to both Gtk::ScrolledWindow and to 
Gtk::Viewport (separate experiments). In both cases, the WebView is rendered 
correctly, and I can scroll by either dragging in the page or by moving the 
sliders.

However, I probably don't understand how Gtk:Adjustments work. The following 
produces no results:

m_ScrolledWindow-get_vadjustment()-set_value(come_value);

What am I doing wrong?



  
___
gtkmm-list mailing list
gtkmm-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtkmm-list