本文整理汇总了C++中Resize函数的典型用法代码示例。如果您正苦于以下问题:C++ Resize函数的具体用法?C++ Resize怎么用?C++ Resize使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Resize函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: focusChild
void PolycodeTextEditor::hideFindBar() {
findBar->visible = false;
focusChild(textInput);
Resize(editorSize.x, editorSize.y);
}
示例2: Resize
void CMaps::Clear()
{
Resize(m_nWidth, m_nHeight);
}
示例3: DefHist
DefHist(int BinNum=0)
{
m_pHist = NULL;
m_HistVolume = 0;
Resize(BinNum);
}
示例4: Resize
void CUITrackPopup::Render()
{
if( !IsVisible() ) return;
if( m_vecString.size() <= 0 ) return;
CDrawPort* pDrawPort = CUIManager::getSingleton()->GetDrawPort();
#if defined G_RUSSIA
// [2011/05/17 : Sora] 팝업창에서 스트링을 쓰지 않을 경우 글자 길이가 0이되어 팝업창 사이즈가 줄어든다
if( m_strLongestStringInMenu.Length() > 0 )
{
Resize( pDrawPort->GetTextWidth( m_strLongestStringInMenu ) );
}
#endif
// 배경 렌더
int nX, nY;
UIRect m_rcBack;
GetAbsPos( nX, nY );
m_rcBack.SetRect( nX, nY, nX + m_nWidth, nY + m_nHeight );
// Item Back region
pDrawPort->AddTexture( m_rcBack.Left, m_rcBack.Top,
m_rcBack.Left + 7, m_rcBack.Top + 7,
m_rtBackUL.U0, m_rtBackUL.V0, m_rtBackUL.U1, m_rtBackUL.V1,
0xFFFFFFFF );
pDrawPort->AddTexture( m_rcBack.Left + 7, m_rcBack.Top,
m_rcBack.Right - 7, m_rcBack.Top + 7,
m_rtBackUM.U0, m_rtBackUM.V0, m_rtBackUM.U1, m_rtBackUM.V1,
0xFFFFFFFF );
pDrawPort->AddTexture( m_rcBack.Right - 7, m_rcBack.Top,
m_rcBack.Right, m_rcBack.Top + 7,
m_rtBackUR.U0, m_rtBackUR.V0, m_rtBackUR.U1, m_rtBackUR.V1,
0xFFFFFFFF );
pDrawPort->AddTexture( m_rcBack.Left, m_rcBack.Top + 7,
m_rcBack.Left + 7, m_rcBack.Bottom - 7,
m_rtBackML.U0, m_rtBackML.V0, m_rtBackML.U1, m_rtBackML.V1,
0xFFFFFFFF );
pDrawPort->AddTexture( m_rcBack.Left + 7, m_rcBack.Top + 7,
m_rcBack.Right - 7, m_rcBack.Bottom - 7,
m_rtBackMM.U0, m_rtBackMM.V0, m_rtBackMM.U1, m_rtBackMM.V1,
0xFFFFFFFF );
pDrawPort->AddTexture( m_rcBack.Right - 7, m_rcBack.Top + 7,
m_rcBack.Right, m_rcBack.Bottom - 7,
m_rtBackMR.U0, m_rtBackMR.V0, m_rtBackMR.U1, m_rtBackMR.V1,
0xFFFFFFFF );
pDrawPort->AddTexture( m_rcBack.Left, m_rcBack.Bottom - 7,
m_rcBack.Left + 7, m_rcBack.Bottom,
m_rtBackLL.U0, m_rtBackLL.V0, m_rtBackLL.U1, m_rtBackLL.V1,
0xFFFFFFFF );
pDrawPort->AddTexture( m_rcBack.Left + 7, m_rcBack.Bottom - 7,
m_rcBack.Right - 7, m_rcBack.Bottom,
m_rtBackLM.U0, m_rtBackLM.V0, m_rtBackLM.U1, m_rtBackLM.V1,
0xFFFFFFFF );
pDrawPort->AddTexture( m_rcBack.Right - 7, m_rcBack.Bottom - 7,
m_rcBack.Right, m_rcBack.Bottom,
m_rtBackLR.U0, m_rtBackLR.V0, m_rtBackLR.U1, m_rtBackLR.V1,
0xFFFFFFFF );
// 원래 리스트 박스에 대한 내용 랜더
CUIListBox::Render();
}
示例5: switch
bool
TopWindow::OnEvent(const Event &event)
{
switch (event.type) {
Window *w;
case Event::NOP:
case Event::TIMER:
case Event::USER:
case Event::CALLBACK:
break;
case Event::CLOSE:
OnClose();
break;
case Event::KEY_DOWN:
w = GetFocusedWindow();
if (w == nullptr)
w = this;
return w->OnKeyDown(event.param);
case Event::KEY_UP:
w = GetFocusedWindow();
if (w == nullptr)
w = this;
return w->OnKeyUp(event.param);
case Event::MOUSE_MOTION:
#ifdef DRAW_MOUSE_CURSOR
/* redraw to update the mouse cursor position */
Invalidate();
#endif
// XXX keys
return OnMouseMove(event.point.x, event.point.y, 0);
case Event::MOUSE_DOWN:
return double_click.Check(event.point)
? OnMouseDouble(event.point.x, event.point.y)
: OnMouseDown(event.point.x, event.point.y);
case Event::MOUSE_UP:
double_click.Moved(event.point);
return OnMouseUp(event.point.x, event.point.y);
case Event::MOUSE_WHEEL:
return OnMouseWheel(event.point.x, event.point.y, (int)event.param);
#ifdef USE_X11
case Event::RESIZE:
if (unsigned(event.point.x) == GetWidth() &&
unsigned(event.point.y) == GetHeight())
/* no-op */
return true;
Resize(event.point.x, event.point.y);
return true;
case Event::EXPOSE:
Invalidate();
return true;
#endif
}
return false;
}
示例6: Resize
void TVector::Add(GObject&e){
Resize(1);
*arr[size-1]=e;
}
示例7: Resize
cv::Mat ColorDiscriminator::LoadImage(const ImagePath& img_path) {
cv::Mat img_orig_size = ImageLoader::instance().LoadImage(img_path);
return Resize(img_orig_size, kResizeFactor);
}
示例8: Resize
template<class TA> void DynObjArray_cl<TA>::operator=(const DynObjArray_cl<TA> ©Array)
{
Resize(copyArray.size);
for (unsigned int i = 0; i < copyArray.size; i++)
data[i] = copyArray.data[i];
}
示例9: EnsureSize
/// \brief
/// Ensures that the array has at least minSize elements. Resizes the array if necessary.
inline void EnsureSize(unsigned int minSize) {if (minSize>size) Resize(minSize);}
示例10: TGTransientFrame
KVFileDialog::KVFileDialog(const TGWindow *p, const TGWindow *main,
EKVFileDialogMode dlg_type, TGFileInfo *file_info) :
TGTransientFrame(p, main, 10, 10, kVerticalFrame)
{
// Create a file selection dialog. Depending on the dlg_type it can be
// used for opening or saving a file or selecting a directory.
fDlgMode=dlg_type;
SetCleanup(kDeepCleanup);
Connect("CloseWindow()", "KVFileDialog", this, "CloseWindow()");
DontCallClose();
int i;
if (!p && !main) {
MakeZombie();
return;
}
if (!file_info) {
Error("KVFileDialog", "file_info argument not set");
fFileInfo = &gInfo;
if (fFileInfo->fIniDir) {
delete [] fFileInfo->fIniDir;
fFileInfo->fIniDir = 0;
}
if (fFileInfo->fFilename) {
delete [] fFileInfo->fFilename;
fFileInfo->fFilename = 0;
}
fFileInfo->fFileTypeIdx = 0;
} else
fFileInfo = file_info;
if (!fFileInfo->fFileTypes)
fFileInfo->fFileTypes = gDefTypes;
if (!fFileInfo->fIniDir)
fFileInfo->fIniDir = StrDup(".");
TGHorizontalFrame *fHtop = new TGHorizontalFrame(this, 10, 10);
//--- top toolbar elements
TGLabel *fLookin = new TGLabel(fHtop, new TGHotString((dlg_type == kKVFDSave)
? "S&ave in:" : "&Look in:"));
fTreeLB = new TGFSComboBox(fHtop, kIDF_FSLB);
fTreeLB->Associate(this);
fPcdup = fClient->GetPicture("tb_uplevel.xpm");
fPnewf = fClient->GetPicture("tb_newfolder.xpm");
fPlist = fClient->GetPicture("tb_list.xpm");
fPdetails = fClient->GetPicture("tb_details.xpm");
if (!(fPcdup && fPnewf && fPlist && fPdetails))
Error("KVFileDialog", "missing toolbar pixmap(s).\n");
fCdup = new TGPictureButton(fHtop, fPcdup, kIDF_CDUP);
fNewf = new TGPictureButton(fHtop, fPnewf, kIDF_NEW_FOLDER);
fList = new TGPictureButton(fHtop, fPlist, kIDF_LIST);
fDetails = new TGPictureButton(fHtop, fPdetails, kIDF_DETAILS);
fCdup->SetStyle(gClient->GetStyle());
fNewf->SetStyle(gClient->GetStyle());
fList->SetStyle(gClient->GetStyle());
fDetails->SetStyle(gClient->GetStyle());
fCdup->SetToolTipText("Up One Level");
fNewf->SetToolTipText("Create New Folder");
fList->SetToolTipText("List");
fDetails->SetToolTipText("Details");
fCdup->Associate(this);
fNewf->Associate(this);
fList->Associate(this);
fDetails->Associate(this);
fList->AllowStayDown(kTRUE);
fDetails->AllowStayDown(kTRUE);
fTreeLB->Resize(200, fTreeLB->GetDefaultHeight());
fHtop->AddFrame(fLookin, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 2, 5, 2, 2));
fHtop->AddFrame(fTreeLB, new TGLayoutHints(kLHintsLeft | kLHintsExpandY, 3, 0, 2, 2));
fHtop->AddFrame(fCdup, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 0, 2, 2));
fHtop->AddFrame(fNewf, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 0, 2, 2));
fHtop->AddFrame(fList, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 0, 2, 2));
fHtop->AddFrame(fDetails, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 0, 8, 2, 2));
if (dlg_type == kKVFDSave) {
fCheckB = new TGCheckButton(fHtop, "&Overwrite", kIDF_CHECKB);
fCheckB->SetToolTipText("Overwrite a file without displaying a message if selected");
} else {
fCheckB = new TGCheckButton(fHtop, "&Multiple files", kIDF_CHECKB);
fCheckB->SetToolTipText("Allows multiple file selection when SHIFT is pressed");
fCheckB->Connect("Toggled(Bool_t)","TGFileInfo",fFileInfo,"SetMultipleSelection(Bool_t)");
}
fHtop->AddFrame(fCheckB, new TGLayoutHints(kLHintsLeft | kLHintsCenterY));
fCheckB->SetOn(fFileInfo->fMultipleSelection);
AddFrame(fHtop, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 4, 4, 3, 1));
//--- file view
//.........这里部分代码省略.........
示例11: format_disk
void format_disk(void)
{
if (force_f != YES && conf->open_files)
fatal("Files open on drive");
if (force_f != YES && f.removable == OFF
&& ((defined_format & REMOVABLE) == 0 || newf.removable == OFF))
{
changed_format = defined_format; /* Only for format_f */
if (format_f || reconfig_f)
{
fatal("Changes requested for nonremovable drive");
}
}
/* fill new format structure and check for changes */
return_val = make_newf();
if (return_val) {
/* Could not make the disk as requested */
if (return_val == ERRL_BADFORMAT)
return_msg = "Aborted: Impossible format for disk";
else if (return_val == ERRL_NOMEM)
return_msg = "Aborted: Not enough memory for the disk";
if (disk_bad) {
warning("Impossible format for disk - restoring old format");
memcpy(&newf, &f, sizeof f);
WriteNewFormat();
}
return;
}
if (!disk_bad && !format_f && !reconfig_f) {
if (!changed_format) {
if (verbose > 0)
warning("No change in format - disk remains untouched");
}
else {
if (changed_format & WRITE_PROTECTION)
set_write_protect();
if (changed_format & REMOVABLE)
set_fixed();
if (changed_format & MAX_PART_SIZES) {
if (f.size) {
if (!SavingDiskAllocate(f.sectors))
error("Failed to rearrange memory");
}
else
ConfigMaxAlloc();
}
}
return;
}
/* If Disk will be disabled */
/* !!!! Move this before the code to adjust parameterf for resize */
if (!newf.size) {
if (!f.size) {
/* If was disabled also before */
configure_drive();
if (verbose > 1)
printf("New configuration saved for later use\n");
} else {
/* If disk now get's disabled */
if (!licence_to_kill()) {
return_val = ERRL_NO_LICENCE;
return;
}
disable_disk();
}
return;
}
if (format_f || disk_bad) {
if (!data_on_disk)
WriteNewFormat();
else
Resize();
}
else if (reconfig_f) {
ReConfig();
if (f.size)
RefreshBootSector();
if (verbose > 1)
printf("Drive %c: reconfigured\n", drive);
}
}
示例12: TRACE
status_t
Inode::WriteAt(Transaction& transaction, off_t pos, const uint8* buffer,
size_t* _length)
{
TRACE("Inode::WriteAt(%lld, %p, *(%p) = %ld)\n", pos, buffer,
_length, *_length);
ReadLocker readLocker(fLock);
if (IsFileCacheDisabled())
return B_BAD_VALUE;
if (pos < 0)
return B_BAD_VALUE;
readLocker.Unlock();
TRACE("Inode::WriteAt(): Starting transaction\n");
transaction.Start(fVolume->GetJournal());
WriteLocker writeLocker(fLock);
TRACE("Inode::WriteAt(): Updating modification time\n");
struct timespec timespec;
_BigtimeToTimespec(real_time_clock_usecs(), ×pec);
SetModificationTime(×pec);
// NOTE: Debugging info to find why sometimes resize doesn't happen
size_t length = *_length;
#ifdef TRACE_EXT2
off_t oldEnd = pos + length;
TRACE("Inode::WriteAt(): Old calc for end? %x:%x\n",
(int)(oldEnd >> 32), (int)(oldEnd & 0xFFFFFFFF));
#endif
off_t end = pos + (off_t)length;
off_t oldSize = Size();
TRACE("Inode::WriteAt(): Old size: %x:%x, new size: %x:%x\n",
(int)(oldSize >> 32), (int)(oldSize & 0xFFFFFFFF),
(int)(end >> 32), (int)(end & 0xFFFFFFFF));
if (end > oldSize) {
status_t status = Resize(transaction, end);
if (status != B_OK) {
*_length = 0;
WriteLockInTransaction(transaction);
return status;
}
status = WriteBack(transaction);
if (status != B_OK) {
*_length = 0;
WriteLockInTransaction(transaction);
return status;
}
}
writeLocker.Unlock();
if (oldSize < pos)
FillGapWithZeros(oldSize, pos);
if (length == 0) {
// Probably just changed the file size with the pos parameter
return B_OK;
}
TRACE("Inode::WriteAt(): Performing write: %p, %lld, %p, %ld\n",
FileCache(), pos, buffer, *_length);
status_t status = file_cache_write(FileCache(), NULL, pos, buffer, _length);
WriteLockInTransaction(transaction);
TRACE("Inode::WriteAt(): Done\n");
return status;
}
示例13: ssh_userauth_kbdint_getname
INT_PTR KBIntDialog::OnInitDialog() {
//TODO: fix the tab order
const char * name = ssh_userauth_kbdint_getname(m_session);
if (!name)
name = "";
::SetDlgItemTextA(m_hwnd, IDC_STATIC_NAMEFIELD, name);
if (m_nrPrompt > 1) { //for each prompt, clone prompt and input fields
HWND hPrompt1 = ::GetDlgItem(m_hwnd, IDC_EDIT_PROMPT1);
HWND hAnswer1 = ::GetDlgItem(m_hwnd, IDC_EDIT_ANSWER1);
HWND hMarker = ::GetDlgItem(m_hwnd, IDC_STATIC_MARKER);
RECT promptRect;
RECT answerRect;
RECT markerRect;
::GetWindowRect(hPrompt1, &promptRect);
ScreenRectToClient(m_hwnd, &promptRect);
::GetWindowRect(hAnswer1, &answerRect);
ScreenRectToClient(m_hwnd, &answerRect);
::GetWindowRect(hMarker, &markerRect);
ScreenRectToClient(m_hwnd, &markerRect);
int deltaY = markerRect.top - promptRect.top;
//int deltaX = 0; //unused
int curPromptID = IDC_EDIT_PROMPT1;
int curAnswerID = IDC_EDIT_ANSWER1;
for(int i = 1; i < m_nrPrompt; i++) {
curPromptID = curPromptID+2;
curAnswerID = curAnswerID+2;
promptRect.top += deltaY;
promptRect.bottom += deltaY;
answerRect.top += deltaY;
answerRect.bottom += deltaY;
::CreateWindowEx(0, WC_EDIT, TEXT(""),
WS_CHILD | WS_VSCROLL | ES_AUTOHSCROLL | ES_MULTILINE | ES_READONLY | WS_VISIBLE,
promptRect.left, promptRect.top, promptRect.right-promptRect.left, promptRect.bottom-promptRect.top,
m_hwnd, (HMENU)curPromptID, m_hInstance, NULL);
::CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, TEXT(""),
WS_CHILD | WS_BORDER | ES_AUTOHSCROLL | WS_VISIBLE,
answerRect.left, answerRect.top, answerRect.right-answerRect.left, answerRect.bottom-answerRect.top,
m_hwnd, (HMENU)curPromptID, m_hInstance, NULL);
}
int totalDeltaY = deltaY * (m_nrPrompt-1);
HWND hBtnOK = ::GetDlgItem(m_hwnd, IDOK);
HWND hBtnCancel = ::GetDlgItem(m_hwnd, IDCANCEL);
RECT btnRect;
::GetWindowRect(hBtnOK, &btnRect);
ScreenRectToClient(m_hwnd, &btnRect);
::MoveWindow(hBtnOK, btnRect.left, btnRect.top+totalDeltaY, btnRect.right-btnRect.left, btnRect.bottom-btnRect.top, TRUE);
::GetWindowRect(hBtnCancel, &btnRect);
ScreenRectToClient(m_hwnd, &btnRect);
::MoveWindow(hBtnCancel, btnRect.left, btnRect.top+totalDeltaY, btnRect.right-btnRect.left, btnRect.bottom-btnRect.top, TRUE);
RECT winRect;
::GetWindowRect(m_hwnd, &winRect);
Resize(winRect.right-winRect.left, winRect.bottom-winRect.top+totalDeltaY);
}
for(int i = 0; i < m_nrPrompt; i++) {
char echo = 0;
const char * prompt = ssh_userauth_kbdint_getprompt(m_session, i, &echo);
::SetDlgItemTextA(m_hwnd, IDC_EDIT_PROMPT1+(i*2), prompt);
if (!echo) {
HWND hCurAnswer = ::GetDlgItem(m_hwnd, IDC_EDIT_ANSWER1+(i*2));
//LONG_PTR style = ::GetWindowLongPtr(hCurAnswer, GWL_STYLE);
//::SetWindowLongPtr(hCurAnswer, GWL_STYLE, style|ES_PASSWORD);
::SendMessage(hCurAnswer, EM_SETPASSWORDCHAR, (WPARAM)'*', 0);
}
}
Dialog::OnInitDialog();
::SetFocus(::GetDlgItem(m_hwnd, IDC_EDIT_ANSWER1));
return FALSE;
}
示例14: Resize
Matrix<T>::Matrix(VectorIndex nRowsP, VectorIndex nColsP) {
Resize(nRowsP, nColsP);
}
示例15: ClearMap
void MapEditor::LoadMapgen(const std::string &name)
{
std::fstream sfile;
sfile.open(name, std::ios_base::in);
if(sfile.fail())
{
SYSTEM_STREAM << "Error open " << name << std::endl;
return;
}
ClearMap();
std::stringstream ss;
sfile.seekg (0, std::ios::end);
std::streamoff length = sfile.tellg();
sfile.seekg (0, std::ios::beg);
char* buff = new char[static_cast<size_t>(length)];
sfile.read(buff, length);
sfile.close();
ss.write(buff, length);
delete[] buff;
int x, y, z;
ss >> x;
ss >> y;
ss >> z;
Resize(x, y, z);
while (ss)
{
std::string t_item;
size_t x, y, z;
ss >> t_item;
if (!ss)
{
continue;
}
ss >> x;
if (!ss)
{
continue;
}
ss >> y;
if (!ss)
{
continue;
}
ss >> z;
if (!ss)
{
continue;
}
MapEditor::EditorEntry* ee;
if (turf_types_.find(t_item) != turf_types_.end())
{
ee = &SetTurf(t_item, x, y, z);
}
else
{
ee = &AddItem(t_item, x, y, z);
}
WrapReadMessage(ss, ee->variables);
// TODO
UpdateDirs(ee);
}
}