Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
a1c21329
Commit
a1c21329
authored
Jan 17, 2007
by
claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New modal dialog
parent
f1a9bfe3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
113 additions
and
5 deletions
+113
-5
src/lib/co/gtk/co_wow_gtk.cpp
src/lib/co/gtk/co_wow_gtk.cpp
+97
-1
src/lib/co/gtk/co_wow_gtk.h
src/lib/co/gtk/co_wow_gtk.h
+3
-1
src/lib/co/src/co_wow.h
src/lib/co/src/co_wow.h
+13
-3
No files found.
src/lib/co/gtk/co_wow_gtk.cpp
View file @
a1c21329
/**
* Proview $Id: co_wow_gtk.cpp,v 1.
2 2007-01-11 11:40:30
claes Exp $
* Proview $Id: co_wow_gtk.cpp,v 1.
3 2007-01-17 10:27:06
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -828,6 +828,102 @@ char *CoWowGtk::translate_utf8( char *str)
return
result
;
}
static
void
modaldia_button1_cb
(
GtkWidget
*
w
,
gpointer
data
)
{
*
(
int
*
)
data
=
wow_eModalDialogReturn_Button1
;
gtk_main_quit
();
}
static
void
modaldia_button2_cb
(
GtkWidget
*
w
,
gpointer
data
)
{
*
(
int
*
)
data
=
wow_eModalDialogReturn_Button2
;
gtk_main_quit
();
}
static
void
modaldia_button3_cb
(
GtkWidget
*
w
,
gpointer
data
)
{
*
(
int
*
)
data
=
wow_eModalDialogReturn_Button3
;
gtk_main_quit
();
}
static
gboolean
modaldia_delete_event
(
GtkWidget
*
w
,
GdkEvent
*
event
,
gpointer
data
)
{
*
(
int
*
)
data
=
wow_eModalDialogReturn_Deleted
;
gtk_main_quit
();
return
TRUE
;
}
int
CoWowGtk
::
CreateModalDialog
(
char
*
title
,
char
*
text
,
char
*
button1
,
char
*
button2
,
char
*
button3
,
char
*
image
)
{
int
status
=
0
;
GtkWidget
*
image_w
;
pwr_tFileName
fname
;
// Create a question window
GtkWidget
*
dialog_w
=
(
GtkWidget
*
)
g_object_new
(
GTK_TYPE_WINDOW
,
"default-height"
,
150
,
"default-width"
,
400
,
"title"
,
title
,
"window-position"
,
GTK_WIN_POS_CENTER
,
NULL
);
g_signal_connect
(
dialog_w
,
"delete_event"
,
G_CALLBACK
(
modaldia_delete_event
),
&
status
);
GtkWidget
*
text_w
=
gtk_label_new
(
text
);
if
(
image
)
{
dcli_translate_filename
(
fname
,
image
);
image_w
=
gtk_image_new_from_file
(
fname
);
}
if
(
!
image
)
{
image_w
=
(
GtkWidget
*
)
g_object_new
(
GTK_TYPE_IMAGE
,
"stock"
,
GTK_STOCK_DIALOG_QUESTION
,
"icon-size"
,
GTK_ICON_SIZE_DIALOG
,
"xalign"
,
0.5
,
"yalign"
,
1.0
,
NULL
);
}
GtkWidget
*
hboxtext
=
gtk_hbox_new
(
FALSE
,
0
);
gtk_box_pack_start
(
GTK_BOX
(
hboxtext
),
image_w
,
FALSE
,
FALSE
,
15
);
gtk_box_pack_start
(
GTK_BOX
(
hboxtext
),
text_w
,
TRUE
,
TRUE
,
15
);
GtkWidget
*
hboxbuttons
=
gtk_hbox_new
(
TRUE
,
40
);
if
(
button1
)
{
GtkWidget
*
button1_w
=
gtk_button_new_with_label
(
translate_utf8
(
button1
));
gtk_widget_set_size_request
(
button1_w
,
-
1
,
25
);
g_signal_connect
(
button1_w
,
"clicked"
,
G_CALLBACK
(
modaldia_button1_cb
),
&
status
);
gtk_box_pack_start
(
GTK_BOX
(
hboxbuttons
),
button1_w
,
FALSE
,
FALSE
,
0
);
}
if
(
button2
)
{
GtkWidget
*
button2_w
=
gtk_button_new_with_label
(
translate_utf8
(
button2
));
gtk_widget_set_size_request
(
button2_w
,
-
1
,
25
);
g_signal_connect
(
button2_w
,
"clicked"
,
G_CALLBACK
(
modaldia_button2_cb
),
&
status
);
gtk_box_pack_start
(
GTK_BOX
(
hboxbuttons
),
button2_w
,
FALSE
,
FALSE
,
0
);
}
if
(
button3
)
{
GtkWidget
*
button3_w
=
gtk_button_new_with_label
(
translate_utf8
(
button3
));
gtk_widget_set_size_request
(
button3_w
,
-
1
,
25
);
g_signal_connect
(
button3_w
,
"clicked"
,
G_CALLBACK
(
modaldia_button3_cb
),
&
status
);
gtk_box_pack_end
(
GTK_BOX
(
hboxbuttons
),
button3_w
,
FALSE
,
FALSE
,
0
);
}
GtkWidget
*
vbox
=
gtk_vbox_new
(
FALSE
,
0
);
gtk_box_pack_start
(
GTK_BOX
(
vbox
),
hboxtext
,
TRUE
,
TRUE
,
30
);
gtk_box_pack_start
(
GTK_BOX
(
vbox
),
gtk_hseparator_new
(),
FALSE
,
FALSE
,
0
);
gtk_box_pack_end
(
GTK_BOX
(
vbox
),
hboxbuttons
,
FALSE
,
FALSE
,
15
);
gtk_container_add
(
GTK_CONTAINER
(
dialog_w
),
vbox
);
gtk_widget_show_all
(
dialog_w
);
gtk_main
();
gtk_widget_destroy
(
dialog_w
);
return
status
;
}
...
...
src/lib/co/gtk/co_wow_gtk.h
View file @
a1c21329
/**
* Proview $Id: co_wow_gtk.h,v 1.
1 2007-01-04 07:51:41
claes Exp $
* Proview $Id: co_wow_gtk.h,v 1.
2 2007-01-17 10:27:06
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -101,6 +101,8 @@ class CoWowGtk : public CoWow {
void
CreateFileSelDia
(
char
*
title
,
void
*
parent_ctx
,
void
(
*
file_selected_cb
)(
void
*
,
char
*
,
wow_eFileSelType
),
wow_eFileSelType
file_type
);
int
CreateModalDialog
(
char
*
title
,
char
*
text
,
char
*
button1
,
char
*
button2
,
char
*
button3
,
char
*
image
);
int
DisplayWarranty
();
void
DisplayLicense
();
CoWowTimer
*
timer_new
();
...
...
src/lib/co/src/co_wow.h
View file @
a1c21329
/**
* Proview $Id: co_wow.h,v 1.1
2 2007-01-11 11:40:30
claes Exp $
* Proview $Id: co_wow.h,v 1.1
3 2007-01-17 10:27:06
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -35,6 +35,14 @@ typedef enum {
wow_eFileSelType__
}
wow_eFileSelType
;
typedef
enum
{
wow_eModalDialogReturn_NYI
,
wow_eModalDialogReturn_Button1
,
wow_eModalDialogReturn_Button2
,
wow_eModalDialogReturn_Button3
,
wow_eModalDialogReturn_Deleted
}
wow_eMotalDialogReturn
;
class
CoWowWidget
{
};
...
...
@@ -74,8 +82,10 @@ class CoWow {
void
(
action_cb
)(
void
*
,
char
*
),
void
*
ctx
)
{
return
NULL
;}
virtual
void
CreateFileSelDia
(
char
*
title
,
void
*
parent_ctx
,
void
(
*
file_selected_cb
)(
void
*
,
char
*
,
wow_eFileSelType
),
wow_eFileSelType
file_type
)
{}
void
(
*
file_selected_cb
)(
void
*
,
char
*
,
wow_eFileSelType
),
wow_eFileSelType
file_type
)
{}
virtual
int
CreateModalDialog
(
char
*
title
,
char
*
text
,
char
*
button1
,
char
*
button2
,
char
*
button3
,
char
*
image
)
{
return
wow_eModalDialogReturn_NYI
;}
static
int
HideWarranty
();
virtual
int
DisplayWarranty
()
{
return
0
;}
virtual
void
DisplayLicense
()
{}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment