Send gtkmm-list mailing list submissions to
gtkmm-list gnome org
To subscribe or unsubscribe via the World Wide Web, visit
http://mail.gnome.org/mailman/listinfo/gtkmm-list
or, via email, send a message with subject or body 'help' to
gtkmm-list-request gnome org
You can reach the person managing the list at
gtkmm-list-owner gnome org
When replying, please edit your Subject line so it is more specific
than "Re: Contents of gtkmm-list digest..."
Today's Topics:
1. Multithreaded Drawing (Talguy)
2. ListStore problem (Ugur Arpaci)
----------------------------------------------------------------------
Message: 1
Date: Fri, 27 Aug 2010 14:23:52 -0400
From: Talguy <talguy385 gmail com>
To: Gtkmm Mailing List <gtkmm-list gnome org>
Subject: Multithreaded Drawing
Message-ID:
<AANLkTimJNXR=6H7464WokUSnOxKkn_L4SG4Wu5003G9Z mail gmail com>
Content-Type: text/plain; charset="iso-8859-1"
I am trying to work out how to set up my multithreaed drawing app of
real-time data. I was think that I could run to main loops. One in the
main gtkmm thread and a glib::mainloop in my worker thread. The worker
thread would have a timeout signal that fires 30 times a second and draws
the new screen to a buffer. Once drawing is done it would it would fire off
a dispatcher signal to the main thread where it draws the buffer to the
screen. would this be the right way going about doing this and if so does
anyone have a quick example on how to accomplish this since I am more book
smart then practical
Talguy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.gnome.org/archives/gtkmm-list/attachments/20100827/84e4f079/attachment.html>
------------------------------
Message: 2
Date: Sat, 28 Aug 2010 01:18:22 +0200
From: Ugur Arpaci <ugurarpaci gmail com>
To: gtkmm-list gnome org
Subject: ListStore problem
Message-ID:
<AANLkTinyFUD3ZYQgQ450DGAEk1UgBN+NRr5FA21iPpSo mail gmail com>
Content-Type: text/plain; charset="utf-8"
Hi everyone;
With the following source code, i tried to obtain a scroll panel that
includes list store, but i wanted to create only rows in that List Store.
There is a problem here, this code generates one row and one column at the
same time, i want only rows though.
Can anyone check this please?
class showCurrentAppointments : public Gtk::Window
{
public:
showCurrentAppointments();
virtual ~showCurrentAppointments();
Gtk::TreeModelColumnRecord myColumn;
protected:
void quit_button_clicked();
void save_button_clicked();
Gtk::VButtonBox buttonBox;
Gtk::VBox List,Button;
Gtk::Button closeCurrentApp;
//Tree model columns:
class ModelColumns : public Gtk::TreeModel::ColumnRecord
{
public:
ModelColumns()
{ add(colId);
add(colName);
add(colSurname);
add(colAge);
add(colEmail);
add(colMobile);
add(colDate);
}
Gtk::TreeModelColumn<unsigned int> colId;
Gtk::TreeModelColumn<Glib::ustring> colName;
Gtk::TreeModelColumn<Glib::ustring> colSurname;
Gtk::TreeModelColumn<Glib::ustring> colAge;
Gtk::TreeModelColumn<Glib::ustring> colEmail;
Gtk::TreeModelColumn<Glib::ustring> colMobile;
Gtk::TreeModelColumn<Glib::ustring> colDate;
};
ModelColumns mColumns;
Gtk::ScrolledWindow infoScrolled;
Gtk::TreeView refTreeView;
Glib::RefPtr<Gtk::ListStore> refTreeModel;
};
showCurrentAppointments::showCurrentAppointments():
closeCurrentApp(Gtk::Stock::QUIT)
{
set_title("Current Appointments");
set_default_size(1024,768);
set_resizable(true);
set_border_width(10);
refTreeModel = Gtk::ListStore::create(mColumns);
refTreeView.set_model(refTreeModel);
infoScrolled.add(refTreeView);
infoScrolled.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
infoScrolled.set_size_request(800,600);
List.pack_start(infoScrolled);
ifstream out("Appointment1.txt", ios::app);
string sName,sSurname,sAge,sEmail,sMobile,sDate;
if(!out){
std::cout<<"File cannot be opened\n";
exit(2);
}
char ch;
int order=1;
int colid=1;
char listBuffer[40];
int flagBuf=0;
for(int internal=0;internal<40;internal++)
{
if(internal==40)
listBuffer[internal]='\0';
else
listBuffer[internal]=' ';
}
Gtk::TreeModel::Row row;
do{
out.get(ch);
if(order==1){
if(ch=='\t'){
sName=listBuffer;
order++;
flagBuf=0;
for(int internal=0;internal<40;internal++)
{
if(internal==40)
listBuffer[internal]='\0';
else
listBuffer[internal]=' ';
}
}
else{
listBuffer[flagBuf]=ch;
flagBuf++;}
}
else if(order==2){
if(ch=='\t'){
sSurname=listBuffer;
order++;
flagBuf=0;
for(int internal=0;internal<40;internal++)
{if(internal==40)
listBuffer[internal]='\0';
else
listBuffer[internal]=' ';
}
}
else{
listBuffer[flagBuf]=ch;
flagBuf++;
}
}
else if(order==3){
if(ch=='\t'){
sAge=listBuffer;
order++;
flagBuf=0;
for(int internal=0;internal<40;internal++)
{if(internal==40)
listBuffer[internal]='\0';
else
listBuffer[internal]=' ';
}
}
else{
listBuffer[flagBuf]=ch;
flagBuf++;
}
}
else if(order==4){
if(ch=='\t'){
sEmail=listBuffer;
order++;
flagBuf=0;
for(int internal=0;internal<40;internal++)
{if(internal==40)
listBuffer[internal]='\0';
else
listBuffer[internal]=' ';
}
}
else{
listBuffer[flagBuf]=ch;
flagBuf++;
}
}
else if(order==5){
if(ch=='\t'){
sMobile=listBuffer;
order++;
flagBuf=0;
for(int internal=0;internal<40;internal++)
{if(internal==40)
listBuffer[internal]='\0';
else
listBuffer[internal]=' ';
}
}
else{
listBuffer[flagBuf]=ch;
flagBuf++;
}
}
else if(order==6){
if(ch=='\n'){
sDate=listBuffer;
order=1;
flagBuf=0;
for(int internal=0;internal<40;internal++)
{if(internal==40)
listBuffer[internal]='\0';
else
listBuffer[internal]=' ';
}
row = *(refTreeModel->append());
row[mColumns.colId]=colid;
row[mColumns.colAge]=sAge;
row[mColumns.colName]=sName;
row[mColumns.colSurname]=sSurname;
row[mColumns.colEmail]=sEmail;
row[mColumns.colDate]=sDate;
row[mColumns.colMobile]=sMobile;
refTreeView.append_column("Number",mColumns.colId);
refTreeView.append_column("Name",mColumns.colName);
refTreeView.append_column("Surname",mColumns.colSurname);
refTreeView.append_column("Age",mColumns.colAge);
refTreeView.append_column("Mobile",mColumns.colMobile);
refTreeView.append_column("Date",mColumns.colDate);
colid++;
}
else{
listBuffer[flagBuf]=ch;
flagBuf++;
}
}
}while(out);
out.close();
for(int i = 0; i < 5; i++)
{
Gtk::TreeView::Column* pColumn = refTreeView.get_column(i);
pColumn->set_reorderable();
}
buttonBox.pack_start(closeCurrentApp,Gtk::PACK_SHRINK);
Button.pack_start(List,Gtk::PACK_SHRINK);
Button.pack_start(buttonBox,Gtk::PACK_SHRINK);
add(Button);
closeCurrentApp.signal_clicked().connect(sigc::mem_fun(*this,
&showCurrentAppointments::quit_button_clicked) );
show_all_children();
}
showCurrentAppointments::~showCurrentAppointments(){
}
void showCurrentAppointments::quit_button_clicked(){
hide();
}
--
U?ur ARPACI
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.gnome.org/archives/gtkmm-list/attachments/20100828/ac27acca/attachment.html>
------------------------------
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list
End of gtkmm-list Digest, Vol 76, Issue 27
******************************************
Attachment:
Screenshot-1.png
Description: PNG image