示例#1
0
 function mainFrame()
 {
     parent::__construct(null, null, "Minimal wxPHP App", wxDefaultPosition, wxDefaultSize);
     $mb = new wxMenuBar();
     $mn = new wxMenu();
     $mn->Append(2, "E&xit", "Quit this program");
     $mb->Append($mn, "&File");
     $mn = new wxMenu();
     $mn->AppendCheckItem(4, "&About...", "Show about dialog");
     $mb->Append($mn, "&Help");
     $this->SetMenuBar($mb);
     $this->scite = new wxStyledTextCtrl($this);
     $this->scite->StyleClearAll();
     $this->scite->SetMarginWidth(0, 50);
     $this->scite->StyleSetForeground(wxSTC_STYLE_LINENUMBER, new wxColour(75, 75, 75));
     $this->scite->StyleSetBackground(wxSTC_STYLE_LINENUMBER, new wxColour(220, 220, 220));
     $this->scite->SetMarginType(0, wxSTC_MARGIN_NUMBER);
     $this->scite->SetWrapMode(wxSTC_WRAP_WORD);
     $this->scite->SetText("<?php\n\n\$myvar = 1 + 2;\n\nprint 'Hello World';\n\n?>\n");
     $this->scite->SetStyleBits(7);
     $this->scite->SetLexer(wxSTC_LEX_PHPSCRIPT);
     $this->scite->StyleSetForeground(wxSTC_HPHP_DEFAULT, new wxColour(0, 0, 0));
     $this->scite->StyleSetForeground(wxSTC_HPHP_HSTRING, new wxColour(255, 0, 0));
     $this->scite->StyleSetForeground(wxSTC_HPHP_SIMPLESTRING, new wxColour(255, 0, 0));
     $this->scite->StyleSetForeground(wxSTC_HPHP_WORD, new wxColour(0, 0, 155));
     $this->scite->StyleSetForeground(wxSTC_HPHP_NUMBER, new wxColour(0, 150, 0));
     $this->scite->StyleSetForeground(wxSTC_HPHP_VARIABLE, new wxColour(0, 0, 150));
     $this->scite->StyleSetForeground(wxSTC_HPHP_COMMENT, new wxColour(150, 150, 150));
     $this->scite->StyleSetForeground(wxSTC_HPHP_COMMENTLINE, new wxColour(150, 150, 150));
     $this->scite->StyleSetForeground(wxSTC_HPHP_HSTRING_VARIABLE, new wxColour(0, 0, 150));
     $this->scite->StyleSetForeground(wxSTC_HPHP_OPERATOR, new wxColour(0, 150, 0));
     $sbar = $this->CreateStatusBar(2);
     $sbar->SetStatusText("Welcome to wxPHP...");
     $this->Connect(2, wxEVT_COMMAND_MENU_SELECTED, array($this, "onQuit"));
     $this->Connect(4, wxEVT_COMMAND_MENU_SELECTED, array($this, "onAbout"));
 }
示例#2
0
文件: sample.php 项目: nwsw/wxphp
 function mainFrame()
 {
     parent::__construct(null, null, "Minimal wxPHP App", wxDefaultPosition, new wxSize(350, 260));
     /*$ico = new wxIcon();
     		$ico->CopyFromBitmap(new wxBitmap("sample.xpm",wxBITMAP_TYPE_XPM));
     		$this->SetIcon($ico);*/
     $mb = new wxMenuBar();
     $mn = new wxMenu();
     $mn->Append(2, "E&xit", "Quit this program");
     $mb->Append($mn, "&File");
     $mn = new wxMenu();
     $mn->AppendCheckItem(4, "&About...", "Show about dialog");
     $mb->Append($mn, "&Help");
     $this->SetMenuBar($mb);
     //$dummy = new wxPanel($this);
     //$sz = new wxBoxSizer(wxVERTICAL);
     $scite = new wxStyledTextCtrl($this);
     //$sz->Add($scite);
     //$dummy->SetSizer($sz);
     $sbar = $this->CreateStatusBar(2);
     $sbar->SetStatusText("Welcome to wxPHP...");
     $this->Connect(2, wxEVT_COMMAND_MENU_SELECTED, array($this, "onQuit"));
     $this->Connect(4, wxEVT_COMMAND_MENU_SELECTED, array($this, "onAbout"));
 }
示例#3
0
文件: statbar.php 项目: phpsong/wxphp
 public function __construct($title, $pos, $size)
 {
     parent::__construct(null, wxID_ANY, $title, $pos, $size);
     $this->SetIcon(new wxIcon(__DIR__ . '/sample.xpm', wxBITMAP_TYPE_XPM));
     $this->statbarPaneStyle = wxSB_NORMAL;
     $this->field = 1;
     // create a menu bar
     $menuFile = new wxMenu();
     $menuFile->Append(StatusBar_Quit, "E&xit\tAlt-X", "Quit this program");
     $statbarMenu = new wxMenu();
     $statbarStyleMenu = new wxMenu();
     $statbarStyleMenu->Append(StatusBar_SetStyleSizeGrip, "wxSTB_SIZE_GRIP", "Toggles the wxSTB_SIZE_GRIP style", true);
     $statbarStyleMenu->Append(StatusBar_SetStyleShowTips, "wxSTB_SHOW_TIPS", "Toggles the wxSTB_SHOW_TIPS style", true);
     $statbarStyleMenu->AppendSeparator();
     $statbarStyleMenu->AppendCheckItem(StatusBar_SetStyleEllipsizeStart, "wxSTB_ELLIPSIZE_START", "Toggle wxSTB_ELLIPSIZE_START style");
     $statbarStyleMenu->AppendCheckItem(StatusBar_SetStyleEllipsizeMiddle, "wxSTB_ELLIPSIZE_MIDDLE", "Toggle wxSTB_ELLIPSIZE_MIDDLE style");
     $statbarStyleMenu->AppendCheckItem(StatusBar_SetStyleEllipsizeEnd, "wxSTB_ELLIPSIZE_END", "Toggle wxSTB_ELLIPSIZE_END style");
     $statbarMenu->Append(StatusBar_SetPaneStyle, "Status bar style", $statbarStyleMenu);
     $statbarMenu->AppendSeparator();
     $statbarMenu->Append(StatusBar_SetField, "Set active field &number\tCtrl-N", "Set the number of field used by the next commands.");
     $statbarMenu->Append(StatusBar_SetText, "Set field &text\tCtrl-T", "Set the text of the selected field.");
     $statbarMenu->Append(StatusBar_PushText, "P&ush field text\tCtrl-P", "Push a message on top the selected field.");
     $statbarMenu->Append(StatusBar_PopText, "&Pop field text\tShift-Ctrl-P", "Restore the previous contents of the selected field.");
     $statbarMenu->AppendSeparator();
     $statbarMenu->Append(StatusBar_SetFields, "&Set field count\tCtrl-C", "Set the number of status bar fields");
     $statbarMenu->Append(StatusBar_SetFont, "&Set field font\tCtrl-F", "Set the font to use for status bar fields");
     $statbarPaneStyleMenu = new wxMenu();
     $statbarPaneStyleMenu->AppendCheckItem(StatusBar_SetPaneStyleNormal, "&Normal", "Sets the style of the first field to normal (sunken) look");
     $statbarPaneStyleMenu->AppendCheckItem(StatusBar_SetPaneStyleFlat, "&Flat", "Sets the style of the first field to flat look");
     $statbarPaneStyleMenu->AppendCheckItem(StatusBar_SetPaneStyleRaised, "&Raised", "Sets the style of the first field to raised look");
     $statbarMenu->Append(StatusBar_SetPaneStyle, "Field style", $statbarPaneStyleMenu);
     $statbarMenu->Append(StatusBar_ResetFieldsWidth, "Reset field widths", "Sets all fields to the same width");
     $statbarMenu->Append(StatusBar_ShowFieldsRect, "Sho&w field rectangles\tCtrl-W", "Visually show field rectangles");
     $statbarMenu->AppendSeparator();
     $statbarMenu->AppendCheckItem(StatusBar_Toggle, "&Toggle Status Bar", "Toggle the status bar display");
     $statbarMenu->Append(StatusBar_Recreate, "&Recreate\tCtrl-R", "Toggle status bar format");
     $helpMenu = new wxMenu();
     $helpMenu->Append(StatusBar_About, "&About\tCtrl-A", "Show about dialog");
     // now append the freshly created menu to the menu bar...
     $menuBar = new wxMenuBar();
     $menuBar->Append($menuFile, "&File");
     $menuBar->Append($statbarMenu, "&Status bar");
     $menuBar->Append($helpMenu, "&Help");
     // ... and attach this menu bar to the frame
     $this->SetMenuBar($menuBar);
     // create default status bar to start with
     $this->DoCreateStatusBar(self::StatBar_Default, wxSTB_DEFAULT_STYLE);
     $this->SetStatusText("Welcome to wxWidgets!");
     $this->Connect(StatusBar_Quit, wxEVT_COMMAND_MENU_SELECTED, array($this, 'OnQuit'));
     $this->Connect(StatusBar_SetFields, wxEVT_COMMAND_MENU_SELECTED, array($this, 'OnSetStatusFields'));
     $this->Connect(StatusBar_SetField, wxEVT_COMMAND_MENU_SELECTED, array($this, 'OnSetStatusField'));
     $this->Connect(StatusBar_SetText, wxEVT_COMMAND_MENU_SELECTED, array($this, 'OnSetStatusText'));
     $this->Connect(StatusBar_PushText, wxEVT_COMMAND_MENU_SELECTED, array($this, 'OnPushStatusText'));
     $this->Connect(StatusBar_PopText, wxEVT_COMMAND_MENU_SELECTED, array($this, 'OnPopStatusText'));
     $this->Connect(StatusBar_SetFont, wxEVT_COMMAND_MENU_SELECTED, array($this, 'OnSetStatusFont'));
     $this->Connect(StatusBar_ResetFieldsWidth, wxEVT_COMMAND_MENU_SELECTED, array($this, 'OnResetFieldsWidth'));
     $this->Connect(StatusBar_ShowFieldsRect, wxEVT_COMMAND_MENU_SELECTED, array($this, 'OnShowFieldsRect'));
     $this->Connect(StatusBar_Recreate, wxEVT_COMMAND_MENU_SELECTED, array($this, 'OnRecreateStatusBar'));
     $this->Connect(StatusBar_About, wxEVT_COMMAND_MENU_SELECTED, array($this, 'OnAbout'));
     $this->Connect(StatusBar_Toggle, wxEVT_COMMAND_MENU_SELECTED, array($this, 'OnStatusBarToggle'));
     $this->Connect(StatusBar_SetPaneStyleNormal, wxEVT_COMMAND_MENU_SELECTED, array($this, 'OnSetPaneStyle'));
     $this->Connect(StatusBar_SetPaneStyleFlat, wxEVT_COMMAND_MENU_SELECTED, array($this, 'OnSetPaneStyle'));
     $this->Connect(StatusBar_SetPaneStyleRaised, wxEVT_COMMAND_MENU_SELECTED, array($this, 'OnSetPaneStyle'));
     $this->Connect(StatusBar_SetStyleSizeGrip, wxEVT_COMMAND_MENU_SELECTED, array($this, 'OnSetStyle'));
     $this->Connect(StatusBar_SetStyleEllipsizeStart, wxEVT_COMMAND_MENU_SELECTED, array($this, 'OnSetStyle'));
     $this->Connect(StatusBar_SetStyleEllipsizeMiddle, wxEVT_COMMAND_MENU_SELECTED, array($this, 'OnSetStyle'));
     $this->Connect(StatusBar_SetStyleEllipsizeEnd, wxEVT_COMMAND_MENU_SELECTED, array($this, 'OnSetStyle'));
     $this->Connect(StatusBar_SetStyleShowTips, wxEVT_COMMAND_MENU_SELECTED, array($this, 'OnSetStyle'));
     $this->Connect(StatusBar_SetFields, StatusBar_ResetFieldsWidth, wxEVT_UPDATE_UI, array($this, 'OnUpdateForDefaultStatusbar'));
     $this->Connect(StatusBar_Toggle, wxEVT_UPDATE_UI, array($this, "OnUpdateStatusBarToggle"));
     $this->Connect(StatusBar_SetPaneStyleNormal, StatusBar_SetPaneStyleRaised, wxEVT_UPDATE_UI, array($this, 'OnUpdateSetPaneStyle'));
     $this->Connect(StatusBar_SetStyleSizeGrip, StatusBar_SetStyleShowTips, wxEVT_UPDATE_UI, array($this, 'OnUpdateSetStyle'));
 }
示例#4
0
 function myFrame()
 {
     parent::__construct(null, null, "wxPhp Source Maker GUI, v0.1", wxDefaultPosition, new wxSize(600, 400));
     $this->SetIcon(new wxIcon("sample.xpm", wxBITMAP_TYPE_XPM));
     $sz = new wxBoxSizer(wxHORIZONTAL);
     $sw = new wxSplitterWindow($this, -1, wxDefaultPosition, wxDefaultSize, wxSP_NO_XP_THEME);
     $tree = new wxTreeCtrl($sw, -1);
     $dummy = new wxPanel($sw);
     $sz2 = new wxBoxSizer(wxVERTICAL);
     $lst = new wxCheckListBox($dummy, -1);
     $lst2 = new wxCheckListBox($dummy, -1);
     $lst->Connect(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, array($this, "checkLst"));
     $lst2->Connect(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, array($this, "saveImplements"));
     $sz2->Add($lst2, 1, wxEXPAND | wxALL);
     $sz2->Add($lst, 1, wxEXPAND | wxALL);
     $dummy->SetSizer($sz2);
     $this->lst = $lst;
     $this->lst2 = $lst2;
     //var_dump($dummy->AppendTextColumn("Nome",0));
     //$dummy 	= new wxListCtrl($sw,-1,wxDefaultPosition,wxDefaultSize,wxLC_REPORT);
     //$dummy->InsertColumn(0,"Nome");
     //var_dump(wxLC_ICON);
     //$dummy 	= new wxTextCtrl($sw,-1,"");
     //$dummy->Connect(wxEVT_COMMAND_TEXT_UPDATED,array($this,'simpleCB'));
     $rtNode = $tree->AddRoot("wxPHP");
     global $cls;
     foreach ($cls as $k => $v) {
         $clNode = $tree->AppendItem($rtNode, $k);
         /*foreach($v as $k1=>$v1)
         		{
         			if($k1[0]=="_")
         				continue;
         			$tree->AppendItem($clNode,$k1);
         		}*/
     }
     $tree->Connect(wxEVT_COMMAND_TREE_SEL_CHANGED, array($this, "treeSelection"));
     //$tree->ExpandAll();
     $this->tree = $tree;
     $sw->SplitVertically($tree, $dummy);
     $sw->SetMinimumPaneSize(150);
     $sz->Add($sw, 1, wxEXPAND | wxALL);
     $this->SetSizer($sz);
     $tb = $this->CreateToolBar();
     $tb->AddTool(-1, "Abrir", new wxBitmap("sample.xpm", wxBITMAP_TYPE_XPM), "Abrir documentos");
     $tb->AddSeparator();
     $tb->Realize();
     $mb = new wxMenuBar();
     $mn = new wxMenu();
     $mn->AppendCheckItem(-1, "&Salvar");
     //$mn->Append(15,"abrir","serve para abrir");
     $mb->Append($mn, "&File");
     $this->SetMenuBar($mb);
     $this->Connect(wxEVT_COMMAND_MENU_SELECTED, array($this, "simpleCB"));
 }