Gtk_MessageBox
| From: | Christian Weiske | Date: | Fri, 29 Oct 2004 21:39:11 +0000 |
| Subject: | Gtk_MessageBox | ||
| Groups: | php.gtk.dev | ||
| Request: | Send a blank email to php-gtk-dev+get-764@lists.php.net to get a copy of this message | ||
Hi
Some might know that there are several MessageBox classes for php-gtk flouncing around the web. I think mine was the first one, Alan adopted it for one of his projects, Nathan did another one...
I think it's time to get a PEAR msgbox, and I'm currently collecting ideas for the class
- Must display text, title and icon :)
- Enable different buttons, with some standard ones being hardcoded (Ok, Yes/No, Yes/No/Cancel, Abort/Retry/Ignore, ....) but keep the option to define own ones
- Default selected button
- Standard icons should be provided: Question, Information, Error, Warning
- A "don't ask/show this any more" checkbox would be nice
- One-line call: No need to instantiate something, just call "$nAnswer = Gtk_MessageBox( 'hello', 'test);"
Now the things I'm pondering with:
- The java message box classes have the option for a text entry box (JOptionPane.showInputDialog). Would this fit in the class, or should that be a different one?
- RTL/LTR support (icon on the left or right side), is there a setting in a standard location which could be read easily (php config or so)
- Icons: Have four icons vs. Have four icons for every operating system (windows icons are very different from gtk/kde ones). What to implement?
- Make text alignment options sense? (left/center/right)
- How to pass the parameters? In VC++, you have three params: Text, title and options with "options" being a sum of options (int). My current implementation uses this, but somebody indicated some years ago that that's too C'ish. But how to pass a number of parameters in a really easy way?
- How to return the "don't ask/show this any more" setting - the pressed button has to be returned as well. Array makes no sense, as one had to expect an array always - equals if the "don't ask" feature is used. It would be possible to return an int if no "don't ask" is used, and an array with "button" and "dontask" values if it's used. Is that good style? Don't really think so.
- Are int values ok for standard button returns? My current class uses constants like IDYES, IDNO and IDCANCEL.
- If text input is ok, how to pass the inputted text back? array? (selected button has to be returned as well)
- Is it allowed in PEAR to have functions outside a class?
I think Abort/retry/ignore can be left out, it's a relict from my Visual C++ times...
Regards/MfG,
Christian Weiske
--
XMMS is playing now:
Juli - Tränenschwer