Added wxPoem sample; fixed some Dialog Editor problems; wxStaticBitmap and wxBitmapButton
now recognised by resource.cpp. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1181 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
ae0bdb016f
commit
3013b6f460
@ -160,7 +160,10 @@ wxObject* WXDLLEXPORT_CTORFN wxConstructorFor##name(void) \
|
||||
|
||||
#endif
|
||||
|
||||
#define IS_KIND_OF(obj, className) obj->IsKindOf(&className::sm_class##className)
|
||||
#define wxIS_KIND_OF(obj, className) obj->IsKindOf(&className::sm_class##className)
|
||||
|
||||
// Just seems a bit nicer-looking (pretend it's not a macro)
|
||||
#define wxIsKindOf(obj, className) obj->IsKindOf(&className::sm_class##className)
|
||||
|
||||
// Unfortunately Borland seems to need this include.
|
||||
#ifdef __BORLANDC__
|
||||
|
1
samples/wxpoem/Makefile
Normal file
1
samples/wxpoem/Makefile
Normal file
@ -0,0 +1 @@
|
||||
include ../../setup/general/makeapp
|
26
samples/wxpoem/Makefile.in
Normal file
26
samples/wxpoem/Makefile.in
Normal file
@ -0,0 +1,26 @@
|
||||
# WXXT base directory
|
||||
WXBASEDIR=@WXBASEDIR@
|
||||
|
||||
# set the OS type for compilation
|
||||
OS=@OS@
|
||||
# compile a library only
|
||||
RULE=bin
|
||||
|
||||
# define library name
|
||||
BIN_TARGET=wxpoem
|
||||
# define library sources
|
||||
BIN_SRC=\
|
||||
wxpoem.cpp
|
||||
|
||||
#define library objects
|
||||
BIN_OBJ=\
|
||||
wxpoem.o
|
||||
|
||||
# additional things needed to link
|
||||
BIN_LINK=
|
||||
|
||||
# additional things needed to compile
|
||||
ADD_COMPILE=
|
||||
|
||||
# include the definitions now
|
||||
include ../../../template.mak
|
BIN
samples/wxpoem/corner1.ico
Normal file
BIN
samples/wxpoem/corner1.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 766 B |
BIN
samples/wxpoem/corner2.ico
Normal file
BIN
samples/wxpoem/corner2.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 766 B |
BIN
samples/wxpoem/corner3.ico
Normal file
BIN
samples/wxpoem/corner3.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 766 B |
BIN
samples/wxpoem/corner4.ico
Normal file
BIN
samples/wxpoem/corner4.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 766 B |
64
samples/wxpoem/makefile.b32
Normal file
64
samples/wxpoem/makefile.b32
Normal file
@ -0,0 +1,64 @@
|
||||
#
|
||||
# File: makefile.b32
|
||||
# Author: Julian Smart
|
||||
# Created: 1993
|
||||
# Updated:
|
||||
# Copyright:
|
||||
#
|
||||
# "%W% %G%"
|
||||
#
|
||||
# Makefile : Builds wxpoem example
|
||||
|
||||
# WXWIN and BCCDIR are set by parent make
|
||||
|
||||
WXDIR = $(WXWIN)
|
||||
!include $(WXDIR)\src\makeb32.env
|
||||
|
||||
WXLIBDIR = $(WXDIR)\lib
|
||||
WXINC = $(WXDIR)\include\msw
|
||||
WXLIB = $(WXLIBDIR)\wx32.lib
|
||||
LIBS=$(WXLIB) cw32 import32 ole2w32
|
||||
|
||||
TARGET=wxpoem
|
||||
|
||||
!if "$(FINAL)" == "0"
|
||||
LINKFLAGS=/v /Tpe /L$(WXLIBDIR);$(BCCDIR)\lib
|
||||
OPT = -Od
|
||||
DEBUG_FLAGS= -v
|
||||
!else
|
||||
LINKFLAGS=/Tpe /L$(WXLIBDIR);$(BCCDIR)\lib
|
||||
OPT = -Od
|
||||
DEBUG_FLAGS =
|
||||
!endif
|
||||
CPPFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG)
|
||||
|
||||
OBJECTS = wxpoem.obj
|
||||
|
||||
$(TARGET).exe: $(OBJECTS) $(TARGET).res
|
||||
tlink32 $(LINKFLAGS) @&&!
|
||||
c0w32.obj $(OBJECTS)
|
||||
$(TARGET)
|
||||
nul
|
||||
$(LIBS)
|
||||
$(TARGET).def
|
||||
$(TARGET).res
|
||||
!
|
||||
|
||||
.$(SRCSUFF).obj:
|
||||
bcc32 $(CPPFLAGS) -c {$< }
|
||||
|
||||
.c.obj:
|
||||
bcc32 $(CPPFLAGS) -P- -c {$< }
|
||||
|
||||
wxpoem.obj: wxpoem.$(SRCSUFF)
|
||||
|
||||
$(TARGET).res : $(TARGET).rc $(WXDIR)\include\wx\msw\wx.rc
|
||||
brc32 -r /i$(BCCDIR)\include /i$(WXDIR)\include $(TARGET)
|
||||
|
||||
clean:
|
||||
-erase *.obj
|
||||
-erase *.exe
|
||||
-erase *.res
|
||||
-erase *.map
|
||||
-erase *.rws
|
||||
|
37
samples/wxpoem/makefile.g95
Normal file
37
samples/wxpoem/makefile.g95
Normal file
@ -0,0 +1,37 @@
|
||||
#
|
||||
# File: makefile.unx
|
||||
# Author: Julian Smart
|
||||
# Created: 1993
|
||||
# Updated:
|
||||
# Copyright: (c) 1993, AIAI, University of Edinburgh
|
||||
#
|
||||
# "%W% %G%"
|
||||
#
|
||||
# Makefile for wxpoem example (UNIX).
|
||||
|
||||
WXDIR = ../..
|
||||
|
||||
# All common UNIX compiler flags and options are now in
|
||||
# this central makefile.
|
||||
include $(WXDIR)/src/makeg95.env
|
||||
|
||||
OBJECTS = $(OBJDIR)/wxpoem.$(OBJSUFF) $(OBJDIR)/wxpoem_resources.$(OBJSUFF)
|
||||
|
||||
all: $(OBJDIR) wxpoem$(GUISUFFIX)$(EXESUFF)
|
||||
|
||||
wx:
|
||||
|
||||
$(OBJDIR):
|
||||
mkdir $(OBJDIR)
|
||||
|
||||
wxpoem$(GUISUFFIX)$(EXESUFF): $(OBJECTS) $(WXLIB)
|
||||
$(CC) $(LDFLAGS) -o wxpoem$(GUISUFFIX)$(EXESUFF) $(OBJECTS) $(LDLIBS)
|
||||
|
||||
$(OBJDIR)/wxpoem.$(OBJSUFF): wxpoem.$(SRCSUFF)
|
||||
$(CC) -c $(CPPFLAGS) -o $@ wxpoem.$(SRCSUFF)
|
||||
|
||||
$(OBJDIR)/wxpoem_resources.o: wxpoem.rc
|
||||
$(RESCOMP) -i wxpoem.rc -o $(OBJDIR)/wxpoem_resources.o $(RESFLAGS)
|
||||
|
||||
clean:
|
||||
rm -f $(OBJECTS) wxpoem$(GUISUFFIX).exe core *.rsc *.res
|
64
samples/wxpoem/makefile.nt
Normal file
64
samples/wxpoem/makefile.nt
Normal file
@ -0,0 +1,64 @@
|
||||
#
|
||||
# File: makefile.nt
|
||||
# Author: Julian Smart
|
||||
# Created: 1993
|
||||
# Updated:
|
||||
# Copyright: (c) 1993, AIAI, University of Edinburgh
|
||||
#
|
||||
# "%W% %G%"
|
||||
#
|
||||
# Makefile : Builds wxpoem example (MS VC++).
|
||||
# Use FINAL=1 argument to nmake to build final version with no debugging
|
||||
# info
|
||||
|
||||
# Set WXDIR for your system
|
||||
WXDIR = $(WXWIN)
|
||||
|
||||
WXUSINGDLL=0
|
||||
|
||||
!include $(WXDIR)\src\ntwxwin.mak
|
||||
|
||||
THISDIR = $(WXDIR)\samples\wxpoem
|
||||
PROGRAM=wxpoem
|
||||
|
||||
OBJECTS = $(PROGRAM).obj
|
||||
|
||||
$(PROGRAM): $(PROGRAM).exe
|
||||
|
||||
all: wx $(PROGRAM).exe
|
||||
|
||||
wx:
|
||||
cd $(WXDIR)\src\msw
|
||||
nmake -f makefile.nt FINAL=$(FINAL)
|
||||
cd $(THISDIR)
|
||||
|
||||
wxclean:
|
||||
cd $(WXDIR)\src\msw
|
||||
nmake -f makefile.nt clean
|
||||
cd $(THISDIR)
|
||||
|
||||
$(PROGRAM).exe: $(DUMMYOBJ) $(WXLIB) $(OBJECTS) $(PROGRAM).res
|
||||
$(link) @<<
|
||||
-out:$(PROGRAM).exe
|
||||
$(LINKFLAGS)
|
||||
$(DUMMYOBJ) $(OBJECTS) $(PROGRAM).res
|
||||
$(LIBS)
|
||||
<<
|
||||
|
||||
|
||||
$(PROGRAM).obj: $(PROGRAM).$(SRCSUFF) $(DUMMYOBJ)
|
||||
$(cc) @<<
|
||||
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
|
||||
<<
|
||||
|
||||
$(PROGRAM).res : $(PROGRAM).rc $(WXDIR)\include\wx\msw\wx.rc
|
||||
$(rc) -r /i$(WXDIR)\include -fo$@ $(PROGRAM).rc
|
||||
|
||||
|
||||
clean:
|
||||
-erase *.obj
|
||||
-erase *.exe
|
||||
-erase *.res
|
||||
-erase *.map
|
||||
-erase *.sbr
|
||||
-erase *.pdb
|
17
samples/wxpoem/makefile.unx
Normal file
17
samples/wxpoem/makefile.unx
Normal file
@ -0,0 +1,17 @@
|
||||
#
|
||||
# File: makefile.unx
|
||||
# Author: Julian Smart
|
||||
# Created: 1998
|
||||
# Updated:
|
||||
# Copyright: (c) 1998 Julian Smart
|
||||
#
|
||||
# "%W% %G%"
|
||||
#
|
||||
# Makefile for wxPoem example (UNIX).
|
||||
|
||||
PROGRAM=wxpoem
|
||||
|
||||
OBJECTS=$(PROGRAM).o
|
||||
|
||||
include ../../src/makeprog.env
|
||||
|
1126
samples/wxpoem/wxpoem.cpp
Normal file
1126
samples/wxpoem/wxpoem.cpp
Normal file
File diff suppressed because it is too large
Load Diff
2532
samples/wxpoem/wxpoem.dat
Normal file
2532
samples/wxpoem/wxpoem.dat
Normal file
File diff suppressed because it is too large
Load Diff
9
samples/wxpoem/wxpoem.def
Normal file
9
samples/wxpoem/wxpoem.def
Normal file
@ -0,0 +1,9 @@
|
||||
NAME WXPOEM
|
||||
DESCRIPTION 'WXPOEM'
|
||||
EXETYPE WINDOWS
|
||||
STUB 'WINSTUB.EXE'
|
||||
CODE PRELOAD MOVEABLE DISCARDABLE
|
||||
DATA PRELOAD MOVEABLE MULTIPLE
|
||||
HEAPSIZE 1024
|
||||
STACKSIZE 8192
|
||||
|
90
samples/wxpoem/wxpoem.h
Normal file
90
samples/wxpoem/wxpoem.h
Normal file
@ -0,0 +1,90 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wxpoem.h
|
||||
// Purpose: A small C++ program which displays a random poem on
|
||||
// execution. It also allows search for poems containing a
|
||||
// string.
|
||||
// It requires winpoem.dat and creates winpoem.idx.
|
||||
// Original version (WinPoem) written in 1994.
|
||||
// This has not been rewritten in a long time so
|
||||
// beware, inelegant code!
|
||||
// Author: Julian Smart
|
||||
// Created: 12/12/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1998 Julian Smart
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "wxpoem.h"
|
||||
#endif
|
||||
|
||||
// Define a new application
|
||||
class MyApp: public wxApp
|
||||
{
|
||||
public:
|
||||
bool OnInit();
|
||||
int OnExit();
|
||||
};
|
||||
|
||||
DECLARE_APP(MyApp)
|
||||
|
||||
// Define a new canvas which can receive some events
|
||||
class MyCanvas: public wxPanel
|
||||
{
|
||||
public:
|
||||
MyCanvas(wxFrame *frame, wxWindowID id, const wxPoint& pos, const wxSize& size);
|
||||
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
void OnMouseEvent(wxMouseEvent& event);
|
||||
void OnChar(wxKeyEvent& event);
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
// Define a new frame
|
||||
class MainWindow: public wxFrame
|
||||
{
|
||||
public:
|
||||
MyCanvas *canvas;
|
||||
MainWindow(wxFrame *frame, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style);
|
||||
|
||||
void OnCloseWindow(wxCloseEvent& event);
|
||||
void OnChar(wxKeyEvent& event);
|
||||
|
||||
// Display next page or poem
|
||||
void NextPage(void);
|
||||
|
||||
// Display previous page
|
||||
void PreviousPage(void);
|
||||
|
||||
// User search
|
||||
void Search(bool);
|
||||
|
||||
// Look in file for string
|
||||
long DoSearch(void);
|
||||
|
||||
// Do the actual drawing of text (or just calculate size needed)
|
||||
void ScanBuffer(wxDC *dc, bool DrawIt, int *max_x, int *max_y);
|
||||
|
||||
// Load the poem
|
||||
void GetIndexLoadPoem(void);
|
||||
void Resize(void);
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
// Menu items
|
||||
#define POEM_NEXT 100
|
||||
#define POEM_PREVIOUS 101
|
||||
#define POEM_COPY 102
|
||||
#define POEM_SEARCH 103
|
||||
#define POEM_NEXT_MATCH 104
|
||||
#define POEM_ABOUT 105
|
||||
#define POEM_EXIT 106
|
||||
#define POEM_COMPILE 107
|
||||
#define POEM_HELP_CONTENTS 108
|
||||
#define POEM_BIGGER_TEXT 109
|
||||
#define POEM_SMALLER_TEXT 110
|
||||
#define POEM_MINIMIZE 111
|
||||
|
||||
|
BIN
samples/wxpoem/wxpoem.ico
Normal file
BIN
samples/wxpoem/wxpoem.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 766 B |
11
samples/wxpoem/wxpoem.rc
Normal file
11
samples/wxpoem/wxpoem.rc
Normal file
@ -0,0 +1,11 @@
|
||||
aaaa ICON "wxpoem.ico"
|
||||
wxpoem ICON "wxpoem.ico"
|
||||
wxSTD_FRAME ICON "wxpoem.ico"
|
||||
|
||||
icon_1 ICON "corner1.ico"
|
||||
icon_2 ICON "corner2.ico"
|
||||
icon_3 ICON "corner3.ico"
|
||||
icon_4 ICON "corner4.ico"
|
||||
|
||||
#include "wx/msw/wx.rc"
|
||||
|
121
samples/wxpoem/wxpoem.txt
Normal file
121
samples/wxpoem/wxpoem.txt
Normal file
@ -0,0 +1,121 @@
|
||||
wxPoem 1.0
|
||||
----------
|
||||
|
||||
by Julian Smart
|
||||
---------------
|
||||
|
||||
Fancy a little intellectual stimulation after long hours spent staring
|
||||
at spreadsheets or reports? Does your brain long for something a little
|
||||
more fulfilling than Tetris or fiddling with the WIN.INI file? Then you
|
||||
could go out and buy a poetry book... or alternatively, if you just
|
||||
can't drag yourself away from the screen, click on the wxPoem icon.
|
||||
|
||||
wxPoem is a simple Windows application which picks poems from a file at
|
||||
random, or finds poems according to a string criterion, and formats them
|
||||
nicely in a window. A displayed poem can be copied to the Windows clipboard
|
||||
ready for inclusion in that more imaginative report...
|
||||
|
||||
It's small, it's free and it's totally harmless, so far as I know.
|
||||
No responsibility accepted, though, for any problems it might cause with
|
||||
your setup.
|
||||
|
||||
wxPoem was converted to use the wxWindows toolkit, from the original
|
||||
WinPoem which received a favourable review from Windows Shareware 500.
|
||||
|
||||
Since it now uses wxWindows, wxPoem may be compiled on a variety
|
||||
of platforms such as X (XView or Motif), Windows and NT.
|
||||
|
||||
Files
|
||||
-----
|
||||
|
||||
The main data file is winpoem.dat, and an index file winpoem.idx is
|
||||
supplied or can be (re)built by deleting winpoem.idx and rerunning
|
||||
wxPoem. Source code is also provided in source.zip, but wxWindows is
|
||||
required to build it. The original WinPoem is much leaner (40K
|
||||
instead of 400K!) and can be compiled under Windows without wxWindows.
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
Windows
|
||||
=======
|
||||
|
||||
Copy ctl3dv2.dll to windows\system, and delete the original
|
||||
ctl3dv2.dll or wxPoem will not run.
|
||||
|
||||
wxPoem can be put in the Startup folder in the Program Manager, so that
|
||||
a random poem will pop up every time Windows is run.
|
||||
|
||||
UNIX
|
||||
====
|
||||
|
||||
wxPoem comes in Open Look and Motif versions for the Sun, and a
|
||||
Linux Open Look version. For other platforms, you will need to
|
||||
recompile the source.
|
||||
|
||||
|
||||
Use
|
||||
---
|
||||
|
||||
Simply run the program, and a random poem will be displayed.
|
||||
You can optionally give a filename on the command line, without a suffix
|
||||
(e.g. winpoem).
|
||||
|
||||
The simplest way of operating wxPoem is to keep pressing the space bar
|
||||
for new poems (or pages for multi-page poems).
|
||||
|
||||
Clicking the right mouse button (or selecting the wxPoem Options menu
|
||||
item from the system menu) gives a choice of the following facilities:
|
||||
Next poem/page (Page down) Display next poem (or next page)
|
||||
Previous page (Page up) Display previous page (multi-line poems only)
|
||||
Search (S) Allows user to enter a search string
|
||||
Next match (N) Gives next search match
|
||||
Copy to clipboard Allows poems to be pasted into other applications
|
||||
Bigger text Increases text size
|
||||
Smaller text Decreases text size
|
||||
About wxPoem About wxPoem
|
||||
Exit (Esc) Quit wxPoem
|
||||
|
||||
When wxPoem is closed, the font, text height and window position are
|
||||
remembered (stored in WIN.INI) for next time. Under X, the values
|
||||
are not written (since they are stored in .Xdefaults), so you may
|
||||
want to edit the following resources by hand:
|
||||
|
||||
wxPoem.X ; X position
|
||||
wxPoem.Y ; Y position
|
||||
wxPoem.FontSize ; Font size in points (default 12)
|
||||
|
||||
The data file
|
||||
-------------
|
||||
|
||||
The winpoem.dat file contains poems separated by a #, with optional
|
||||
@ codes denoting title (@T) author (@A) and page break (@P). Any
|
||||
unrecognized codes will cause the rest of the line to be ignored, so
|
||||
the user can add lines (e.g. @S for subject) which will be searched on but
|
||||
not displayed.
|
||||
|
||||
The data file contains a mixture of 20th century and earlier poetry,
|
||||
subject to copyright constraints. Apologies if any copyrights have
|
||||
inadvertently been infringed, though I have tried to avoid it.
|
||||
|
||||
Implementation
|
||||
--------------
|
||||
|
||||
The original WinPoem program was my `Windows learning application', i.e.
|
||||
a vehicle for getting stuck into Windows programming, whilst (possibly)
|
||||
affording others a modicum of amusement. Therefore the code is pretty
|
||||
ugly. So don't look if you're squeamish!
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
Copyright Julian Smart, released into the public domain, October 1994.
|
||||
|
||||
Julian Smart
|
||||
Artificial Intelligence Applications Institute
|
||||
University of Edinburgh
|
||||
80 South Bridge
|
||||
Einburgh
|
||||
EH1 1HN
|
||||
|
||||
J.Smart@ed.ac.uk
|
@ -38,12 +38,15 @@
|
||||
#endif
|
||||
|
||||
// Sun CC compatibility (interference with xview/pkg.h, apparently...)
|
||||
#if defined(SUN_CC) && defined(__XVIEW__)
|
||||
// But XView is no longer supported.
|
||||
/*
|
||||
#if defined (SUN_CC) || defined(__SUNCC__) && defined(__XVIEW__)
|
||||
#undef va_start
|
||||
#undef va_end
|
||||
#undef va_arg
|
||||
#undef va_list
|
||||
#endif
|
||||
*/
|
||||
|
||||
// =============================================================================
|
||||
// implementation
|
||||
|
@ -797,6 +797,19 @@ wxItemResource *wxResourceInterpretControl(wxResourceTable& table, wxExpr *expr)
|
||||
controlItem->SetId(id);
|
||||
|
||||
if (controlType == "wxButton")
|
||||
{
|
||||
// Check for bitmap resource name (in case loading old-style resource file)
|
||||
if (expr->Nth(count) && ((expr->Nth(count)->Type() == PrologString) || (expr->Nth(count)->Type() == PrologWord)))
|
||||
{
|
||||
wxString str(expr->Nth(count)->StringValue());
|
||||
controlItem->SetValue4(str);
|
||||
count ++;
|
||||
controlItem->SetType("wxBitmapButton");
|
||||
}
|
||||
if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList)
|
||||
controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count)));
|
||||
}
|
||||
else if (controlType == "wxBitmapButton")
|
||||
{
|
||||
// Check for bitmap resource name
|
||||
if (expr->Nth(count) && ((expr->Nth(count)->Type() == PrologString) || (expr->Nth(count)->Type() == PrologWord)))
|
||||
@ -852,6 +865,19 @@ wxItemResource *wxResourceInterpretControl(wxResourceTable& table, wxExpr *expr)
|
||||
}
|
||||
}
|
||||
else if (controlType == "wxMessage" || controlType == "wxStaticText")
|
||||
{
|
||||
// Check for bitmap resource name (in case it's an old-style .wxr file)
|
||||
if (expr->Nth(count) && ((expr->Nth(count)->Type() == PrologString) || (expr->Nth(count)->Type() == PrologWord)))
|
||||
{
|
||||
wxString str(expr->Nth(count)->StringValue());
|
||||
controlItem->SetValue4(str);
|
||||
count ++;
|
||||
controlItem->SetType("wxStaticText");
|
||||
}
|
||||
if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList)
|
||||
controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count)));
|
||||
}
|
||||
else if (controlType == "wxStaticBitmap")
|
||||
{
|
||||
// Check for bitmap resource name
|
||||
if (expr->Nth(count) && ((expr->Nth(count)->Type() == PrologString) || (expr->Nth(count)->Type() == PrologWord)))
|
||||
@ -859,9 +885,9 @@ wxItemResource *wxResourceInterpretControl(wxResourceTable& table, wxExpr *expr)
|
||||
wxString str(expr->Nth(count)->StringValue());
|
||||
controlItem->SetValue4(str);
|
||||
count ++;
|
||||
if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList)
|
||||
controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count)));
|
||||
}
|
||||
if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList)
|
||||
controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count)));
|
||||
}
|
||||
else if (controlType == "wxGroupBox" || controlType == "wxStaticBox")
|
||||
{
|
||||
|
@ -1318,7 +1318,22 @@ void wxResourceManager::AlignItems(int flag)
|
||||
break;
|
||||
}
|
||||
|
||||
wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(item);
|
||||
wxItemResource* parentResource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(item->GetParent());
|
||||
|
||||
item->SetSize(newX, newY, w, h);
|
||||
|
||||
// Also update the associated resource
|
||||
// We need to convert to dialog units if this is not a dialog or panel, but
|
||||
// the parent resource specifies dialog units.
|
||||
if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
|
||||
{
|
||||
wxPoint pt = item->GetParent()->ConvertPixelsToDialog(wxPoint(newX, newY));
|
||||
newX = pt.x; newY = pt.y;
|
||||
wxSize sz = item->GetParent()->ConvertPixelsToDialog(wxSize(w, h));
|
||||
w = sz.x; h = sz.y;
|
||||
}
|
||||
resource->SetSize(newX, newY, w, h);
|
||||
}
|
||||
}
|
||||
win->Refresh();
|
||||
@ -1348,7 +1363,23 @@ void wxResourceManager::CopySize()
|
||||
{
|
||||
wxControl *item = (wxControl *)node->Data();
|
||||
if (item->GetParent() == win)
|
||||
{
|
||||
item->SetSize(-1, -1, firstW, firstH);
|
||||
|
||||
wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(item);
|
||||
wxItemResource* parentResource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(item->GetParent());
|
||||
|
||||
// Also update the associated resource
|
||||
// We need to convert to dialog units if this is not a dialog or panel, but
|
||||
// the parent resource specifies dialog units.
|
||||
if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS)
|
||||
{
|
||||
wxSize sz = item->GetParent()->ConvertPixelsToDialog(wxSize(firstW, firstH));
|
||||
firstW = sz.x; firstH = sz.y;
|
||||
}
|
||||
resource->SetSize(resource->GetX(), resource->GetY(), firstW, firstH);
|
||||
|
||||
}
|
||||
}
|
||||
win->Refresh();
|
||||
}
|
||||
@ -1931,30 +1962,30 @@ wxWindowPropertyInfo *wxResourceManager::CreatePropertyInfoForWindow(wxWindow *w
|
||||
{
|
||||
info = new wxRadioButtonPropertyInfo(win);
|
||||
}
|
||||
else if (win->IsKindOf(CLASSINFO(wxChoice)))
|
||||
{
|
||||
info = new wxChoicePropertyInfo(win);
|
||||
}
|
||||
else if (win->IsKindOf(CLASSINFO(wxComboBox)))
|
||||
{
|
||||
info = new wxComboBoxPropertyInfo(win);
|
||||
}
|
||||
else if (win->IsKindOf(CLASSINFO(wxButton)))
|
||||
else if (win->IsKindOf(CLASSINFO(wxChoice)))
|
||||
{
|
||||
info = new wxButtonPropertyInfo(win);
|
||||
info = new wxChoicePropertyInfo(win);
|
||||
}
|
||||
else if (win->IsKindOf(CLASSINFO(wxBitmapButton)))
|
||||
{
|
||||
info = new wxBitmapButtonPropertyInfo(win);
|
||||
}
|
||||
else if (win->IsKindOf(CLASSINFO(wxStaticText)))
|
||||
else if (win->IsKindOf(CLASSINFO(wxButton)))
|
||||
{
|
||||
info = new wxStaticTextPropertyInfo(win);
|
||||
info = new wxButtonPropertyInfo(win);
|
||||
}
|
||||
else if (win->IsKindOf(CLASSINFO(wxStaticBitmap)))
|
||||
{
|
||||
info = new wxStaticBitmapPropertyInfo(win);
|
||||
}
|
||||
else if (win->IsKindOf(CLASSINFO(wxStaticText)))
|
||||
{
|
||||
info = new wxStaticTextPropertyInfo(win);
|
||||
}
|
||||
else if (win->IsKindOf(CLASSINFO(wxTextCtrl)))
|
||||
{
|
||||
info = new wxTextPropertyInfo(win);
|
||||
|
@ -810,7 +810,7 @@ bool wxButtonPropertyInfo::InstantiateResource(wxItemResource *resource)
|
||||
wxProperty *wxBitmapButtonPropertyInfo::GetProperty(wxString& name)
|
||||
{
|
||||
wxBitmapButton *button = (wxBitmapButton *)m_propertyWindow;
|
||||
if (name == "label")
|
||||
if (name == "bitmapFilename")
|
||||
{
|
||||
wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(button);
|
||||
wxString str("none.bmp");
|
||||
@ -819,7 +819,7 @@ wxProperty *wxBitmapButtonPropertyInfo::GetProperty(wxString& name)
|
||||
{
|
||||
str = wxResourceManager::GetCurrentResourceManager()->FindBitmapFilenameForResource(resource);
|
||||
}
|
||||
return new wxProperty("label", str.GetData(), "string", new wxFilenameListValidator("Select a bitmap file", "*.bmp"));
|
||||
return new wxProperty("bitmapFilename", str.GetData(), "string", new wxFilenameListValidator("Select a bitmap file", "*.bmp"));
|
||||
}
|
||||
else
|
||||
return wxButtonPropertyInfo::GetProperty(name);
|
||||
@ -828,7 +828,7 @@ wxProperty *wxBitmapButtonPropertyInfo::GetProperty(wxString& name)
|
||||
bool wxBitmapButtonPropertyInfo::SetProperty(wxString& name, wxProperty *property)
|
||||
{
|
||||
wxBitmapButton *button = (wxBitmapButton *)m_propertyWindow;
|
||||
if (name == "label")
|
||||
if (name == "bitmapFilename")
|
||||
{
|
||||
char *s = property->GetValue().StringValue();
|
||||
if (s && wxFileExists(s))
|
||||
@ -867,8 +867,9 @@ bool wxBitmapButtonPropertyInfo::SetProperty(wxString& name, wxProperty *propert
|
||||
|
||||
void wxBitmapButtonPropertyInfo::GetPropertyNames(wxStringList& names)
|
||||
{
|
||||
// names.Add("label");
|
||||
wxButtonPropertyInfo::GetPropertyNames(names);
|
||||
names.Delete("label");
|
||||
names.Add("bitmapFilename");
|
||||
}
|
||||
|
||||
bool wxBitmapButtonPropertyInfo::InstantiateResource(wxItemResource *resource)
|
||||
@ -908,7 +909,7 @@ bool wxStaticTextPropertyInfo::InstantiateResource(wxItemResource *resource)
|
||||
wxProperty *wxStaticBitmapPropertyInfo::GetProperty(wxString& name)
|
||||
{
|
||||
wxStaticBitmap *message = (wxStaticBitmap *)m_propertyWindow;
|
||||
if (name == "label")
|
||||
if (name == "bitmapFilename")
|
||||
{
|
||||
wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(message);
|
||||
wxString str("none.bmp");
|
||||
@ -917,7 +918,7 @@ wxProperty *wxStaticBitmapPropertyInfo::GetProperty(wxString& name)
|
||||
{
|
||||
str = wxResourceManager::GetCurrentResourceManager()->FindBitmapFilenameForResource(resource);
|
||||
}
|
||||
return new wxProperty("label", str.GetData(), "string", new wxFilenameListValidator("Select a bitmap file", "*.bmp"));
|
||||
return new wxProperty("bitmapFilename", str.GetData(), "string", new wxFilenameListValidator("Select a bitmap file", "*.bmp"));
|
||||
}
|
||||
else
|
||||
return wxItemPropertyInfo::GetProperty(name);
|
||||
@ -926,7 +927,7 @@ wxProperty *wxStaticBitmapPropertyInfo::GetProperty(wxString& name)
|
||||
bool wxStaticBitmapPropertyInfo::SetProperty(wxString& name, wxProperty *property)
|
||||
{
|
||||
wxStaticBitmap *message = (wxStaticBitmap *)m_propertyWindow;
|
||||
if (name == "label")
|
||||
if (name == "bitmapFilename")
|
||||
{
|
||||
char *s = property->GetValue().StringValue();
|
||||
if (s && wxFileExists(s))
|
||||
@ -967,7 +968,7 @@ bool wxStaticBitmapPropertyInfo::SetProperty(wxString& name, wxProperty *propert
|
||||
void wxStaticBitmapPropertyInfo::GetPropertyNames(wxStringList& names)
|
||||
{
|
||||
wxItemPropertyInfo::GetPropertyNames(names);
|
||||
names.Add("label");
|
||||
names.Add("bitmapFilename");
|
||||
}
|
||||
|
||||
bool wxStaticBitmapPropertyInfo::InstantiateResource(wxItemResource *resource)
|
||||
|
@ -208,7 +208,7 @@ wxPropertyValue::~wxPropertyValue(void)
|
||||
}
|
||||
case wxPropertyValueString:
|
||||
{
|
||||
delete m_value.string;
|
||||
delete[] m_value.string;
|
||||
break;
|
||||
}
|
||||
case wxPropertyValueList:
|
||||
|
Loading…
Reference in New Issue
Block a user