Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
zmap
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ensembl-gh-mirror
zmap
Commits
dedda175
Commit
dedda175
authored
15 years ago
by
rds
Browse files
Options
Downloads
Patches
Plain Diff
function to reparent a widget to a new toplevel - useful?
parent
df30a0ba
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/include/ZMap/zmapUtilsGUI.h
+4
-2
4 additions, 2 deletions
src/include/ZMap/zmapUtilsGUI.h
src/zmapUtils/zmapGUIutils.c
+92
-2
92 additions, 2 deletions
src/zmapUtils/zmapGUIutils.c
with
96 additions
and
4 deletions
src/include/ZMap/zmapUtilsGUI.h
+
4
−
2
View file @
dedda175
...
...
@@ -26,9 +26,9 @@
* choosers, GTK notebooks and utility functions.
*
* HISTORY:
* Last edited: J
a
n
13 14:00
2009 (
edgrif
)
* Last edited: J
u
n
8 10:11
2009 (
rds
)
* Created: Fri Nov 4 16:59:52 2005 (edgrif)
* CVS info: $Id: zmapUtilsGUI.h,v 1.3
8
2009-0
1-13 15:03:22 edgrif
Exp $
* CVS info: $Id: zmapUtilsGUI.h,v 1.3
9
2009-0
6-08 09:15:40 rds
Exp $
*-------------------------------------------------------------------
*/
#ifndef ZMAP_UTILS_GUI_H
...
...
@@ -431,6 +431,8 @@ void zMapGUIGetFontWidth(PangoFont *font, int *width_out) ;
void
zMapGUIGetPixelsPerUnit
(
ZMapGUIPixelConvType
conv_type
,
GtkWidget
*
widget
,
double
*
x
,
double
*
y
)
;
char
*
zMapGUIMakeTitleString
(
char
*
window_type
,
char
*
message
)
;
GtkWidget
*
zMapGUIPopOutWidget
(
GtkWidget
*
popout
,
char
*
title
);
void
zMapGUIShowMsg
(
ZMapMsgType
msg_type
,
char
*
msg
)
;
void
zMapGUIShowMsgFull
(
GtkWindow
*
parent
,
char
*
msg
,
ZMapMsgType
msg_type
,
GtkJustification
justify
,
int
display_timeout
,
gboolean
close_button
)
;
...
...
This diff is collapsed.
Click to expand it.
src/zmapUtils/zmapGUIutils.c
+
92
−
2
View file @
dedda175
...
...
@@ -27,9 +27,9 @@
*
* Exported functions: See ZMap/zmapUtilsGUI.h
* HISTORY:
* Last edited: J
a
n
13 14:57
2009 (
edgrif
)
* Last edited: J
u
n
8 09:33
2009 (
rds
)
* Created: Thu Jul 24 14:37:35 2003 (edgrif)
* CVS info: $Id: zmapGUIutils.c,v 1.5
4
2009-0
1-13 15:03:22 edgrif
Exp $
* CVS info: $Id: zmapGUIutils.c,v 1.5
5
2009-0
6-08 09:15:56 rds
Exp $
*-------------------------------------------------------------------
*/
...
...
@@ -50,6 +50,14 @@ typedef struct
gpointer
user_data
;
}
RadioButtonCBDataStruct
,
*
RadioButtonCBData
;
typedef
struct
{
GtkWidget
*
original_parent
;
GtkWidget
*
popout_child
;
GtkWidget
*
popout_toplevel
;
gulong
original_parent_signal_id
;
}
PopOutDataStruct
,
*
PopOutData
;
static
gboolean
modalFromMsgType
(
ZMapMsgType
msg_type
)
;
static
gboolean
messageFull
(
GtkWindow
*
parent
,
char
*
title_in
,
char
*
msg
,
gboolean
modal
,
int
display_timeout
,
gboolean
close_button
,
...
...
@@ -225,6 +233,88 @@ GtkWidget *zMapGUIToplevelNew(char *zmap_win_type, char *zmap_win_text)
return
toplevel
;
}
static
void
handle_popout_destroy_cb
(
GtkWidget
*
toplevel
,
gpointer
cb_data
)
{
PopOutData
popout_data
=
(
PopOutData
)
cb_data
;
if
(
toplevel
==
popout_data
->
popout_toplevel
)
{
if
(
popout_data
->
original_parent
)
{
g_signal_handler_disconnect
(
popout_data
->
original_parent
,
popout_data
->
original_parent_signal_id
);
gtk_widget_reparent
(
popout_data
->
popout_child
,
popout_data
->
original_parent
);
}
else
/* just free the data */
{
popout_data
->
popout_child
=
NULL
;
popout_data
->
popout_toplevel
=
NULL
;
g_free
(
popout_data
);
}
}
return
;
}
static
void
handle_original_parent_destroy_cb
(
GtkWidget
*
widget
,
gpointer
cb_data
)
{
PopOutData
popout_data
=
(
PopOutData
)
cb_data
;
popout_data
->
original_parent
=
NULL
;
gtk_widget_destroy
(
popout_data
->
popout_toplevel
);
return
;
}
/*! zMapGUIPopOutWidget
*
* \brief Simple function to reparent a widget to a new toplevel,
* complete with handlers to reparent back to original and handle
* original parent destruction.
*
* @param popout The widget to reparent
* @param title The title for the new toplevel
* @return GtkWidget *toplevel or NULL if already a direct child of a toplevel
*
*/
GtkWidget
*
zMapGUIPopOutWidget
(
GtkWidget
*
popout
,
char
*
title
)
{
GtkWidget
*
new_toplevel
=
NULL
;
GtkWidget
*
curr_toplevel
,
*
curr_parent
;
curr_parent
=
gtk_widget_get_parent
(
popout
);
curr_toplevel
=
zMapGUIFindTopLevel
(
popout
);
if
((
curr_toplevel
!=
curr_parent
)
&&
(
new_toplevel
=
zMapGUIToplevelNew
(
title
,
"close to return to original position"
)))
{
PopOutData
popout_data
;
if
((
popout_data
=
g_new0
(
PopOutDataStruct
,
1
)))
{
popout_data
->
original_parent
=
curr_parent
;
popout_data
->
popout_toplevel
=
new_toplevel
;
popout_data
->
popout_child
=
popout
;
gtk_widget_reparent
(
popout
,
new_toplevel
);
popout_data
->
original_parent_signal_id
=
g_signal_connect
(
G_OBJECT
(
curr_parent
),
"destroy"
,
G_CALLBACK
(
handle_original_parent_destroy_cb
),
popout_data
);
g_signal_connect
(
G_OBJECT
(
new_toplevel
),
"destroy"
,
G_CALLBACK
(
handle_popout_destroy_cb
),
popout_data
);
}
}
return
new_toplevel
;
}
/*!
* Shows the usual "About" window.
*
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment