Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2004:
[Freeciv-Dev] Xaw: common dialog model
Home

[Freeciv-Dev] Xaw: common dialog model

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Xaw: common dialog model
From: Egor Vyscrebentsov <evyscr@xxxxxxxxx>
Date: Sun, 5 Dec 2004 02:41:38 +0300

Good daytime!

Last several months i learnt xaw clien code. Not that i know it now...
But i understand one thing: there are so many variants of coding common
things in xaw client nowadays.
Working with several tickets i have to create new dialogs. I looked into
code and can't find answer, how i should create dialog right. So, i wanted
to write several rules for me.
Below is the start of this rules. I think, i can't go on until making
several main decisions. So, i ask for you comments, suggestions, rejections.

Thanks, evyscr.

Xaw client
===========================================================================
Dialogs (Common dialog model)
===========================================================================
Common variables:

- <dialog-name>_dialog_shell   - dialog shell; Widget
- <dialog-name>_form   - dialog form; Widget
- <dialog-name>_<command-name>_command   - buttons etc
- <dialog-name>_dialog_shell_is_raised   - bool variable. Indicates modal state
                                           of dialog

Common functions:

- popup_<dialog-name>_dialog()
- popdown_<dialog-name>_dialog()
- create_<dialog-name>_dialog()
- update_<dialog-name>_dialog()
- <dialog-name>_<command-name>_callback()  - buttons callbacks

- <...>_msg_close() (for players dialog it is plrdlg_msg_close()) -
                    callback for closing dialog shell

-------
City Dialog is a struct, don't know is it good or not.

Q: What about "Common comments"? ;) There should be similar comments
   for popup_dialog, popdown_dialog, create_dialog and update_dialog.
   My english is not so good to make them, however...

-----------------
popup_<dialog-name>_dialog() (and possibly create_<dialog-name>_dialog()) should
have a parameter 'raise' (or 'make_modal'). Now not all dialogs have it.

In modal dialogs 'XtSetSensitive(main_form, FALSE)' should be
called _after_ creating the dialog (in popup_dialog())
and 'XtSetSensitive(main_form, FALSE)' - _before_ freeing
(in popdown_dialog())

Q: Are there any dialogs that should be only modal? What are they?

Q: Should 'xaw_set_relative_position()' be called at every popup, or only
   at creating dialog?

Every dialog should have an action on closing it by window manager (x) button.
<dialog-name>_dialog_msg_close() is used for callback. (See also 'actions.c')
In common case, it should be equal to clicking 'Cancel' button.



[Prev in Thread] Current Thread [Next in Thread]