User:Ghost.jat
<lang Php> <?php
include "php\\winbinder.php";
// STEP 1: Create main window
$mainwin = wb_create_window(NULL, AppWindow, "Five steps", 320, 240);
// STEP 2: Create controls for the main window Geometry data Id
wb_create_control($mainwin, PushButton, "Button 1", 50, 70, 80, 22, 101); wb_create_control($mainwin, PushButton, "Button 2", 180, 70, 80, 22, 102);
// STEP 3: Create a handler function to process the controls (see below).
// STEP 4: Assign the handler function to the main window.
wb_set_handler($mainwin, "process_main");
// STEP 5: Enter application loop
wb_main_loop();
// The handler function from step 3
function process_main($window, $id) {
switch($id) {
case 101: case 102: wb_message_box($window, "Button #$id was pressed."); break;
case IDCLOSE: // The constant IDCLOSE is predefined wb_destroy_window($window); // Destroy the window break; }
}</lang>
<lang php> <?php
if (!extension_loaded('wxwidgets')) {
dl('wxwidgets.' . PHP_SHLIB_SUFFIX);
}
class Myframe extends wxFrame {
function __construct() { parent::__construct(null, wxID_ANY, 'splitterWindow.php', wxDefaultPosition, new wxSize(350, 300)); $splitter = new wxSplitterWindow($this); $panel_1 = new wxPanel($splitter); new wxStaticText($panel_1, wxID_ANY, " Whether you think that you can,
or that you can't,you are usually right.\n\nHenry Ford", new wxPoint(100, 100), wxDefaultSize, wxALIGN_CENTRE);
$panel_1->SetBackgroundColour(wxLIGHT_GREY); $panel_2 = new wxPanel($splitter); $panel_2->SetBackgroundColour(wxWHITE); $splitter->SplitVertically($panel_1, $panel_2); $this->Centre(); }
}
class app extends wxApp {
function OnInit() { $app = new Myframe(); $app->Show(); $this->frm = $app; return true; }
function OnExit() { return false; }
}
wxInitAllImageHandlers(); $app = new app(); wxApp::SetInstance($app); wxEntry();</lang>
<lang php> <?php $menu = new GtkMenu(); $echo1 = new GtkMenuItem('Echo 1'); $echo1->connect_simple('activate', 'doEcho', 'echo1'); $menu->append($echo1); $echo2 = new GtkMenuItem('Echo 2'); $echo2->connect_simple('activate', 'doEcho', 'echo2'); $menu->append($echo2); $menu->show_all(); function doEcho($message) { echo $message . "\r\n"; } function doPopup($window, $event, $menu){ if ($event->button == 3) { //popup the menu $menu->popup(); } } //Create a normal window $wnd = new GtkWindow(); $wnd->set_events($wnd->get_events() | Gdk::BUTTON_PRESS_MASK); $wnd->connect('button-press-event', 'doPopup', $menu); $wnd->connect_simple('destroy', array('Gtk', 'main_quit')); $wnd->show_all(); Gtk::main();</lang>